@@ -32,9 +32,10 @@ export const UsageProgressBars = ({ workspace }: Props) => {
|
||||
|
||||
const workspaceChatsLimit = getChatsLimit(workspace)
|
||||
|
||||
const chatsPercentage = Math.round(
|
||||
(totalChatsUsed / workspaceChatsLimit) * 100
|
||||
)
|
||||
const chatsPercentage =
|
||||
workspaceChatsLimit === 'inf'
|
||||
? 0
|
||||
: Math.round((totalChatsUsed / workspaceChatsLimit) * 100)
|
||||
|
||||
return (
|
||||
<Stack spacing={6}>
|
||||
@@ -79,7 +80,7 @@ export const UsageProgressBars = ({ workspace }: Props) => {
|
||||
</Skeleton>
|
||||
<Text>
|
||||
/{' '}
|
||||
{workspaceChatsLimit === -1
|
||||
{workspaceChatsLimit === 'inf'
|
||||
? scopedT('unlimited')
|
||||
: parseNumberWithCommas(workspaceChatsLimit)}
|
||||
</Text>
|
||||
|
||||
@@ -92,9 +92,12 @@ export const MembersList = () => {
|
||||
|
||||
const seatsLimit = workspace ? getSeatsLimit(workspace) : undefined
|
||||
|
||||
const canInviteNewMember = workspace
|
||||
? currentMembersCount < (seatsLimit as number)
|
||||
: false
|
||||
const canInviteNewMember =
|
||||
seatsLimit === 'inf'
|
||||
? true
|
||||
: seatsLimit
|
||||
? currentMembersCount < seatsLimit
|
||||
: false
|
||||
|
||||
return (
|
||||
<Stack w="full" spacing={3}>
|
||||
|
||||
@@ -36,9 +36,10 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
where: { workspaceId: workspace.id },
|
||||
}),
|
||||
])
|
||||
const seatsLimit = getSeatsLimit(workspace)
|
||||
if (
|
||||
getSeatsLimit(workspace) <=
|
||||
existingMembersCount + existingInvitationsCount
|
||||
seatsLimit !== 'inf' &&
|
||||
seatsLimit <= existingMembersCount + existingInvitationsCount
|
||||
)
|
||||
return res.status(400).send('Seats limit reached')
|
||||
if (existingUser) {
|
||||
|
||||
Reference in New Issue
Block a user