2
0

♻️ Add a new unlimited plan

Closes #273
This commit is contained in:
Baptiste Arnaud
2023-01-27 15:00:07 +01:00
parent 4f78dda640
commit 409e7643ad
12 changed files with 49 additions and 12 deletions

View File

@ -106,7 +106,10 @@ export const MembersList = () => {
)}
{workspace && (
<Heading fontSize="2xl">
Members ({currentMembersCount}/{getSeatsLimit(workspace)})
Members{' '}
{getSeatsLimit(workspace) === -1
? ''
: `(${currentMembersCount}/${getSeatsLimit(workspace)})`}
</Heading>
)}
{workspace?.id && canEdit && (

View File

@ -12,8 +12,12 @@ export function checkCanInviteMember({
}) {
if (!plan || !currentMembersCount) return false
return (
getSeatsLimit({ plan, customSeatsLimit: customSeatsLimit ?? null }) >
currentMembersCount
)
const seatsLimit = getSeatsLimit({
plan,
customSeatsLimit: customSeatsLimit ?? null,
})
if (seatsLimit === -1) return true
return seatsLimit > currentMembersCount
}

View File

@ -1,7 +1,7 @@
import { Plan } from 'db'
export const parseWorkspaceDefaultPlan = (userEmail: string) => {
if (process.env.ADMIN_EMAIL === userEmail) return Plan.LIFETIME
if (process.env.ADMIN_EMAIL === userEmail) return Plan.UNLIMITED
const defaultPlan = process.env.DEFAULT_WORKSPACE_PLAN as Plan | undefined
if (defaultPlan && Object.values(Plan).includes(defaultPlan))
return defaultPlan