From 3adf04fdb5b487a3f47ea1795898922b7bb94e52 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 dropped link whose open joins the pane already holding its tab keeps the tab in its slot, as its click does; a web link outside chat drags for any HTTP or HTTPS URL, as its click opens any, opens the URL its click resolves to, and joins the project's browser history when it opens in the preview browser, as a chat link does; the Device item's drag checks setup when it starts. Every link drop still plans with the stand-in tab. Test fixture: installFakeEnvironment sends its server config and a replacement shell snapshot to subscriptions an earlier test left open, so the app holds exactly this test's own install. Co-Authored-By: Claude Opus 5.5 --- apps/web/src/components/ChatView.tsx | 2 +- apps/web/src/components/RightPanelTabs.tsx | 23 +- .../chat/ThreadDetailsIssueRows.tsx | 3 + .../components/chat/ThreadDetailsPrRow.tsx | 4 + .../components/chat/ThreadDetailsPrRows.tsx | 8 + .../components/chat/useRightPanelActions.ts | 2 +- .../pullRequest/ThreadPullRequestsPanel.tsx | 4 + .../dashboardLinkDrag.browser.test.tsx | 228 ++++++ .../src/fork/dashboard/dashboardMarkdown.tsx | 10 +- .../web/src/fork/rightPanelMenu/menu.logic.ts | 11 +- .../fork/rightPanelMenu/rightPanelMenu.tsx | 42 ++ .../fork/subThreads/SubThreadReplyLine.tsx | 5 + .../src/fork/subThreads/SubThreadsPanel.tsx | 10 +- .../subThreadReplyButton.browser.test.tsx | 168 +++++ .../fork/workArea/WorkArea.browser.test.tsx | 661 +++++++++++++++++- apps/web/src/fork/workArea/WorkArea.tsx | 23 +- apps/web/src/fork/workArea/chatAnchorLink.ts | 129 +++- .../src/fork/workArea/chatOpenerContext.ts | 15 +- apps/web/src/fork/workArea/linkDrop.logic.ts | 4 +- apps/web/src/fork/workArea/linkSources.ts | 106 ++- .../workArea/linkedItemsDrag.browser.test.tsx | 379 ++++++++++ apps/web/src/fork/workArea/panelLinkDrag.ts | 48 +- apps/web/src/fork/workArea/useLinkDrops.ts | 6 +- .../src/fork/workArea/workArea.logic.test.ts | 21 +- .../web/src/fork/workArea/workAreaCommands.ts | 31 +- .../fork/workArea/workAreaPlacement.logic.ts | 25 +- .../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 | 131 ++-- 31 files changed, 2003 insertions(+), 151 deletions(-) create mode 100644 apps/web/src/fork/dashboard/dashboardLinkDrag.browser.test.tsx 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 971fbbb6eb33f..0a2258419b2b3 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -3001,7 +3001,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 62606cdb2cebe..b6c889508a6a8 100644 --- a/apps/web/src/components/RightPanelTabs.tsx +++ b/apps/web/src/components/RightPanelTabs.tsx @@ -36,7 +36,9 @@ import { } from "~/fork/dashboard/dashboardSurface"; import { AllMenuItemsHidden, + type SurfaceActionDrag, useArrangedSurfaceActions, + useSurfaceActionDrag, } from "~/fork/rightPanelMenu/rightPanelMenu"; import { displayTitle, @@ -169,7 +171,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; @@ -179,7 +185,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; @@ -339,10 +345,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; @@ -367,8 +375,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; @@ -560,6 +569,7 @@ function RightPanelEmptyState(props: { } >