@ -34,6 +34,7 @@ export const BillingContent = () => {
|
||||
</HStack>
|
||||
{workspace.plan !== Plan.CUSTOM &&
|
||||
workspace.plan !== Plan.LIFETIME &&
|
||||
workspace.plan !== Plan.UNLIMITED &&
|
||||
workspace.plan !== Plan.OFFERED && <ChangePlanForm />}
|
||||
</Stack>
|
||||
|
||||
|
@ -136,7 +136,12 @@ export const UsageContent = ({ workspace }: Props) => {
|
||||
>
|
||||
{storageToReadable(totalStorageUsed)}
|
||||
</Skeleton>
|
||||
<Text>/ {workspaceStorageLimit} GB</Text>
|
||||
<Text>
|
||||
/{' '}
|
||||
{workspaceStorageLimit === -1
|
||||
? 'Unlimited'
|
||||
: `${workspaceStorageLimit} GB`}
|
||||
</Text>
|
||||
</HStack>
|
||||
</Flex>
|
||||
<Progress
|
||||
|
@ -8,6 +8,7 @@ export const planColorSchemes: Record<Plan, ThemeTypings['colorSchemes']> = {
|
||||
[Plan.STARTER]: 'orange',
|
||||
[Plan.FREE]: 'gray',
|
||||
[Plan.CUSTOM]: 'yellow',
|
||||
[Plan.UNLIMITED]: 'yellow',
|
||||
}
|
||||
|
||||
export const PlanTag = ({
|
||||
@ -64,12 +65,23 @@ export const PlanTag = ({
|
||||
return (
|
||||
<Tag
|
||||
colorScheme={planColorSchemes[Plan.CUSTOM]}
|
||||
data-testid="free-plan-tag"
|
||||
data-testid="custom-plan-tag"
|
||||
{...props}
|
||||
>
|
||||
Custom
|
||||
</Tag>
|
||||
)
|
||||
}
|
||||
case Plan.UNLIMITED: {
|
||||
return (
|
||||
<Tag
|
||||
colorScheme={planColorSchemes[Plan.UNLIMITED]}
|
||||
data-testid="custom-unlimite-tag"
|
||||
{...props}
|
||||
>
|
||||
Unlimited
|
||||
</Tag>
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,8 @@ export const planToReadable = (plan?: Plan) => {
|
||||
return 'Offered'
|
||||
case Plan.PRO:
|
||||
return 'Pro'
|
||||
case Plan.UNLIMITED:
|
||||
return 'Unlimited'
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,4 +24,5 @@ export const isProPlan = (workspace?: Pick<Workspace, 'plan'>) =>
|
||||
isDefined(workspace) &&
|
||||
(workspace.plan === Plan.PRO ||
|
||||
workspace.plan === Plan.LIFETIME ||
|
||||
workspace.plan === Plan.CUSTOM)
|
||||
workspace.plan === Plan.CUSTOM ||
|
||||
workspace.plan === Plan.UNLIMITED)
|
||||
|
@ -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 && (
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user