Skip to content
Source
Sign inSign up
pingdotgg/t3code

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 intomain fromrefs/pull/7204/headopened View on GitHub

Summary

Allows users to show or hide the topbar action controls (Action scripts, Open in editor, Git source control) by right-clicking on the header bar or buttons.

Changes

  • Created persistent useHeaderControlsStore with localStorage support for action visibility toggles.
  • Added context menu on topbar header and action buttons to list and toggle visible controls with checkmarks.
  • Conditionally render header action buttons based on user preferences.
  • Added unit tests for store and menu helpers.

Note

Low Risk UI preference state in localStorage only; no auth, data, or API behavior changes beyond conditional header rendering.

Overview Adds a right-click context menu on the chat header actions strip so users can show or hide Action scripts, Open in editor, and Git source control. Choices are stored in a new persisted useHeaderControlsStore (localStorage key t3code:header-controls:v1); all three default to visible.

ChatHeader wires the menu through the local contextMenu.show API, toggles visibility on selection, and wraps each control in a container that uses hidden when turned off. Right-clicks inside [data-chat-header-actions] open this menu instead of being ignored; the breadcrumb/title area still opens the existing thread actions menu. buildHeaderControlsContextMenuItems builds checkmarked menu labels; unit tests cover the store and menu helper.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 9d2170454cbff3cabdcb87e646d75d3acdf1e9fa. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Add context menu to chat header for toggling header controls visibility

  • Adds a right-click context menu on the header actions area that lets users toggle visibility of Scripts, Open in Editor, and Git controls.
  • Introduces buildHeaderControlsContextMenuItems in ChatHeader.tsx to format menu items with checkmark/unchecked indicators based on current visibility.
  • Adds useHeaderControlsStore in headerControlsStore.ts, a Zustand store that persists visibility state to localStorage under the key t3code:header-controls:v1.
  • Behavioral Change: right-clicking within the header actions area now opens the visibility menu instead of the thread context menu.
Macroscope summarized 9d21704.
    1. Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

    2. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: b8c0a771-94ea-4683-9265-691cd1e5af28

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    3. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    4. Reviewed the header-controls customization for UI consistency. Three concrete issues in apps/web/src/components/chat/ChatHeader.tsx: the checkmark column does not survive the web context-menu fallback's rendering, hiding "Open in editor" also unbinds its global keyboard shortcut, and the thread action menu's right-click target is narrowed from the breadcrumb row to the title button only.

      Posted via Macroscope — UI Consistency
    5. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      1 blocking correctness issue found. This PR introduces a new user-facing feature with new state management and persistence. Multiple unresolved comments identify a usability bug where hiding all three controls collapses the container to zero height, making the context menu inaccessible and the controls unrecoverable. New capabilities warrant human review.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    6. @@ -313,5 +359,6 @@
      313359 </WorkspaceBreadcrumb>
      314360 <div
      315361 data-chat-header-actions
      362+ onContextMenu={handleHeaderActionsContextMenu}
      316363 className={cn(
      317364 "flex shrink-0 items-center justify-end gap-2 @3xl/header-actions:gap-3",

      🟡 Medium chat/ChatHeader.tsx:364

      When all three controls are hidden, the [data-chat-header-actions] element collapses to zero height, so right-clicking the header can only open the thread menu and there is no way to reopen the visibility menu. Give this container a header-height hit area so its context-menu handler remains reachable even when its children are unmounted or display: none.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/web/src/components/chat/ChatHeader.tsx around line 364:
      
      When all three controls are hidden, the `[data-chat-header-actions]` element collapses to zero height, so right-clicking the header can only open the thread menu and there is no way to reopen the visibility menu. Give this container a header-height hit area so its context-menu handler remains reachable even when its children are unmounted or `display: none`.
    7. Reviewed the header controls visibility toggle for UI/behavioral consistency. One finding: hiding the git control unmounts it, which takes app-wide git-status refresh down with it. The openIn control already uses the correct CSS-hidden approach.

      Posted via Macroscope — UI Consistency
    8. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 9d2170454cbff3cabdcb87e646d75d3acdf1e9fa. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -340,8 +386,15 @@
      386+ keybindings={keybindings}
      387+ availableEditors={availableEditors}
      388+ openInCwd={openInCwd}
      389+ />
      390+ </div>
      340391 )}
      341392 {activeProjectName && (
      342- <GitActionsControl
      343- gitCwd={gitCwd}
      344- activeThreadRef={scopeThreadRef(activeThreadEnvironmentId, activeThreadId)}
      345- onOpenPullRequest={onOpenPullRequest}
      346- {...(draftId ? { draftId } : {})}
      347- />
      393+ <div className={cn(!visibility.git && "hidden")}>
      394+ <GitActionsControl
      395+ gitCwd={gitCwd}
      396+ activeThreadRef={scopeThreadRef(activeThreadEnvironmentId, activeThreadId)}
      397+ onOpenPullRequest={onOpenPullRequest}
      398+ {...(draftId ? { draftId } : {})}
      399+ />
      400+ </div>

      Hidden git control stays active

      Low Severity

      Hiding Git source control now only applies Tailwind hidden instead of unmounting GitActionsControl. The control keeps running its focus and visibility VCS refresh listeners, status subscription, and draft branch sync, so background git work continues after the user hides the chrome. The actions strip already has min-w-6 for the context-menu hit target, so keeping this tree mounted is not required for that UX.

      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 9d2170454cbff3cabdcb87e646d75d3acdf1e9fa. Configure [here](https://www.cursor.com/dashboard/bugbot).
    9. One finding on the header actions hit area.

      Posted via Macroscope — UI Consistency
      @@ -313,5 +359,6 @@
      313359 </WorkspaceBreadcrumb>
      314360 <div
      315361 data-chat-header-actions
      362+ 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",
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      h-full here resolves to auto: the actions cluster's containing block is the ChatHeader root (ChatHeader.tsx:274), which is a flex item of the items-center topbar <header> (ChatView.tsx:6214) and therefore has an indefinite (content) height, so height: 100% never picks up --workspace-topbar-height. With every control toggled off the three wrappers are display:none, so this container has zero content height — min-w-6 gives width but the box is 24x0 and cannot be right-clicked. Since this context menu is the only way to re-enable the controls and the choice is persisted in localStorage, hiding all three leaves the header controls unrecoverable.

      Consider stretching to the row instead of relying on a percentage height, so the empty region keeps a real hit area:

      Suggested change
      364- "flex h-full min-w-6 shrink-0 items-center justify-end gap-2 @3xl/header-actions:gap-3",
      364+ "flex min-w-6 shrink-0 items-center justify-end gap-2 self-stretch @3xl/header-actions:gap-3",
      Posted via Macroscope — UI Consistency
    10. Note

      🤖 GPT-5.6 Sol responding on behalf of Theo

      We're closing this PR as we clean up the T3 Code backlog. Thank you for taking the time to put this together.

      This adds persisted visibility state and a context menu for existing header actions. Hiding core actions reduces discovery and adds settings state for a small layout preference.

      If you believe we closed this in error, please reopen the PR and leave a comment explaining what we missed.

Sign in to join this conversation.