Skip to content

Commit 00d6109

Browse files
chore(web): remove usage limits demo fixtures (pingdotgg#10330)
1 parent b273d1c commit 00d6109

3 files changed

Lines changed: 6 additions & 454 deletions

File tree

‎apps/web/src/components/usage/UsageLimits.tsx‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
} from "@t3tools/contracts";
1010
import { useAtomValue } from "@effect/atom-react";
1111
import {
12-
collectLimitAccounts,
1312
elapsedShare,
1413
formatDuration,
1514
formatResetsIn,
@@ -36,7 +35,6 @@ import {
3635
} from "../ui/alert-dialog";
3736
import { Button } from "../ui/button";
3837
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
39-
import type { makeLimitsFixture } from "./usageLimitsFixture";
4038
import { UsageLimitsPooled } from "./UsageLimitsPooled";
4139
import { PROVIDER_PRESENTATION } from "./usageProviders";
4240

@@ -323,16 +321,12 @@ export function ResetCredits({
323321
*/
324322
export function UsageLimitsSection({
325323
selectedEnvironmentIds,
326-
fixture = null,
327324
}: {
328325
readonly selectedEnvironmentIds: ReadonlySet<EnvironmentId> | null;
329-
/** Dev-only synthetic presentations standing in for the live ones. */
330-
readonly fixture?: ReturnType<typeof makeLimitsFixture> | null;
331326
}) {
332-
const live = useAtomValue(environmentPresentations.presentationsAtom);
327+
const presentations = useAtomValue(environmentPresentations.presentationsAtom);
333328
// Anchored once per mount on purpose: countdowns must not tick (see above).
334329
const [now] = useState(() => Date.now());
335-
const presentations: Parameters<typeof collectLimitAccounts>[0] = fixture ?? live;
336330
const selected =
337331
selectedEnvironmentIds === null
338332
? presentations

‎apps/web/src/components/usage/UsagePage.tsx‎

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ import {
5959
import { WorkspacePageContainer } from "../WorkspacePageContainer";
6060
import { WorkspacePageHeader } from "../WorkspacePageHeader";
6161
import { UsageLimitsSection } from "./UsageLimits";
62-
import { makeLimitsFixture } from "./usageLimitsFixture";
6362
import { UsagePriceOverrides } from "./UsagePriceOverrides";
6463
import { UsageProviderChart, type UsageChartMetric } from "./UsageProviderChart";
6564
import { PROVIDER_ORDER, PROVIDER_PRESENTATION, providersWithUsage } from "./usageProviders";
@@ -110,33 +109,10 @@ export function UsagePage() {
110109
useState<ReadonlySet<EnvironmentId> | null>(null);
111110
const { days: windowDays, window } = windowSelection;
112111
const isPast24Hours = windowDays === 1;
113-
const usage = useUsage(window, selectedEnvironmentIds);
114-
// Dev only: `/usage?limitsFixture=<name>` lists synthetic environments in the
115-
// picker and feeds the Limits view from them, so merge rules can be eyeballed.
116-
const [fixture] = useState(() => {
117-
if (!import.meta.env.DEV) return null;
118-
const name = new URLSearchParams(globalThis.location.search).get("limitsFixture");
119-
return name ? makeLimitsFixture(name, Date.now()) : null;
120-
});
121-
const { merged, environments, selectedEnvironments, isPending, isPartial, refresh } =
122-
useMemo(() => {
123-
if (!fixture || !showingLimits) return usage;
124-
const all = [...fixture].map(([environmentId, presentation]) => ({
125-
environmentId,
126-
label: presentation.entry.target.label,
127-
isPending: false,
128-
error: null,
129-
summary: null,
130-
}));
131-
return {
132-
...usage,
133-
environments: all,
134-
selectedEnvironments:
135-
selectedEnvironmentIds === null
136-
? all
137-
: all.filter((environment) => selectedEnvironmentIds.has(environment.environmentId)),
138-
};
139-
}, [fixture, selectedEnvironmentIds, showingLimits, usage]);
112+
const { merged, environments, selectedEnvironments, isPending, isPartial, refresh } = useUsage(
113+
window,
114+
selectedEnvironmentIds,
115+
);
140116
const presentations = useAtomValue(environmentPresentations.presentationsAtom);
141117
const refreshProviders = useAtomCommand(serverEnvironment.refreshProviders, {
142118
reportFailure: false,
@@ -190,8 +166,6 @@ export function UsagePage() {
190166
if (refreshingRef.current) return;
191167

192168
if (showingLimits) {
193-
// Synthetic data has nothing to re-read.
194-
if (fixture) return;
195169
refreshingRef.current = true;
196170
setIsRefreshing(true);
197171
void Promise.all(
@@ -375,10 +349,7 @@ export function UsagePage() {
375349
: `Select an environment to see ${showingLimits ? "limits" : "usage"}.`}
376350
</p>
377351
) : showingLimits ? (
378-
<UsageLimitsSection
379-
selectedEnvironmentIds={selectedEnvironmentIds}
380-
fixture={fixture}
381-
/>
352+
<UsageLimitsSection selectedEnvironmentIds={selectedEnvironmentIds} />
382353
) : isPending ? (
383354
<UsageSkeleton />
384355
) : (

0 commit comments

Comments
 (0)