feat(web): allow customizing topbar header controls visibility via context menu #7204
Closedkbrianps(GitHub profile, opens in a new tab)wants to merge 3 commits into
main fromrefs/pull/7204/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/web/src/components/chat/ChatHeader.tsx line 264OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -206,5 +249,16 @@206- // The right-side controls (git, scripts, open-in) keep their own207- // behavior; only the breadcrumb area opens the thread menu.208- if ((event.target as HTMLElement).closest("[data-chat-header-actions]")) return;209- event.preventDefault();210- openMenu({ x: event.clientX, y: event.clientY });249+ const isActionsArea = Boolean(250+ (event.target as HTMLElement).closest("[data-chat-header-actions]"),251+ );252+ if (isActionsArea) {253+ void handleHeaderActionsContextMenu(event);254+ return;255+ }256+ const isTitleArea = Boolean(257+ (event.target as HTMLElement).closest("[data-thread-title-anchor]"),258+ );259+ if (isServerThread && renamingTitle === null && isTitleArea) {260+ event.preventDefault();261+ openMenu({ x: event.clientX, y: event.clientY });262+ return;263+ }264+ void handleHeaderActionsContextMenu(event);
- apps/web/src/components/chat/ChatHeader.tsx lines 98 to 108OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -88,3 +91,18 @@8891 return { action: "commit", title: trimmed };8992 }909394+export function buildHeaderControlsContextMenuItems(95+ visibility: HeaderControlsVisibility,96+): readonly ContextMenuItem<keyof HeaderControlsVisibility>[] {97+ return [98+ {99+ id: "scripts",100+ label: `${visibility.scripts ? "✓ " : " "}Action scripts`,101+ },102+ {103+ id: "openIn",104+ label: `${visibility.openIn ? "✓ " : " "}Open in editor`,105+ },106+ {107+ id: "git",108+ label: `${visibility.git ? "✓ " : " "}Git source control`,apps/web/src/components/chat/ChatHeader.tsx lines 256 to 264OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -206,5 +249,16 @@206- // The right-side controls (git, scripts, open-in) keep their own207- // behavior; only the breadcrumb area opens the thread menu.208- if ((event.target as HTMLElement).closest("[data-chat-header-actions]")) return;209- event.preventDefault();210- openMenu({ x: event.clientX, y: event.clientY });249+ const isActionsArea = Boolean(250+ (event.target as HTMLElement).closest("[data-chat-header-actions]"),251+ );252+ if (isActionsArea) {253+ void handleHeaderActionsContextMenu(event);254+ return;255+ }256+ const isTitleArea = Boolean(257+ (event.target as HTMLElement).closest("[data-thread-title-anchor]"),258+ );259+ if (isServerThread && renamingTitle === null && isTitleArea) {260+ event.preventDefault();261+ openMenu({ x: event.clientX, y: event.clientY });262+ return;263+ }264+ void handleHeaderActionsContextMenu(event);apps/web/src/components/chat/ChatHeader.tsx lines 389 to 389OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -330,4 +386,4 @@330386 onDeleteScript={onDeleteProjectScript}331387 />332388 )}333- {showOpenInPicker && (389+ {visibility.openIn && showOpenInPicker && (
- @@ -313,5 +359,6 @@313359 </WorkspaceBreadcrumb>314360 <div315361 data-chat-header-actions362+ onContextMenu={handleHeaderActionsContextMenu}316363 className={cn(317364 "flex shrink-0 items-center justify-end gap-2 @3xl/header-actions:gap-3",
- apps/web/src/components/chat/ChatHeader.tsx lines 390 to 390OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -331,11 +378,13 @@331378 />332379 )}333380 {showOpenInPicker && (334- <OpenInPicker335- environmentId={activeThreadEnvironmentId}336- keybindings={keybindings}337- availableEditors={availableEditors}338- openInCwd={openInCwd}339- />381+ <div className={cn(!visibility.openIn && "hidden")}>382+ <OpenInPicker383+ environmentId={activeThreadEnvironmentId}384+ keybindings={keybindings}385+ availableEditors={availableEditors}386+ openInCwd={openInCwd}387+ />388+ </div>340389 )}341- {activeProjectName && (390+ {visibility.git && activeProjectName && (
- @@ -340,8 +386,15 @@386+ keybindings={keybindings}387+ availableEditors={availableEditors}388+ openInCwd={openInCwd}389+ />390+ </div>340391 )}341392 {activeProjectName && (342- <GitActionsControl343- gitCwd={gitCwd}344- activeThreadRef={scopeThreadRef(activeThreadEnvironmentId, activeThreadId)}345- onOpenPullRequest={onOpenPullRequest}346- {...(draftId ? { draftId } : {})}347- />393+ <div className={cn(!visibility.git && "hidden")}>394+ <GitActionsControl395+ gitCwd={gitCwd}396+ activeThreadRef={scopeThreadRef(activeThreadEnvironmentId, activeThreadId)}397+ onOpenPullRequest={onOpenPullRequest}398+ {...(draftId ? { draftId } : {})}399+ />400+ </div>
- @@ -313,5 +359,6 @@313359 </WorkspaceBreadcrumb>314360 <div315361 data-chat-header-actions362+ onContextMenu={handleHeaderActionsContextMenu}316363 className={cn(317- "flex shrink-0 items-center justify-end gap-2 @3xl/header-actions:gap-3",364+ "flex h-full min-w-6 shrink-0 items-center justify-end gap-2 @3xl/header-actions:gap-3",
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.


copilot-pull-request-reviewer[bot](GitHub profile, opens in a new tab) reviewed
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.