Remove flex from stats display. See snapshots for diffs. (#14983)

This commit is contained in:
Jacob Richman
2025-12-12 12:19:39 -08:00
committed by GitHub
parent 20164ebcda
commit 6dea66f1f5
3 changed files with 30 additions and 23 deletions
@@ -65,7 +65,7 @@ interface SectionProps {
} }
const Section: React.FC<SectionProps> = ({ title, children }) => ( const Section: React.FC<SectionProps> = ({ title, children }) => (
<Box flexDirection="column" width="100%" marginBottom={1}> <Box flexDirection="column" marginBottom={1}>
<Text bold color={theme.text.primary}> <Text bold color={theme.text.primary}>
{title} {title}
</Text> </Text>
@@ -174,11 +174,18 @@ const ModelUsageTable: React.FC<{
yellow: CACHE_EFFICIENCY_MEDIUM, yellow: CACHE_EFFICIENCY_MEDIUM,
}); });
const totalWidth =
nameWidth +
requestsWidth +
(showQuotaColumn
? usageLimitWidth
: uncachedWidth + cachedWidth + outputTokensWidth);
return ( return (
<Box flexDirection="column" marginTop={1}> <Box flexDirection="column" marginTop={1}>
{/* Header */} {/* Header */}
<Box alignItems="flex-end"> <Box alignItems="flex-end">
<Box width={nameWidth} flexGrow={1}> <Box width={nameWidth}>
<Text bold color={theme.text.primary} wrap="truncate-end"> <Text bold color={theme.text.primary} wrap="truncate-end">
Model Usage Model Usage
</Text> </Text>
@@ -248,12 +255,12 @@ const ModelUsageTable: React.FC<{
borderLeft={false} borderLeft={false}
borderRight={false} borderRight={false}
borderColor={theme.border.default} borderColor={theme.border.default}
width="100%" width={totalWidth}
></Box> ></Box>
{rows.map((row) => ( {rows.map((row) => (
<Box key={row.key}> <Box key={row.key}>
<Box width={nameWidth} flexGrow={1}> <Box width={nameWidth}>
<Text color={theme.text.primary} wrap="truncate-end"> <Text color={theme.text.primary} wrap="truncate-end">
{row.modelName} {row.modelName}
</Text> </Text>
@@ -18,9 +18,9 @@ exports[`<SessionSummaryDisplay /> > renders the summary display with a title 1`
│ » Tool Time: 0s (0.0%) │ │ » Tool Time: 0s (0.0%) │
│ │ │ │
│ │ │ │
│ Model Usage Reqs Input Tokens Cache Reads Output Tokens │ │ Model Usage Reqs Input Tokens Cache Reads Output Tokens
│ ────────────────────────────────────────────────────────────────────────────────────────────── │ ────────────────────────────────────────────────────────────────────────────
│ gemini-2.5-pro 10 500 500 2,000 │ │ gemini-2.5-pro 10 500 500 2,000
│ │ │ │
│ Savings Highlight: 500 (50.0%) of input tokens were served from the cache, reducing costs. │ │ Savings Highlight: 500 (50.0%) of input tokens were served from the cache, reducing costs. │
│ │ │ │
@@ -118,9 +118,9 @@ exports[`<StatsDisplay /> > Conditional Rendering Tests > hides Efficiency secti
│ » Tool Time: 0s (0.0%) │ │ » Tool Time: 0s (0.0%) │
│ │ │ │
│ │ │ │
│ Model Usage Reqs Input Tokens Cache Reads Output Tokens │ │ Model Usage Reqs Input Tokens Cache Reads Output Tokens
│ ────────────────────────────────────────────────────────────────────────────────────────────── │ ────────────────────────────────────────────────────────────────────────────
│ gemini-2.5-pro 1 100 0 100 │ │ gemini-2.5-pro 1 100 0 100
│ │ │ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯" ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯"
`; `;
@@ -162,9 +162,9 @@ exports[`<StatsDisplay /> > Quota Display > renders quota information for unused
│ » Tool Time: 0s (0.0%) │ │ » Tool Time: 0s (0.0%) │
│ │ │ │
│ │ │ │
│ Model Usage Reqs Usage left │ Model Usage Reqs Usage left
│ ────────────────────────────────────────────────────────────────────────────────────────────── │ ────────────────────────────────────────────────────────────
│ gemini-2.5-flash - 50.0% (Resets in 2h) │ gemini-2.5-flash - 50.0% (Resets in 2h)
│ │ │ │
│ Usage limits span all sessions and reset daily. │ │ Usage limits span all sessions and reset daily. │
│ /auth to upgrade or switch to API key. │ │ /auth to upgrade or switch to API key. │
@@ -192,9 +192,9 @@ exports[`<StatsDisplay /> > Quota Display > renders quota information when quota
│ » Tool Time: 0s (0.0%) │ │ » Tool Time: 0s (0.0%) │
│ │ │ │
│ │ │ │
│ Model Usage Reqs Usage left │ Model Usage Reqs Usage left
│ ────────────────────────────────────────────────────────────────────────────────────────────── │ ────────────────────────────────────────────────────────────
│ gemini-2.5-pro 1 75.0% (Resets in 1h 30m) │ gemini-2.5-pro 1 75.0% (Resets in 1h 30m)
│ │ │ │
│ Usage limits span all sessions and reset daily. │ │ Usage limits span all sessions and reset daily. │
│ /auth to upgrade or switch to API key. │ │ /auth to upgrade or switch to API key. │
@@ -262,10 +262,10 @@ exports[`<StatsDisplay /> > renders a table with two models correctly 1`] = `
│ » Tool Time: 0s (0.0%) │ │ » Tool Time: 0s (0.0%) │
│ │ │ │
│ │ │ │
│ Model Usage Reqs Input Tokens Cache Reads Output Tokens │ │ Model Usage Reqs Input Tokens Cache Reads Output Tokens
│ ────────────────────────────────────────────────────────────────────────────────────────────── │ ────────────────────────────────────────────────────────────────────────────
│ gemini-2.5-pro 3 500 500 2,000 │ │ gemini-2.5-pro 3 500 500 2,000
│ gemini-2.5-flash 5 15,000 10,000 15,000 │ │ gemini-2.5-flash 5 15,000 10,000 15,000
│ │ │ │
│ Savings Highlight: 10,500 (40.4%) of input tokens were served from the cache, reducing costs. │ │ Savings Highlight: 10,500 (40.4%) of input tokens were served from the cache, reducing costs. │
│ │ │ │
@@ -290,9 +290,9 @@ exports[`<StatsDisplay /> > renders all sections when all data is present 1`] =
│ » Tool Time: 123ms (55.2%) │ │ » Tool Time: 123ms (55.2%) │
│ │ │ │
│ │ │ │
│ Model Usage Reqs Input Tokens Cache Reads Output Tokens │ │ Model Usage Reqs Input Tokens Cache Reads Output Tokens
│ ────────────────────────────────────────────────────────────────────────────────────────────── │ ────────────────────────────────────────────────────────────────────────────
│ gemini-2.5-pro 1 50 50 100 │ │ gemini-2.5-pro 1 50 50 100
│ │ │ │
│ Savings Highlight: 50 (50.0%) of input tokens were served from the cache, reducing costs. │ │ Savings Highlight: 50 (50.0%) of input tokens were served from the cache, reducing costs. │
│ │ │ │