Skip to content

Commit b590a31

Browse files
authored
Removed the usage prediction for now (#1326)
1 parent 55dcdc7 commit b590a31

File tree

2 files changed

+12
-59
lines changed

2 files changed

+12
-59
lines changed

apps/webapp/app/components/billing/v3/UsageBar.tsx

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,16 @@ type UsageBarProps = {
88
current: number;
99
billingLimit?: number;
1010
tierLimit?: number;
11-
projectedUsage?: number;
1211
isPaying: boolean;
1312
};
1413

1514
const startFactor = 4;
1615

17-
export function UsageBar({
18-
current,
19-
billingLimit,
20-
tierLimit,
21-
projectedUsage,
22-
isPaying,
23-
}: UsageBarProps) {
24-
const getLargestNumber = Math.max(
25-
current,
26-
tierLimit ?? -Infinity,
27-
projectedUsage ?? -Infinity,
28-
billingLimit ?? -Infinity,
29-
5
30-
);
16+
export function UsageBar({ current, billingLimit, tierLimit, isPaying }: UsageBarProps) {
17+
const getLargestNumber = Math.max(current, tierLimit ?? -Infinity, billingLimit ?? -Infinity, 5);
3118
//creates a maximum range for the progress bar, add 10% to the largest number so the bar doesn't reach the end
3219
const maxRange = Math.round(getLargestNumber * 1.1);
3320
const tierRunLimitPercentage = tierLimit ? Math.round((tierLimit / maxRange) * 100) : 0;
34-
const projectedRunsPercentage = projectedUsage
35-
? Math.round((projectedUsage / maxRange) * 100)
36-
: 0;
3721
const billingLimitPercentage =
3822
billingLimit !== undefined ? Math.round((billingLimit / maxRange) * 100) : 0;
3923
const usagePercentage = Math.round((current / maxRange) * 100);
@@ -42,7 +26,7 @@ export function UsageBar({
4226
const usageCappedToLimitPercentage = Math.min(usagePercentage, tierRunLimitPercentage);
4327

4428
return (
45-
<div className="h-fit w-full py-12">
29+
<div className="h-fit w-full py-6">
4630
<div className="relative h-3 w-full rounded-sm bg-background-bright">
4731
{billingLimit !== undefined && (
4832
<motion.div
@@ -93,23 +77,6 @@ export function UsageBar({
9377
/>
9478
</motion.div>
9579
)}
96-
{projectedUsage !== undefined && projectedUsage !== 0 && (
97-
<motion.div
98-
initial={{ width: projectedRunsPercentage / startFactor + "%" }}
99-
animate={{ width: projectedRunsPercentage + "%" }}
100-
transition={{ duration: 1.5, type: "spring" }}
101-
style={{ width: `${projectedRunsPercentage}%` }}
102-
className="absolute h-3 rounded-l-sm"
103-
>
104-
<Legend
105-
text="Projected:"
106-
value={formatCurrency(projectedUsage, false)}
107-
position="topRow2"
108-
percentage={projectedRunsPercentage}
109-
/>
110-
</motion.div>
111-
)}
112-
11380
<motion.div
11481
initial={{ width: usageCappedToLimitPercentage / startFactor + "%" }}
11582
animate={{ width: usageCappedToLimitPercentage + "%" }}

apps/webapp/app/routes/_app.orgs.$organizationSlug.v3.usage/route.tsx

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -139,39 +139,25 @@ export default function Page() {
139139
}
140140
>
141141
{(usage) => (
142-
<>
143-
<div className="flex w-full items-center gap-6">
144-
<div className="flex flex-col gap-2">
145-
<Header3 className="">
146-
{isCurrentMonth ? "Month-to-date" : "Usage"}
147-
</Header3>
148-
<p className="text-3xl font-medium text-text-bright">
149-
{formatCurrency(usage.overall.current, false)}
150-
</p>
151-
</div>
152-
{isCurrentMonth ? (
153-
<>
154-
<ArrowRightIcon className="h-6 w-6 text-text-dimmed/50" />
155-
<div className="flex flex-col gap-2 text-text-dimmed">
156-
<Header3 className="text-text-dimmed">Projected</Header3>
157-
<p className="text-3xl font-medium">
158-
{formatCurrency(usage.overall.projected, false)}
159-
</p>
160-
</div>
161-
</>
162-
) : null}
142+
<div className="flex items-center gap-8">
143+
<div className="flex flex-col gap-2">
144+
<Header3 className="whitespace-nowrap">
145+
{isCurrentMonth ? "Month-to-date" : "Usage"}
146+
</Header3>
147+
<p className="whitespace-nowrap text-3xl font-medium text-text-bright">
148+
{formatCurrency(usage.overall.current, false)}
149+
</p>
163150
</div>
164151
<UsageBar
165152
current={usage.overall.current}
166-
projectedUsage={isCurrentMonth ? usage.overall.projected : undefined}
167153
isPaying={currentPlan?.v3Subscription?.isPaying ?? false}
168154
tierLimit={
169155
isCurrentMonth
170156
? (currentPlan?.v3Subscription?.plan?.limits.includedUsage ?? 0) / 100
171157
: undefined
172158
}
173159
/>
174-
</>
160+
</div>
175161
)}
176162
</Await>
177163
</Suspense>

0 commit comments

Comments
 (0)