Skip to content

Commit 3103fcd

Browse files
committed
remove constant window property and unsafe cast
1 parent 449b7de commit 3103fcd

4 files changed

Lines changed: 6 additions & 20 deletions

File tree

packages/shared/src/analytics-events.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,6 @@ export interface UsageViewedProperties {
632632
sustained_used_percent: number | null;
633633
/** Daily bucket percent (0-100), null when usage is unavailable. */
634634
burst_used_percent: number | null;
635-
spend_analysis_window_days: number;
636635
}
637636

638637
export interface SpendAnalysisTaskOpenedProperties {

packages/ui/src/features/usage/UsageView.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { ChartLine, CreditCard, WarningCircle } from "@phosphor-icons/react";
22
import {
33
fillSpendDays,
44
type SpendAnalysisWindow,
5-
windowToDays,
65
} from "@posthog/core/billing/spendAnalysisFormat";
76
import {
87
Empty,
@@ -90,7 +89,6 @@ export function UsageView() {
9089
isPro,
9190
sustainedUsedPercent: usage?.sustained.used_percent ?? null,
9291
burstUsedPercent: usage?.burst.used_percent ?? null,
93-
spendAnalysisWindowDays: windowToDays(spendWindow),
9492
});
9593

9694
if (!billingEnabled && !spendAnalysisEnabled) {

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ export function WindowSelector({ value, onChange }: WindowSelectorProps) {
1717
<SegmentedControl.Root
1818
value={value}
1919
size="1"
20-
onValueChange={(next) => onChange(next as SpendAnalysisWindow)}
20+
onValueChange={(next) => {
21+
const found = WINDOW_OPTIONS.find((option) => option.value === next);
22+
if (found) onChange(found.value);
23+
}}
2124
aria-label="Spend analysis window"
2225
>
2326
{WINDOW_OPTIONS.map((option) => (

packages/ui/src/features/usage/useTrackUsageViewed.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,10 @@ export interface TrackUsageViewedInput {
77
isPro: boolean;
88
sustainedUsedPercent: number | null;
99
burstUsedPercent: number | null;
10-
spendAnalysisWindowDays: number;
1110
}
1211

1312
export function useTrackUsageViewed(input: TrackUsageViewedInput): void {
14-
const {
15-
isLoading,
16-
isPro,
17-
sustainedUsedPercent,
18-
burstUsedPercent,
19-
spendAnalysisWindowDays,
20-
} = input;
13+
const { isLoading, isPro, sustainedUsedPercent, burstUsedPercent } = input;
2114

2215
const firedRef = useRef(false);
2316
useEffect(() => {
@@ -29,13 +22,6 @@ export function useTrackUsageViewed(input: TrackUsageViewedInput): void {
2922
is_pro: isPro,
3023
sustained_used_percent: sustainedUsedPercent,
3124
burst_used_percent: burstUsedPercent,
32-
spend_analysis_window_days: spendAnalysisWindowDays,
3325
});
34-
}, [
35-
isLoading,
36-
isPro,
37-
sustainedUsedPercent,
38-
burstUsedPercent,
39-
spendAnalysisWindowDays,
40-
]);
26+
}, [isLoading, isPro, sustainedUsedPercent, burstUsedPercent]);
4127
}

0 commit comments

Comments
 (0)