Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: paid users limit in UI (#3210)
- Loading branch information
Showing
5 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
frontend/src/component/admin/users/CreateUser/SeatCostWarning/SeatCostWarning.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { VFC } from 'react'; | ||
import { Alert } from '@mui/material'; | ||
import { useUsersPlan } from 'hooks/useUsersPlan'; | ||
import { useUsers } from 'hooks/api/getters/useUsers/useUsers'; | ||
|
||
export const SeatCostWarning: VFC = () => { | ||
const { users } = useUsers(); | ||
const { isBillingUsers, seats, planUsers } = useUsersPlan(users); | ||
|
||
if (!isBillingUsers) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Alert severity="info" sx={{ marginBottom: theme => theme.spacing(3) }}> | ||
<p> | ||
<strong>Heads up!</strong> You are exceeding your allocated free | ||
members included in your plan ({planUsers.length} of {seats}). | ||
Creating this user will add <strong>$15/month</strong> to your | ||
invoice, starting with your next payment. | ||
</p> | ||
</Alert> | ||
); | ||
}; |
37 changes: 37 additions & 0 deletions
37
frontend/src/component/admin/users/UsersList/UserLimitWarning/UserLimitWarning.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { VFC } from 'react'; | ||
import { Link as RouterLink } from 'react-router-dom'; | ||
import { Alert, Link } from '@mui/material'; | ||
import { useUsersPlan } from 'hooks/useUsersPlan'; | ||
import { useUsers } from 'hooks/api/getters/useUsers/useUsers'; | ||
|
||
const userLimit = 20; | ||
|
||
export const UserLimitWarning: VFC = () => { | ||
const { users } = useUsers(); | ||
const { isBillingUsers, planUsers } = useUsersPlan(users); | ||
|
||
if (!isBillingUsers) { | ||
return null; | ||
} | ||
|
||
if (planUsers?.length < userLimit) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Alert severity="info" sx={{ marginBottom: theme => theme.spacing(3) }}> | ||
<p> | ||
<strong>Heads up!</strong> You have reached your maximum number | ||
of registered users for you PRO account (up to max {userLimit}{' '} | ||
users). If you need more users please{' '} | ||
<Link | ||
component={RouterLink} | ||
to="https://www.getunleash.io/signup-enterprise" | ||
> | ||
get in touch with us | ||
</Link> | ||
. | ||
</p> | ||
</Alert> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters