-
Notifications
You must be signed in to change notification settings - Fork 331
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(orgAdmins): show total user & team counts (#10396)
- Loading branch information
Showing
3 changed files
with
69 additions
and
1 deletion.
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
64 changes: 64 additions & 0 deletions
64
packages/client/modules/userDashboard/components/OrgBilling/OrgUsage.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,64 @@ | ||
import graphql from 'babel-plugin-relay/macro' | ||
import React from 'react' | ||
import {useFragment} from 'react-relay' | ||
import {OrgUsage_organization$key} from '../../../../__generated__/OrgUsage_organization.graphql' | ||
import Panel from '../../../../components/Panel/Panel' | ||
import useRouter from '../../../../hooks/useRouter' | ||
|
||
interface Props { | ||
organizationRef: OrgUsage_organization$key | ||
} | ||
|
||
const OrgUsage = (props: Props) => { | ||
const {organizationRef} = props | ||
const organization = useFragment( | ||
graphql` | ||
fragment OrgUsage_organization on Organization { | ||
id | ||
allTeamsCount | ||
orgUserCount { | ||
activeUserCount | ||
inactiveUserCount | ||
} | ||
} | ||
`, | ||
organizationRef | ||
) | ||
|
||
const {id: orgId, allTeamsCount, orgUserCount} = organization | ||
const totalUserCount = orgUserCount.activeUserCount + orgUserCount.inactiveUserCount | ||
const {history} = useRouter() | ||
|
||
return ( | ||
<Panel className='mb-4 max-w-[976px]' label='Usage'> | ||
<div className='flex items-center justify-around border-t border-solid border-slate-300 p-4 '> | ||
<a | ||
onClick={(e) => { | ||
e.preventDefault() | ||
history.push(`/me/organizations/${orgId}/teams`) | ||
}} | ||
className='cursor-pointer text-center text-sky-500 hover:text-sky-600' | ||
> | ||
<div className='mb-1 text-3xl font-bold'>{allTeamsCount}</div> | ||
<div className='flex items-center justify-center text-base text-slate-600'> | ||
Total teams | ||
</div> | ||
</a> | ||
<a | ||
onClick={(e) => { | ||
e.preventDefault() | ||
history.push(`/me/organizations/${orgId}/members`) | ||
}} | ||
className='cursor-pointer text-center text-sky-500 hover:text-sky-600' | ||
> | ||
<div className='mb-1 text-3xl font-bold'>{totalUserCount}</div> | ||
<div className='flex items-center justify-center text-base text-slate-600'> | ||
Total members | ||
</div> | ||
</a> | ||
</div> | ||
</Panel> | ||
) | ||
} | ||
|
||
export default OrgUsage |
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