Add empty-state usage CTA to status bar (#4854)

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Brennan Benson
2026-06-08 11:48:11 -07:00
committed by GitHub
co-authored by Orca
parent c10c2adcad
commit 32d53d552e
2 changed files with 115 additions and 26 deletions
@@ -46,6 +46,7 @@ import { ResourceUsageStatusSegment } from './ResourceUsageStatusSegment'
import { PortsStatusSegment } from './PortsStatusSegment'
import { isStatusBarItemAvailable } from './status-bar-agent-gating'
import { isProviderConfigured } from './status-bar-provider-visibility'
import { StatusBarUsageEmptyCta } from './StatusBarUsageEmptyCta'
import { shouldOpenStatusBarContextMenu } from './status-bar-context-menu-policy'
import { PetStatusSegment } from './PetStatusSegment'
import { TOGGLE_FLOATING_TERMINAL_EVENT } from '@/lib/floating-terminal'
@@ -1621,6 +1622,17 @@ function StatusBarInner({ floatingTerminalOpen }: StatusBarProps): React.JSX.Ele
floatingTerminalEnabled && floatingTerminalTriggerLocation === 'status-bar'
const anyVisible =
showClaude || showCodex || showGemini || showOpencodeGo || showKimi || showResourceUsage
// Why: a brand-new user with no provider configured would otherwise see an
// empty left side of the status bar and wonder what's missing. The CTA
// names the surface and points to the setup path. Detection is on
// configuration (not user toggles) so users who intentionally hid a
// provider's bar don't get the teaching prompt back.
const isEmptyUsageState =
!isProviderConfigured(claude) &&
!isProviderConfigured(codex) &&
!isProviderConfigured(gemini) &&
!isProviderConfigured(opencodeGo) &&
!isProviderConfigured(kimi)
const anyFetching =
claude?.status === 'fetching' ||
codex?.status === 'fetching' ||
@@ -1656,33 +1668,41 @@ function StatusBarInner({ floatingTerminalOpen }: StatusBarProps): React.JSX.Ele
}}
>
<div className="flex items-center gap-3">
{showClaude && <ClaudeSwitcherMenu claude={claude} compact={compact} iconOnly={iconOnly} />}
{showCodex && <CodexSwitcherMenu codex={codex} compact={compact} iconOnly={iconOnly} />}
{showGemini && (
<ProviderDetailsMenu
provider={gemini}
compact={compact}
iconOnly={iconOnly}
ariaLabel="Open Gemini usage details"
/>
{isEmptyUsageState ? (
<StatusBarUsageEmptyCta />
) : (
<>
{showClaude && (
<ClaudeSwitcherMenu claude={claude} compact={compact} iconOnly={iconOnly} />
)}
{showCodex && <CodexSwitcherMenu codex={codex} compact={compact} iconOnly={iconOnly} />}
{showGemini && (
<ProviderDetailsMenu
provider={gemini}
compact={compact}
iconOnly={iconOnly}
ariaLabel="Open Gemini usage details"
/>
)}
{showOpencodeGo && (
<ProviderDetailsMenu
provider={opencodeGo}
compact={compact}
iconOnly={iconOnly}
ariaLabel="Open OpenCode Go usage details"
/>
)}
{showKimi && (
<ProviderDetailsMenu
provider={kimi}
compact={compact}
iconOnly={iconOnly}
ariaLabel="Open Kimi usage details"
/>
)}
</>
)}
{showOpencodeGo && (
<ProviderDetailsMenu
provider={opencodeGo}
compact={compact}
iconOnly={iconOnly}
ariaLabel="Open OpenCode Go usage details"
/>
)}
{showKimi && (
<ProviderDetailsMenu
provider={kimi}
compact={compact}
iconOnly={iconOnly}
ariaLabel="Open Kimi usage details"
/>
)}
{anyVisible && (
{anyVisible && !isEmptyUsageState && (
<Tooltip>
<TooltipTrigger asChild>
<button
@@ -0,0 +1,69 @@
import React, { useCallback } from 'react'
import { BarChart3 } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { HoverCard, HoverCardContent, HoverCardTrigger } from '@/components/ui/hover-card'
import { AgentIcon } from '@/lib/agent-catalog'
import { useAppStore } from '../../store'
import { ClaudeIcon, GeminiIcon, OpenAIIcon, OpenCodeGoIcon } from './icons'
// Why: a brand-new user has no configured provider, so the bottom-left would
// otherwise be empty but for a refresh icon with nothing to refresh. This CTA
// names the surface and routes to AI Provider Accounts — connecting an account
// there is what makes the usage chips (and account switching) appear here.
export function StatusBarUsageEmptyCta(): React.JSX.Element {
const openSettingsPage = useAppStore((s) => s.openSettingsPage)
const openSettingsTarget = useAppStore((s) => s.openSettingsTarget)
const recordFeatureInteraction = useAppStore((s) => s.recordFeatureInteraction)
// 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.
const handleOpenSettings = useCallback(() => {
recordFeatureInteraction('usage-tracking')
openSettingsTarget({ pane: 'accounts', repoId: null })
openSettingsPage()
}, [openSettingsPage, openSettingsTarget, recordFeatureInteraction])
return (
<HoverCard openDelay={150} closeDelay={80}>
<HoverCardTrigger asChild>
<button
type="button"
onClick={handleOpenSettings}
aria-label="Connect AI accounts 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>
</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>
<p className="text-muted-foreground">
Connect your AI provider accounts to see their usage in real time and easily switch
between accounts.
</p>
{/* Why: name the full provider set so the feature doesn't read as
support for just one agent. */}
<div className="flex items-center gap-1.5 text-muted-foreground">
<span>Supports:</span>
<ClaudeIcon size={13} />
<OpenAIIcon size={13} />
<GeminiIcon size={13} />
<OpenCodeGoIcon size={13} />
<AgentIcon agent="kimi" size={13} />
</div>
<Button
type="button"
variant="default"
size="sm"
onClick={handleOpenSettings}
className="mt-0.5 h-7 w-full text-xs"
>
Connect an account
</Button>
</div>
</HoverCardContent>
</HoverCard>
)
}