diff --git a/packages/cli/src/ui/components/Footer.tsx b/packages/cli/src/ui/components/Footer.tsx index ce597ffcf9..4460c6bd44 100644 --- a/packages/cli/src/ui/components/Footer.tsx +++ b/packages/cli/src/ui/components/Footer.tsx @@ -133,7 +133,6 @@ interface ErrorIndicatorProps { const ErrorIndicator: React.FC = ({ errorCount }) => ( - | ); @@ -287,7 +286,8 @@ export const Footer: React.FC = () => { )} {!showErrorDetails && errorCount > 0 && ( - + + | )} @@ -426,16 +426,11 @@ export const Footer: React.FC = () => { totalTokens += m.tokens.total; } if (totalTokens > 0) { - let formatted: string; - if (totalTokens >= 1_000_000_000) { - formatted = `${(totalTokens / 1_000_000_000).toFixed(1)}b`; - } else if (totalTokens >= 1_000_000) { - formatted = `${(totalTokens / 1_000_000).toFixed(1)}m`; - } else if (totalTokens >= 1000) { - formatted = `${(totalTokens / 1000).toFixed(1)}k`; - } else { - formatted = totalTokens.toString(); - } + const formatter = new Intl.NumberFormat('en-US', { + notation: 'compact', + maximumFractionDigits: 1, + }); + const formatted = formatter.format(totalTokens).toLowerCase(); addElement( id, {formatted} tokens, diff --git a/packages/cli/src/ui/components/__snapshots__/FooterConfigDialog.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/FooterConfigDialog.test.tsx.snap new file mode 100644 index 0000000000..d321bf1c7d --- /dev/null +++ b/packages/cli/src/ui/components/__snapshots__/FooterConfigDialog.test.tsx.snap @@ -0,0 +1,35 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[` > renders correctly with default settings 1`] = ` +"╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ │ +│ Configure Footer │ +│ Select which items to display in the footer. │ +│ │ +│ Type to search │ +│ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ │ │ │ +│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ +│ │ +│ > [✓] cwd Current directory path │ +│ [✓] git-branch Current git branch name │ +│ [✓] sandbox-status Sandbox type and trust indicator │ +│ [✓] model-name Current model identifier │ +│ [✓] quota Remaining usage on daily limit │ +│ [ ] context-remaining Percentage of context window remaining │ +│ [ ] memory-usage Node.js heap memory usage │ +│ [ ] session-id Unique identifier for the current session │ +│ [ ] code-changes Lines added/removed in the session │ +│ [ ] token-count Total tokens used in the session │ +│ │ +│ Reset to default footer │ +│ │ +│ ↑/↓ navigate · ←/→ reorder · enter select · esc close │ +│ │ +│ ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ +│ │ Preview: │ │ +│ │ ~/project/path | main* | docker | gemini-2.5-pro | daily 97% │ │ +│ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ │ +│ │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯" +`;