feat: make status bar empty usage CTA dismissible (#4898)

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Brennan Benson
2026-06-08 15:47:29 -07:00
committed by GitHub
co-authored by Orca
parent 4d2d31fc27
commit cd4ca13080
4 changed files with 54 additions and 5 deletions
@@ -1519,6 +1519,7 @@ function StatusBarInner({ floatingTerminalOpen }: StatusBarProps): React.JSX.Ele
// purely by the experimentalPet settings flag.
const petEnabled = useAppStore((s) => s.settings?.experimentalPet === true)
const toggleStatusBarItem = useAppStore((s) => s.toggleStatusBarItem)
const usageEmptyStateDismissed = useAppStore((s) => s.usageEmptyStateDismissed)
const containerRef = useRef<HTMLDivElement>(null)
const mountedRef = useRef(true)
const [isRefreshing, setIsRefreshing] = useState(false)
@@ -1633,6 +1634,9 @@ function StatusBarInner({ floatingTerminalOpen }: StatusBarProps): React.JSX.Ele
!isProviderConfigured(gemini) &&
!isProviderConfigured(opencodeGo) &&
!isProviderConfigured(kimi)
// Why: the teaching CTA is a one-time nudge — once the user hides it, keep it
// hidden even after providers are disconnected again.
const showEmptyUsageCta = isEmptyUsageState && !usageEmptyStateDismissed
const anyFetching =
claude?.status === 'fetching' ||
codex?.status === 'fetching' ||
@@ -1669,7 +1673,9 @@ function StatusBarInner({ floatingTerminalOpen }: StatusBarProps): React.JSX.Ele
>
<div className="flex items-center gap-3">
{isEmptyUsageState ? (
<StatusBarUsageEmptyCta />
showEmptyUsageCta ? (
<StatusBarUsageEmptyCta />
) : null
) : (
<>
{showClaude && (
@@ -1,7 +1,8 @@
import React, { useCallback } from 'react'
import { BarChart3 } from 'lucide-react'
import { BarChart3, EyeOff } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { HoverCard, HoverCardContent, HoverCardTrigger } from '@/components/ui/hover-card'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import { AgentIcon } from '@/lib/agent-catalog'
import { useAppStore } from '../../store'
import { ClaudeIcon, GeminiIcon, OpenAIIcon, OpenCodeGoIcon } from './icons'
@@ -14,6 +15,7 @@ export function StatusBarUsageEmptyCta(): React.JSX.Element {
const openSettingsPage = useAppStore((s) => s.openSettingsPage)
const openSettingsTarget = useAppStore((s) => s.openSettingsTarget)
const recordFeatureInteraction = useAppStore((s) => s.recordFeatureInteraction)
const dismissUsageEmptyState = useAppStore((s) => s.dismissUsageEmptyState)
// Why: the accounts pane lists every provider, so we don't preselect a
// section ID — a brand-new user has no "Claude" or "Codex" yet.
@@ -23,22 +25,45 @@ export function StatusBarUsageEmptyCta(): React.JSX.Element {
openSettingsPage()
}, [openSettingsPage, openSettingsTarget, recordFeatureInteraction])
const handleHide = useCallback(() => {
dismissUsageEmptyState()
}, [dismissUsageEmptyState])
return (
<HoverCard openDelay={150} closeDelay={80}>
<HoverCardTrigger asChild>
<button
type="button"
onClick={handleOpenSettings}
aria-label="Connect AI accounts to see usage"
aria-label="Connect an AI account to see usage"
className="inline-flex h-5 cursor-pointer items-center gap-1.5 rounded px-1.5 text-xs font-normal text-muted-foreground transition-colors hover:bg-accent/70 hover:text-foreground"
>
<BarChart3 className="size-3.5" />
<span>Connect AI accounts to see usage</span>
<span>Connect an AI account to see usage</span>
</button>
</HoverCardTrigger>
<HoverCardContent side="top" align="start" sideOffset={8} className="w-[260px] p-2.5">
<div className="space-y-2 text-xs leading-[1.45]">
<div className="font-semibold text-foreground">Agent usage limits</div>
<div className="flex items-start justify-between gap-2">
<div className="font-semibold text-foreground">Agent usage limits</div>
{/* Why: permanently hide the teaching CTA — styling mirrors the
SetupGuideSidebarEntry hover-state icon (muted → foreground). */}
<Tooltip>
<TooltipTrigger asChild>
<button
type="button"
onClick={handleHide}
aria-label="Hide from status bar"
className="-mr-1 -mt-0.5 inline-flex size-5 shrink-0 cursor-pointer items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent/70 hover:text-foreground"
>
<EyeOff className="size-3.5" />
</button>
</TooltipTrigger>
<TooltipContent side="top" sideOffset={6}>
Hide from status bar
</TooltipContent>
</Tooltip>
</div>
<p className="text-muted-foreground">
Connect your AI provider accounts to see their usage in real time and easily switch
between accounts.
+14
View File
@@ -728,6 +728,8 @@ export type UISlice = {
setSetupGuideSidebarDismissed: (dismissed: boolean) => void
browserImportHintHidden: boolean
setBrowserImportHintHidden: (hidden: boolean) => void
usageEmptyStateDismissed: boolean
dismissUsageEmptyState: () => void
groupBy: 'none' | 'workspace-status' | 'repo' | 'pr-status'
setGroupBy: (g: UISlice['groupBy']) => void
sortBy: 'name' | 'smart' | 'recent' | 'repo' | 'manual'
@@ -1645,6 +1647,15 @@ export const createUISlice: StateCreator<AppState, [], [], UISlice> = (set, get)
window.api.ui.set({ browserImportHintHidden: hidden }).catch(console.error)
return { browserImportHintHidden: hidden }
}),
usageEmptyStateDismissed: false,
dismissUsageEmptyState: () =>
set((s) => {
if (s.usageEmptyStateDismissed) {
return s
}
window.api.ui.set({ usageEmptyStateDismissed: true }).catch(console.error)
return { usageEmptyStateDismissed: true }
}),
groupBy: 'repo',
// Why: group keys are mode-specific (e.g. repo id vs PR status), so
@@ -1994,6 +2005,9 @@ export const createUISlice: StateCreator<AppState, [], [], UISlice> = (set, get)
),
setupGuideSidebarDismissed: ui.setupGuideSidebarDismissed === true,
browserImportHintHidden: ui.browserImportHintHidden === true,
// Why: default false when undefined so existing users still see the CTA;
// only an explicit dismissal persists true.
usageEmptyStateDismissed: ui.usageEmptyStateDismissed === true,
// Why: restore visited-row acks alongside the persisted hook entries
// they pair with. Stale acks for paneKeys whose tab/PTY no longer
// exists are inert (no row references them); a paneKey reuse stamps a
+4
View File
@@ -2654,6 +2654,10 @@ export type PersistedUIState = {
/** User-dismissed browser import hint in the browser toolbar. Import remains
* available from Settings > Browser and the toolbar overflow menu. */
browserImportHintHidden?: boolean
/** User-hidden empty-state usage CTA in the status bar. Permanently hides the
* "Connect AI accounts to see usage" prompt even if all providers are later
* disconnected — a dismissed teaching nudge stays dismissed. */
usageEmptyStateDismissed?: boolean
/** URL to navigate to when a new browser tab is opened. Null means blank tab.
* Phase 3 will expand this to a full BrowserSessionProfile per workspace. */
browserDefaultUrl?: string | null