Skip to content

Commit 233cdcf

Browse files
committed
address greptile feedback on usage limit modal
1 parent 2f3cf9d commit 233cdcf

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

apps/code/src/renderer/features/billing/components/UsageLimitModal.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ export function UsageLimitModal() {
1616
const isOpen = useUsageLimitStore((s) => s.isOpen);
1717
const bucket = useUsageLimitStore((s) => s.bucket);
1818
const resetAt = useUsageLimitStore((s) => s.resetAt);
19+
const eventIsPro = useUsageLimitStore((s) => s.isPro);
1920
const hide = useUsageLimitStore((s) => s.hide);
20-
const { isPro } = useSeat();
21+
const { isPro: seatIsPro } = useSeat();
22+
const isPro = eventIsPro ?? seatIsPro;
2123

2224
useEffect(() => {
2325
if (isOpen) {
@@ -36,7 +38,7 @@ export function UsageLimitModal() {
3638
};
3739

3840
const handleSupport = () => {
39-
trpcClient.os.openExternal.mutate({ url: SUPPORT_MAILTO });
41+
void trpcClient.os.openExternal.mutate({ url: SUPPORT_MAILTO });
4042
};
4143

4244
const isDaily = bucket === "burst";
@@ -59,7 +61,7 @@ export function UsageLimitModal() {
5961
const description = isPro
6062
? `Your Pro plan has ${proCapLabel}.${resetLabel ? ` ${resetLabel}.` : ""}`
6163
: `You've hit your Free ${
62-
isDaily ? "daily" : "usage"
64+
isDaily ? "daily" : isMonthly ? "monthly" : "usage"
6365
} limit. Upgrade to Pro for 20x more usage.`;
6466

6567
return (

apps/code/src/renderer/features/billing/stores/usageLimitStore.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,15 @@ interface UsageLimitState {
66
isOpen: boolean;
77
bucket: UsageLimitBucket | null;
88
resetAt: string | null;
9+
isPro: boolean | null;
910
}
1011

1112
interface UsageLimitActions {
12-
show: (args?: { bucket: UsageLimitBucket; resetAt: string }) => void;
13+
show: (args?: {
14+
bucket: UsageLimitBucket;
15+
resetAt: string;
16+
isPro?: boolean;
17+
}) => void;
1318
hide: () => void;
1419
}
1520

@@ -19,12 +24,14 @@ export const useUsageLimitStore = create<UsageLimitStore>()((set) => ({
1924
isOpen: false,
2025
bucket: null,
2126
resetAt: null,
27+
isPro: null,
2228

2329
show: (args) =>
2430
set({
2531
isOpen: true,
2632
bucket: args?.bucket ?? null,
2733
resetAt: args?.resetAt ?? null,
34+
isPro: args?.isPro ?? null,
2835
}),
2936
hide: () => set({ isOpen: false }),
3037
}));

apps/code/src/renderer/features/billing/subscriptions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export function registerBillingSubscriptions() {
2323
useUsageLimitStore.getState().show({
2424
bucket: event.bucket,
2525
resetAt: event.resetAt,
26+
isPro: event.isPro,
2627
});
2728
return;
2829
}

0 commit comments

Comments
 (0)