Skip to content

Commit 9bd60ec

Browse files
authored
only apply seat limit in cloud (#1358)
* only apply seat limit in cloud * format
1 parent b5656b4 commit 9bd60ec

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

apps/web/app/(org)/dashboard/settings/organization/components/InviteDialog.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,6 @@ export const InviteDialog = ({
115115
},
116116
});
117117

118-
const handleSendInvites = () => {
119-
sendInvites.mutate();
120-
};
121-
122118
return (
123119
<Dialog open={isOpen} onOpenChange={setIsOpen}>
124120
<DialogContent className="p-0 w-full max-w-md rounded-xl border bg-gray-2 border-gray-4">
@@ -214,7 +210,7 @@ export const InviteDialog = ({
214210
inviteEmails.length === 0 ||
215211
remainingSeats === 0
216212
}
217-
onClick={handleSendInvites}
213+
onClick={() => sendInvites.mutate()}
218214
>
219215
Send Invites
220216
</Button>

apps/web/app/(org)/dashboard/settings/organization/components/MembersCard.tsx

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client";
22

3+
import { buildEnv } from "@cap/env";
34
import {
45
Button,
56
Card,
@@ -146,22 +147,24 @@ export const MembersCard = ({
146147
<CardDescription>Manage your organization members.</CardDescription>
147148
</CardHeader>
148149
<div className="flex flex-wrap gap-3">
149-
<Tooltip
150-
position="top"
151-
content="Once inside the Stripe dashboard, click 'Manage Plan', then increase quantity of subscriptions to purchase more seats"
152-
>
153-
<Button
154-
type="button"
155-
size="sm"
156-
variant="primary"
157-
className="px-6 min-w-auto"
158-
spinner={loading}
159-
disabled={!isOwner || loading}
160-
onClick={handleManageBilling}
150+
{buildEnv.NEXT_PUBLIC_IS_CAP && (
151+
<Tooltip
152+
position="top"
153+
content="Once inside the Stripe dashboard, click 'Manage Plan', then increase quantity of subscriptions to purchase more seats"
161154
>
162-
{loading ? "Loading..." : "+ Purchase more seats"}
163-
</Button>
164-
</Tooltip>
155+
<Button
156+
type="button"
157+
size="sm"
158+
variant="primary"
159+
className="px-6 min-w-auto"
160+
spinner={loading}
161+
disabled={!isOwner || loading}
162+
onClick={handleManageBilling}
163+
>
164+
{loading ? "Loading..." : "+ Purchase more seats"}
165+
</Button>
166+
</Tooltip>
167+
)}
165168
<Button
166169
type="button"
167170
size="sm"

apps/web/utils/organization.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { buildEnv } from "@cap/env";
2+
13
/**
24
* Calculate organization seats information
35
*/
@@ -10,10 +12,9 @@ export function calculateSeats(organization: {
1012
const memberCount = organization?.members?.length ?? 0;
1113
const pendingInvitesCount = organization?.invites?.length ?? 0;
1214
const totalUsedSeats = memberCount + pendingInvitesCount;
13-
const remainingSeats =
14-
process.env.NODE_ENv === "development"
15-
? Number.MAX_SAFE_INTEGER
16-
: Math.max(0, inviteQuota - totalUsedSeats);
15+
const remainingSeats = buildEnv.NEXT_PUBLIC_IS_CAP
16+
? Math.max(0, inviteQuota - totalUsedSeats)
17+
: Number.MAX_SAFE_INTEGER;
1718

1819
return {
1920
inviteQuota,

0 commit comments

Comments
 (0)