fix: drive usage indicator by active provider window

This commit is contained in:
DhanushSantosh
2026-01-23 18:21:15 +05:30
parent 42ee4f211d
commit 5cf817e9de

View File

@@ -244,11 +244,14 @@ export function UsagePopover() {
return 'bg-green-500'; return 'bg-green-500';
}; };
// Determine which provider icon and percentage to show on the header button const codexWindowMinutes = codexUsage?.rateLimits?.primary?.windowDurationMins ?? null;
const hasClaudeUsage = Boolean(claudeUsage); const codexWindowLabel = codexWindowMinutes
const hasCodexUsage = Boolean(codexUsage); ? getCodexWindowLabel(codexWindowMinutes).title
const useClaudeIndicator = hasClaudeUsage || (!hasCodexUsage && isClaudeAuthenticated); : 'Window';
const indicatorInfo = useClaudeIndicator
// Determine which provider icon and percentage to show based on active tab
const indicatorInfo =
activeTab === 'claude'
? { ? {
icon: AnthropicIcon, icon: AnthropicIcon,
percentage: claudeSessionPercentage, percentage: claudeSessionPercentage,
@@ -259,7 +262,7 @@ export function UsagePopover() {
icon: OpenAIIcon, icon: OpenAIIcon,
percentage: codexMaxPercentage, percentage: codexMaxPercentage,
isStale: isCodexStale, isStale: isCodexStale,
title: 'Usage', title: `Usage (${codexWindowLabel})`,
}; };
const statusColor = getStatusInfo(indicatorInfo.percentage).color; const statusColor = getStatusInfo(indicatorInfo.percentage).color;