1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-06 00:07:44 +01:00
unleash.unleash/frontend/src/component/project/Project/ProjectInfo/ProjectMembersWidget.tsx
2023-02-03 12:58:21 +01:00

44 lines
1.2 KiB
TypeScript

import {
StyledProjectInfoWidgetContainer,
StyledWidgetTitle,
} from './ProjectInfo.styles';
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
import { StatusBox } from '../ProjectStats/StatusBox';
import { WidgetFooterLink } from './WidgetFooterLink';
import { Box } from '@mui/material';
interface IProjectMembersWidgetProps {
projectId: string;
memberCount: number;
change?: number;
}
export const ProjectMembersWidget = ({
projectId,
memberCount,
change = 0,
}: IProjectMembersWidgetProps) => {
const { uiConfig } = useUiConfig();
let link = `/admin/users`;
if (uiConfig?.versionInfo?.current?.enterprise) {
link = `/projects/${projectId}/settings/access`;
}
return (
<StyledProjectInfoWidgetContainer>
<StyledWidgetTitle data-loading>Project members</StyledWidgetTitle>
<Box
sx={{
display: 'flex',
justifyContent: 'center',
}}
>
<StatusBox boxText={`${memberCount}`} change={change} />
</Box>
<WidgetFooterLink to={link}>View all members</WidgetFooterLink>
</StyledProjectInfoWidgetContainer>
);
};