Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

Commit b529205

Browse files
authored
fix(usage): clarify spend summary window (#3428)
1 parent a72d05c commit b529205

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

packages/ui/src/features/usage/components/SpendKpiStrip.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
formatUsd,
3+
formatWindow,
34
type SpendAnalysisFilledDay,
45
windowDays,
56
} from "@posthog/core/billing/spendAnalysisFormat";
@@ -33,14 +34,11 @@ interface SpendKpiStripProps {
3334
export function SpendKpiStrip({ data, filledDays }: SpendKpiStripProps) {
3435
const theme = useChartTheme();
3536
const { summary } = data;
36-
const codeShare =
37-
summary.total_cost_usd > 0
38-
? Math.round((summary.scoped_cost_usd / summary.total_cost_usd) * 100)
39-
: 0;
4037
const labels = filledDays?.map((d) => spendDayLabel(d.day));
4138
const costSeries = filledDays?.map((d) => Math.max(0, d.cost_usd));
4239
const eventSeries = filledDays?.map((d) => d.event_count);
4340
const latestDay = filledDays?.at(-1);
41+
const windowLabel = formatWindow(summary.date_from, summary.date_to);
4442

4543
return (
4644
<Flex className="overflow-hidden rounded-(--radius-3) border border-(--gray-5) bg-(--color-panel-solid)">
@@ -63,7 +61,7 @@ export function SpendKpiStrip({ data, filledDays }: SpendKpiStripProps) {
6361
theme={theme}
6462
formatValue={formatUsd}
6563
change={null}
66-
subtitle={costSeries ? undefined : `${codeShare}% of total`}
64+
restingSubtitle={windowLabel}
6765
sparklineHeight={28}
6866
/>
6967
</KpiCell>
@@ -76,6 +74,7 @@ export function SpendKpiStrip({ data, filledDays }: SpendKpiStripProps) {
7674
theme={theme}
7775
formatValue={(v) => v.toLocaleString()}
7876
change={null}
77+
restingSubtitle={windowLabel}
7978
sparklineHeight={28}
8079
/>
8180
</KpiCell>

0 commit comments

Comments
 (0)