2023-01-26 07:26:43 +01:00
|
|
|
import {
|
2023-01-31 14:20:16 +01:00
|
|
|
StyledProjectInfoWidgetContainer,
|
2023-02-03 12:58:21 +01:00
|
|
|
StyledWidgetTitle,
|
2023-01-26 07:26:43 +01:00
|
|
|
} from './ProjectInfo.styles';
|
|
|
|
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
2023-01-31 14:20:16 +01:00
|
|
|
import { StatusBox } from '../ProjectStats/StatusBox';
|
2023-02-03 12:58:21 +01:00
|
|
|
import { WidgetFooterLink } from './WidgetFooterLink';
|
|
|
|
import { Box } from '@mui/material';
|
2023-01-26 07:26:43 +01:00
|
|
|
|
|
|
|
interface IProjectMembersWidgetProps {
|
|
|
|
projectId: string;
|
|
|
|
memberCount: number;
|
2023-01-31 14:20:16 +01:00
|
|
|
change?: number;
|
2023-01-26 07:26:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export const ProjectMembersWidget = ({
|
|
|
|
projectId,
|
|
|
|
memberCount,
|
2023-01-31 14:20:16 +01:00
|
|
|
change = 0,
|
2023-01-26 07:26:43 +01:00
|
|
|
}: IProjectMembersWidgetProps) => {
|
|
|
|
const { uiConfig } = useUiConfig();
|
|
|
|
|
|
|
|
let link = `/admin/users`;
|
|
|
|
|
|
|
|
if (uiConfig?.versionInfo?.current?.enterprise) {
|
|
|
|
link = `/projects/${projectId}/settings/access`;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2023-02-03 12:58:21 +01:00
|
|
|
<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>
|
2023-01-27 13:00:23 +01:00
|
|
|
</StyledProjectInfoWidgetContainer>
|
2023-01-26 07:26:43 +01:00
|
|
|
);
|
|
|
|
};
|