From ded110210aaed8de33ddfc98345104c13549cb15 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Wed, 22 Apr 2026 22:38:32 -0700 Subject: [PATCH] fix(status-bar): use shared right-click menu, reposition on re-click, add icons (#969) Switch the status bar right-click menu from the bespoke Radix ContextMenu to the onContextMenuCapture + hidden-trigger DropdownMenu pattern used by WorktreeContextMenu, TerminalContextMenu, and the tab bar. Updates the anchor point on every right-click so opening in a new spot re-anchors instead of leaving the menu where it first appeared. Adds provider / feature icons to each toggle to match the rest of the app. --- .../src/components/status-bar/StatusBar.tsx | 185 ++++++++++-------- 1 file changed, 107 insertions(+), 78 deletions(-) diff --git a/src/renderer/src/components/status-bar/StatusBar.tsx b/src/renderer/src/components/status-bar/StatusBar.tsx index 992385304..337c705aa 100644 --- a/src/renderer/src/components/status-bar/StatusBar.tsx +++ b/src/renderer/src/components/status-bar/StatusBar.tsx @@ -1,17 +1,12 @@ /* eslint-disable max-lines -- Why: the status bar keeps provider rendering, interaction menus, and compact-layout behavior together so the hover/click states stay consistent across Claude and Codex. */ -import { AlertTriangle, ChevronDown, ChevronRight, RefreshCw } from 'lucide-react' +import { AlertTriangle, ChevronDown, ChevronRight, RefreshCw, Terminal, Wifi } from 'lucide-react' import React, { useCallback, useEffect, useRef, useState } from 'react' import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' -import { - ContextMenu, - ContextMenuCheckboxItem, - ContextMenuContent, - ContextMenuTrigger -} from '@/components/ui/context-menu' import { DropdownMenu, + DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, @@ -22,6 +17,7 @@ import { useAppStore } from '../../store' import type { CodexRateLimitAccountsState } from '../../../../shared/types' import type { ProviderRateLimits, RateLimitWindow } from '../../../../shared/rate-limit-types' import { ProviderIcon, ProviderPanel } from './tooltip' +import { ClaudeIcon, OpenAIIcon } from './icons' import { markLiveCodexSessionsForRestart } from '@/lib/codex-session-restart' import { SshStatusSegment } from './SshStatusSegment' import { SessionsStatusSegment } from './SessionsStatusSegment' @@ -399,6 +395,8 @@ function ProviderDetailsMenu({ // StatusBar // --------------------------------------------------------------------------- +const CLOSE_ALL_CONTEXT_MENUS_EVENT = 'orca-close-all-context-menus' + function StatusBarInner(): React.JSX.Element | null { const rateLimits = useAppStore((s) => s.rateLimits) const refreshRateLimits = useAppStore((s) => s.refreshRateLimits) @@ -407,10 +405,18 @@ function StatusBarInner(): React.JSX.Element | null { const toggleStatusBarItem = useAppStore((s) => s.toggleStatusBarItem) const containerRef = useRef(null) const [isRefreshing, setIsRefreshing] = useState(false) + const [menuOpen, setMenuOpen] = useState(false) + const [menuPoint, setMenuPoint] = useState({ x: 0, y: 0 }) const [containerWidth, setContainerWidth] = useState(900) const resizeObserverRef = useRef(null) + useEffect(() => { + const closeMenu = (): void => setMenuOpen(false) + window.addEventListener(CLOSE_ALL_CONTEXT_MENUS_EVENT, closeMenu) + return () => window.removeEventListener(CLOSE_ALL_CONTEXT_MENUS_EVENT, closeMenu) + }, []) + const containerRefCallback = useCallback((node: HTMLDivElement | null) => { if (resizeObserverRef.current) { resizeObserverRef.current.disconnect() @@ -462,80 +468,103 @@ function StatusBarInner(): React.JSX.Element | null { const iconOnly = containerWidth < 500 return ( - - -
-
- {showClaude && ( - - )} - {showCodex && } - {anyVisible && ( - - - - - - Refresh usage data - - - )} -
+
{ + // Why: mirror the right-click pattern used across the app + // (WorktreeContextMenu, TerminalContextMenu, tab bar) — dispatch the + // global close event so peer menus dismiss, then place a hidden + // trigger at the cursor so the menu anchors there. This also lets a + // second right-click reposition the menu instead of leaving it where + // it first opened. + event.preventDefault() + window.dispatchEvent(new Event(CLOSE_ALL_CONTEXT_MENUS_EVENT)) + const bounds = event.currentTarget.getBoundingClientRect() + setMenuPoint({ x: event.clientX - bounds.left, y: event.clientY - bounds.top }) + setMenuOpen(true) + }} + > +
+ {showClaude && ( + + )} + {showCodex && } + {anyVisible && ( + + + + + + Refresh usage data + + + )} +
-
+
-
- {showSessions && } - {showSsh && } -
-
- +
+ {showSessions && } + {showSsh && } +
- - toggleStatusBarItem('claude')} - > - Claude Usage - - toggleStatusBarItem('codex')} - > - Codex Usage - - toggleStatusBarItem('ssh')} - > - SSH Status - - toggleStatusBarItem('sessions')} - > - Terminal Sessions - - - + + +
) }