From 7d5d2d44b1a95e748e439edbc6b7ed9ac087b86e Mon Sep 17 00:00:00 2001 From: oss-sync Date: Thu, 11 Jun 2026 17:19:42 +0000 Subject: [PATCH] sync: update from private repo (6d37c2d) --- ui/src/components/usage/UsagePage.tsx | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/ui/src/components/usage/UsagePage.tsx b/ui/src/components/usage/UsagePage.tsx index e7f4800..81ebb65 100644 --- a/ui/src/components/usage/UsagePage.tsx +++ b/ui/src/components/usage/UsagePage.tsx @@ -91,6 +91,7 @@ function rangeFor(preset: Preset, customFrom: string, customTo: string): { from: } } +const CHART_H = 176; // px — stacked-bar plot height (was the h-44 / 11rem class) const GW = '#6366f1'; // indigo-500 — gateway (source axis) const DR = '#22c55e'; // green-500 — direct (source axis) const OTHER_COLOR = '#94a3b8'; // slate-400 — folded 'other' bucket @@ -357,20 +358,21 @@ function StackedBars({
{t('chart.tokensTitle')}
-
+ {/* Bar heights are computed in pixels off CHART_H, not percentages: a + percentage-height chain inside this flex column collapses to zero + because the column items aren't given a definite height. */} +
{series.map((b) => { const sum = bucketTotal(b); - const hPct = maxBucket > 0 ? (sum / maxBucket) * 100 : 0; + const barPx = maxBucket > 0 ? Math.max((sum / maxBucket) * CHART_H, sum > 0 ? 2 : 0) : 0; return (
-
-
0 ? 2 : 0)}%` }}> - {keys.map((k, i) => { - const v = total(b.segments[k] ?? zeroCounters()); - const segPct = sum > 0 ? (v / sum) * 100 : 0; - return segPct > 0 ?
: null; - })} -
+
+ {keys.map((k, i) => { + const v = total(b.segments[k] ?? zeroCounters()); + const segPx = sum > 0 ? (v / sum) * barPx : 0; + return segPx > 0 ?
: null; + })}
{/* Tooltip (decorative — chart summary is exposed via aria-label) */}