From d93bb04fb5095041ba5ab5382d8ed253684e354b Mon Sep 17 00:00:00 2001 From: Renfei Zhou Date: Tue, 24 Nov 2026 03:28:12 +0000 Subject: [PATCH] feat(fork): drag more work-area openers onto a pane Anything whose click opens a work-area tab can now be dragged onto a pane or tab strip and opens there, through the existing panel-link drop: Reply buttons and Replies list rows, the pane "+" menu and empty-pane launcher items (Device only once set up; Chat places the primary Chat at the drop), Dashboard web links (into the preview browser, as chat web links), and pull request and issue rows in Linked items and Thread details (their tab, or the preview browser where the click opens a browser). Each source builds its PanelLink from its own click opener and predicate. A thread chip now drags only where its click opens a tab: a thread of the same project as a Chat tab, or a side chat of the panel's own thread. Another project's thread no longer falls back to a side-thread pane attached to this thread's workspace. Sidebar rows already used the same check; a real-pointer regression test now covers them. Also: `opensChat` becomes `composer`; async "+" opens (Browser, Side chat) return their promise so a newer click still cancels the drop's place; a release over an open menu is ignored; a user open of a surface that is already shown, or an async "+" open that settles without its tab, ends the "+" menu pick instead of leaving the pane armed (a sync open such as Device setup keeps it); under a live drop a "+" or launcher open adds no pick or launcher place of its own, so an overtaken drop lands where the user's newer action put the focus; the "+" menu closes when the drag ends, however it ends; a "+" item that shows an already-placed tab, or a Reply whose reply tab is placed, moves and shows that tab at the drop, with no ghost where its pane would stay as it is (judged on saved panes, so also in the one-strip view); a join into the pane that holds the tab keeps its slot, as its click does. Co-Authored-By: Claude Opus 5.5 --- apps/web/src/components/ChatView.tsx | 2 +- apps/web/src/components/RightPanelTabs.tsx | 23 +- .../chat/ThreadDetailsIssueRows.tsx | 11 +- .../components/chat/ThreadDetailsPrRow.tsx | 4 + .../components/chat/ThreadDetailsPrRows.tsx | 8 + .../components/chat/useRightPanelActions.ts | 5 +- .../pullRequest/ThreadPullRequestsPanel.tsx | 39 +- .../dashboardLinkDrag.browser.test.tsx | 184 +++++ .../src/fork/dashboard/dashboardMarkdown.tsx | 10 +- .../web/src/fork/rightPanelMenu/menu.logic.ts | 11 +- .../fork/rightPanelMenu/rightPanelMenu.tsx | 26 + .../fork/subThreads/SubThreadReplyLine.tsx | 5 + .../src/fork/subThreads/SubThreadsPanel.tsx | 12 +- .../subThreadReplyButton.browser.test.tsx | 192 ++++++ .../fork/workArea/WorkArea.browser.test.tsx | 644 +++++++++++++++++- apps/web/src/fork/workArea/WorkArea.tsx | 56 +- apps/web/src/fork/workArea/chatAnchorLink.ts | 101 ++- .../src/fork/workArea/chatOpenerContext.ts | 15 +- .../src/fork/workArea/fakeEnvironmentKit.ts | 63 ++ apps/web/src/fork/workArea/linkDrop.logic.ts | 34 +- apps/web/src/fork/workArea/linkSources.ts | 130 +++- .../workArea/linkedItemsDrag.browser.test.tsx | 380 +++++++++++ apps/web/src/fork/workArea/panelLinkDrag.ts | 51 +- apps/web/src/fork/workArea/useLinkDrops.ts | 6 +- .../src/fork/workArea/workArea.logic.test.ts | 6 +- .../web/src/fork/workArea/workAreaCommands.ts | 31 +- .../fork/workArea/workAreaPlacement.logic.ts | 22 +- .../fork/workArea/workAreaStore.logic.test.ts | 4 +- .../fork/workArea/workAreaTabs.logic.test.ts | 41 +- apps/web/src/fork/workArea/workAreaView.ts | 8 +- apps/web/src/lib/sideChatPane.ts | 2 +- apps/web/test/fakeEnvironment.ts | 37 +- 32 files changed, 2028 insertions(+), 135 deletions(-) create mode 100644 apps/web/src/fork/dashboard/dashboardLinkDrag.browser.test.tsx create mode 100644 apps/web/src/fork/workArea/fakeEnvironmentKit.ts create mode 100644 apps/web/src/fork/workArea/linkedItemsDrag.browser.test.tsx diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index 6b0ffa7767869..0d434400f531e 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -2995,7 +2995,7 @@ export default function ChatView(props: ChatViewProps) { ) ? gt("Available once the thread's worktree is set up.") : null; - const openSideChatStable = useStableCallback(() => void sideChat.open()); + const openSideChatStable = useStableCallback(() => sideChat.open()); const openSurfaceInMainView = useOpenSurfaceInMainView(activeThreadRef); const sendSideChatStable = useStableCallback(sideChat.open); const { onConfirmRevertStable, onForkFromRunStable, onRevertTimelineTurnStable } = diff --git a/apps/web/src/components/RightPanelTabs.tsx b/apps/web/src/components/RightPanelTabs.tsx index 34963cd73af99..fa074b5680ece 100644 --- a/apps/web/src/components/RightPanelTabs.tsx +++ b/apps/web/src/components/RightPanelTabs.tsx @@ -35,7 +35,9 @@ import { } from "~/fork/dashboard/dashboardSurface"; import { AllMenuItemsHidden, + type SurfaceActionDrag, useArrangedSurfaceActions, + useSurfaceActionDrag, } from "~/fork/rightPanelMenu/rightPanelMenu"; import { displayTitle, @@ -168,7 +170,11 @@ export interface RightPanelTabsProps void; onCopyFilePath: (relativePath: string) => void; onDuplicateBrowser?: (surface: Entry) => void; - onAddBrowser: () => void; + /** + * Opens a browser tab. A returned promise lets a drop wait for the open, so a user action before + * it settles wins over the drop's place. + */ + onAddBrowser: () => void | Promise; /** Keep separate from the DOM click handler so a MouseEvent cannot become a profile id. */ onAddBrowserInProfile: (profileId: string) => void; onAddTerminal: () => void; @@ -178,7 +184,7 @@ export interface RightPanelTabsProps void; onAddDevice: () => void; /** Absent where side chats are not offered. */ - onAddSideChat?: (() => void) | undefined; + onAddSideChat?: (() => void | Promise) | undefined; /** Items that open the tabs of the thread's display mode and Dashboard switch, such as Replies. */ modeSurfaceActions?: ReadonlyArray | undefined; browserAvailable: boolean; @@ -338,10 +344,12 @@ function SurfaceMenuItem(props: { disabledReason?: string; shortcut: string; onClick: () => void; + drag: ReturnType; children: ReactNode; }) { const item = ( void; + onAddBrowser: () => void | Promise; onAddBrowserInProfile: (profileId: string) => void; browserProfiles: ReadonlyArray<{ readonly id: string; readonly name: string }>; onAddTerminal: () => void; @@ -366,8 +374,9 @@ function RightPanelEmptyState(props: { onAddPullRequests: () => void; onAddDevice: () => void; /** Absent where side chats are not offered. */ - onAddSideChat?: (() => void) | undefined; + onAddSideChat?: (() => void | Promise) | undefined; modeSurfaceActions?: ReadonlyArray | undefined; + actionDrag: SurfaceActionDrag; browserAvailable: boolean; terminalAvailable: boolean; diffAvailable: boolean; @@ -559,6 +568,7 @@ function RightPanelEmptyState(props: { } >