feat(desktop): resize the chat column by dragging its edges

Closed
CH
15d ago
+397-73

What & why

The chat column has a fixed width (max-w-3xl). On wide screens it wastes space, and there is no way to change it. This lets users resize it by dragging its edges.

  • The chat composer gets SymmetricResizeHandles. Drag either edge to resize, double-click to reset, or use the arrow keys when a handle has focus. The transcript follows the width live.
  • The width persists under a new chat-width key (useChatWidthStore, 520 to 1080px), registered in the persisted-key allowlist. Until a user drags, the chat keeps its 48rem default.
  • ChatPane sets a --chat-max-width CSS variable that CHAT_COLUMN_CLASSNAME reads, so every part of the chat column (transcript, composer, work drawer, chips, pending prompts) follows one value.
  • Side padding of the chat goes from 1.5rem to 3.5rem.

#9617 removed the new-workspace composer's handles and store, so this PR now touches the chat only. The new-workspace screen stays as upstream has it. SymmetricResizeHandles lives next to the Composer, without the painted hover line #9617 removed, and the two "Resize … edge" labels return to every catalog with their old translations.

How I tested it

  • bun run typecheck (desktop) and biome pass.
  • bun run check:i18n passes.
  • bun test on the ChatPane and ChatSession folders (571 pass) and the persisted-keys guard (12 pass).
  • Not yet checked by hand in the dev app after the merge with #9617: dragging the chat edges, reset, and the width surviving a restart.

Demo

https://github.com/user-attachments/assets/5ae1eee7-0512-491b-a418-bcb30e53952f

Checklist

  • PR title follows conventional commits (type(scope): subject)
  • bun run lint and bun run typecheck pass (CI fails on lint warnings too)
  • "Allow edits from maintainers" is checked on fork PRs
  • I have signed the CLA (the bot asks on your first PR)

Summary by cubic

Makes the chat column resizable by dragging either of its edges, replacing the fixed-width column. The width is now chat-only: the new-workspace screen keeps its fixed layout.

  • Drag either edge (520–1080px), double-click to reset, or use arrow keys when a handle has focus; the transcript follows live.
  • The width persists under a new chat-width key, and the column falls back to its old 48rem default until the user drags.
  • During a drag the width stays in a non-persisted store field and is written once when the drag ends via lostpointercapture (or when handles unmount mid-drag), so canceled pointers can't leave a stale width and storage isn't written on every pointer move.
  • All chat column elements (transcript, composer, work drawer, chips, pending prompts) follow the width via a shared --chat-max-width CSS variable, falling back to 48rem where it isn't set.
  • Resize handles report aria-valuenow from the rendered box width via a ResizeObserver, so assistive tech stays accurate when the pane is narrower than the saved width.
  • SymmetricResizeHandles lives next to the Composer, and its labels are restored to every locale catalog.

Summary by CodeRabbit

  • New Features
    • Chat panes can be resized from either side. Width changes appear while dragging and are saved when resizing ends.
    • Chat content adapts to the selected pane width, with a default width when no custom size is set.
    • New workspaces have wider horizontal padding.
  • Bug Fixes
    • Resizing commits the final width when a drag ends unexpectedly, helping preserve the last adjustment.