Skip to content

Commit

Permalink
fix usage limit being negative on pro plans
Browse files Browse the repository at this point in the history
  • Loading branch information
aabassiouni committed Sep 15, 2024
1 parent 0f5e578 commit e2ffaae
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@ async function BillingSettingsPage() {
return redirect("/dashboard");
}

const usageAmount = (workspace.remainingInvites - 1000) * -1;
const limit = workspace.plan === "free" ? 1000 : 3000;
const waitlistsUsed = await getWaitlistsForUser(workspace.workspaceID).then((waitlists) => waitlists.length);
const usageLimit = workspace.plan === "free" ? 1000 : 3000;
const waitlistsLimit = workspace.plan === "free" ? 5 : undefined;

const usageAmount = (workspace.remainingInvites - usageLimit) * -1;
const waitlistsUsed = await getWaitlistsForUser(workspace.workspaceID).then((waitlists) => waitlists.length);

return (
<>
<PageHeading>
Expand Down Expand Up @@ -132,9 +133,9 @@ async function BillingSettingsPage() {
<Progress value={(waitlistsUsed / 5) * 100} />
<div className="flex items-center justify-between">
<h1 className="font-medium text-lg">Invite emails sent</h1>
<p>{`${usageAmount}/1000`}</p>
<p>{`${usageAmount}/${usageLimit}`}</p>
</div>
<Progress value={((usageAmount ?? 0) / limit) * 100} />
<Progress value={((usageAmount ?? 0) / usageLimit) * 100} />
</CardContent>
</div>
<PaymentMethod workspace={workspace} />
Expand Down

0 comments on commit e2ffaae

Please sign in to comment.