Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
fix(web): usage hourly breakdown lists every hour chronologically (#7595)
Luis Gustavo Couto Wacker62654d279fcd
diff --git a/apps/web/src/components/usage/UsagePage.tsx b/apps/web/src/components/usage/UsagePage.tsxindex 3c99271c1..cf98be1b0 100644--- a/apps/web/src/components/usage/UsagePage.tsx+++ b/apps/web/src/components/usage/UsagePage.tsx@@ -68,12 +68,15 @@ export function UsagePage() {: enumerateHourStarts(window.sinceTime, window.untilTime),[window.sinceTime, window.untilTime],);- // Newest first: the window can run 90 periods, so the interesting end- // belongs at the top of the table.- const breakdownPeriods = useMemo<readonly (DailyTotals | HourlyTotals)[]>(- () => (isPast24Hours ? merged.hourly : merged.daily).toReversed(),- [isPast24Hours, merged.daily, merged.hourly],- );+ // The hourly window is small enough to render every period: the table then+ // reads chronologically like the chart, instead of jumping between the hours+ // that happened to have activity. Daily windows can run 90 periods, so those+ // stay newest-first with the interesting end on top.+ const breakdownPeriods = useMemo<readonly (DailyTotals | HourlyTotals)[]>(() => {+ if (!isPast24Hours) return merged.daily.toReversed();+ const byHour = new Map(merged.hourly.map((entry) => [entry.hourStart, entry]));+ return hours.map((hourStart) => byHour.get(hourStart) ?? zeroHour(hourStart));+ }, [isPast24Hours, merged.daily, merged.hourly, hours]);const selectWindow = (days: number) => {setWindowSelection({@@ -435,6 +438,17 @@ export function UsagePage() {);}+/** A zero-filled hourly period so the breakdown lists every hour in the window. */+function zeroHour(hourStart: string): HourlyTotals {+ return {+ day: "",+ hourStart,+ costUsd: 0,+ totalTokens: 0,+ byProvider: new Map<UsageProviderKind, { costUsd: number; totalTokens: number }>(),+ };+}+/** Brand mark for the harness a row belongs to. */function ProviderMark({provider,