Skip to content

[Task] Extract SessionSidePanel into focused subcomponents #889

@Astro-Han

Description

@Astro-Han

Goal

packages/app/src/pages/session/session-side-panel.tsx is split into a small shell + a few focused subcomponents, each readable in one pass, with no user-visible behavior change.

Scope

In scope:

  • Move the 5 small exported helpers (formatRightPanelWidth, makeRightPanelResizeHandler, shouldShowReviewFileOpenButton, sortableShellTabIds, openReviewShellTab) and RightPanelShellIcon to a sibling helpers/icons file.
  • Extract the portalled tab strip (chips + sortable + + DropdownMenu + the absolute-positioned right utility toggle from apps#887) into a RightPanelTabStrip component.
  • Extract the Review panel body (the nested Tabs for inner file tabs + DragDropProvider + per-tab content switch, currently the largest single block at lines ~465–577) into a RightPanelReviewBody component.
  • Trim the top-level SessionSidePanel to a thin shell that owns the resize handle, the open/bodyMounted lifecycle, and dispatches each Tabs.Content.
  • Preserve all imports, context dependencies, and DnD wiring.

Out of scope:

  • Any change to the right-panel visual contract, animation, tab semantics, drag-and-drop behavior, or persisted state.
  • Renaming or re-shaping the layout context, createSizing, or useSessionLayout.
  • Touching session.tsx, session-main-view.tsx, or any callsite of SessionSidePanel.

Relevant files or context

Likely files:

  • packages/app/src/pages/session/session-side-panel.tsx (604 lines today; target ~200 after extraction)
  • packages/app/src/pages/session/helpers.ts (natural home for the 5 helpers)
  • New: packages/app/src/pages/session/right-panel-tab-strip.tsx
  • New: packages/app/src/pages/session/right-panel-review-body.tsx

Context:

  • Surfaced during review of apps#887 (right-panel titlebar seam fixes). That PR added ~21 lines to the file but the bulk of the bloat predates it.
  • Per AGENTS.md: "New or actively modified frontend code should be agent-readable: keep files focused, easy to grep, and small enough to read in one pass."
  • Existing test fixture: packages/app/src/pages/session/session-side-panel.test.tsx should keep passing without modification (extraction is structural, not behavioral).

Verification

  • bun test — clean (including session-side-panel.test.tsx).
  • bun --cwd packages/app run typecheck — clean.
  • bun run lint — clean.
  • bun run test:e2e:local session/ — clean (right-panel-tabs hover, right-panel-titlebar contract, session-tab-chip contract, titlebar-right-rail contract).
  • bun run snap right-panel-titlebar and bun run snap right-panel-tabs-hover — pixel-identical to current baselines (PNGs unchanged).
  • Manual: bun run dev:desktop, walk through opening/closing the right panel, switching all five tabs (Status / Files / Review / Terminal / Context), opening files into Review, drag-reordering Review's inner file tabs, drag-reordering Status/Files/Review chips in the titlebar strip, resizing the panel.

Execution mode

Wait for human approval — the agent must not write code or open a PR until a human leaves an explicit "approved" comment on this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low priorityappApplication behavior and product flowstaskNarrow execution, audit, spike, migration, tracking, or upstream follow-up worktech-debtSupplemental cleanup, maintainability, architecture, test, or quality debt context

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions