Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

only apply seat limit in cloud (#1358)

Brendan Allan9bd60ec547a3
diff --git a/apps/web/app/(org)/dashboard/settings/organization/components/InviteDialog.tsx b/apps/web/app/(org)/dashboard/settings/organization/components/InviteDialog.tsx
index 0f966e472..3b7653686 100644
--- a/apps/web/app/(org)/dashboard/settings/organization/components/InviteDialog.tsx
+++ b/apps/web/app/(org)/dashboard/settings/organization/components/InviteDialog.tsx
@@ -115,10 +115,6 @@ export const InviteDialog = ({
},
});
- const handleSendInvites = () => {
- sendInvites.mutate();
- };
-
return (
<Dialog open={isOpen} onOpenChange={setIsOpen}>
<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 = ({
inviteEmails.length === 0 ||
remainingSeats === 0
}
- onClick={handleSendInvites}
+ onClick={() => sendInvites.mutate()}
>
Send Invites
</Button>
diff --git a/apps/web/app/(org)/dashboard/settings/organization/components/MembersCard.tsx b/apps/web/app/(org)/dashboard/settings/organization/components/MembersCard.tsx
index 7d9b0f892..d704f3f42 100644
--- a/apps/web/app/(org)/dashboard/settings/organization/components/MembersCard.tsx
+++ b/apps/web/app/(org)/dashboard/settings/organization/components/MembersCard.tsx
@@ -1,5 +1,6 @@
"use client";
+import { buildEnv } from "@cap/env";
import {
Button,
Card,
@@ -146,22 +147,24 @@ export const MembersCard = ({
<CardDescription>Manage your organization members.</CardDescription>
</CardHeader>
<div className="flex flex-wrap gap-3">
- <Tooltip
- position="top"
- content="Once inside the Stripe dashboard, click 'Manage Plan', then increase quantity of subscriptions to purchase more seats"
- >
- <Button
- type="button"
- size="sm"
- variant="primary"
- className="px-6 min-w-auto"
- spinner={loading}
- disabled={!isOwner || loading}
- onClick={handleManageBilling}
+ {buildEnv.NEXT_PUBLIC_IS_CAP && (
+ <Tooltip
+ position="top"
+ content="Once inside the Stripe dashboard, click 'Manage Plan', then increase quantity of subscriptions to purchase more seats"
>
- {loading ? "Loading..." : "+ Purchase more seats"}
- </Button>
- </Tooltip>
+ <Button
+ type="button"
+ size="sm"
+ variant="primary"
+ className="px-6 min-w-auto"
+ spinner={loading}
+ disabled={!isOwner || loading}
+ onClick={handleManageBilling}
+ >
+ {loading ? "Loading..." : "+ Purchase more seats"}
+ </Button>
+ </Tooltip>
+ )}
<Button
type="button"
size="sm"
diff --git a/apps/web/utils/organization.ts b/apps/web/utils/organization.ts
index 2d72a7832..e8a40e6fa 100644
--- a/apps/web/utils/organization.ts
+++ b/apps/web/utils/organization.ts
@@ -1,3 +1,5 @@
+import { buildEnv } from "@cap/env";
+
/**
* Calculate organization seats information
*/
@@ -10,10 +12,9 @@ export function calculateSeats(organization: {
const memberCount = organization?.members?.length ?? 0;
const pendingInvitesCount = organization?.invites?.length ?? 0;
const totalUsedSeats = memberCount + pendingInvitesCount;
- const remainingSeats =
- process.env.NODE_ENv === "development"
- ? Number.MAX_SAFE_INTEGER
- : Math.max(0, inviteQuota - totalUsedSeats);
+ const remainingSeats = buildEnv.NEXT_PUBLIC_IS_CAP
+ ? Math.max(0, inviteQuota - totalUsedSeats)
+ : Number.MAX_SAFE_INTEGER;
return {
inviteQuota,