2021-07-07 11:04:36 +02:00
|
|
|
import { useStyles } from './ProjectInfo.styles';
|
|
|
|
import { Link } from 'react-router-dom';
|
2022-05-02 15:52:41 +02:00
|
|
|
import ArrowForwardIcon from '@mui/icons-material/ArrowForward';
|
2021-07-07 11:04:36 +02:00
|
|
|
import classnames from 'classnames';
|
|
|
|
|
2022-05-02 15:52:41 +02:00
|
|
|
import { useThemeStyles } from 'themes/themeStyles';
|
2022-03-28 10:49:59 +02:00
|
|
|
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
|
|
|
import PercentageCircle from 'component/common/PercentageCircle/PercentageCircle';
|
2022-05-02 12:52:33 +02:00
|
|
|
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
2022-11-14 12:54:41 +01:00
|
|
|
|
2022-10-05 10:51:47 +02:00
|
|
|
import { DEFAULT_PROJECT_ID } from '../../../../hooks/api/getters/useDefaultProject/useDefaultProjectId';
|
2021-07-07 11:04:36 +02:00
|
|
|
|
|
|
|
interface IProjectInfoProps {
|
|
|
|
id: string;
|
|
|
|
memberCount: number;
|
|
|
|
featureCount: number;
|
|
|
|
health: number;
|
2022-03-22 08:23:51 +01:00
|
|
|
description?: string;
|
2021-07-07 11:04:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
const ProjectInfo = ({
|
|
|
|
id,
|
|
|
|
memberCount,
|
|
|
|
health,
|
2021-11-24 14:36:21 +01:00
|
|
|
description,
|
2021-07-07 11:04:36 +02:00
|
|
|
}: IProjectInfoProps) => {
|
2022-05-02 15:52:41 +02:00
|
|
|
const { classes: themeStyles } = useThemeStyles();
|
|
|
|
const { classes: styles } = useStyles();
|
2022-11-14 12:54:41 +01:00
|
|
|
const { uiConfig } = useUiConfig();
|
2021-07-07 11:04:36 +02:00
|
|
|
|
|
|
|
let link = `/admin/users`;
|
|
|
|
|
|
|
|
if (uiConfig?.versionInfo?.current?.enterprise) {
|
|
|
|
link = `/projects/${id}/access`;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<aside>
|
2021-07-16 15:41:54 +02:00
|
|
|
<div className={styles.projectInfo}>
|
|
|
|
<div className={styles.infoSection}>
|
2021-10-08 15:18:43 +02:00
|
|
|
<div data-loading className={styles.percentageContainer}>
|
|
|
|
<PercentageCircle percentage={health} />
|
2021-07-16 15:41:54 +02:00
|
|
|
</div>
|
|
|
|
<p className={styles.subtitle} data-loading>
|
|
|
|
Overall health rating
|
|
|
|
</p>
|
|
|
|
<p className={styles.emphazisedText} data-loading>
|
|
|
|
{health}%
|
|
|
|
</p>
|
2021-07-07 11:04:36 +02:00
|
|
|
<Link
|
2021-07-16 15:41:54 +02:00
|
|
|
data-loading
|
2021-07-07 11:04:36 +02:00
|
|
|
className={classnames(
|
2022-05-02 15:52:41 +02:00
|
|
|
themeStyles.flexRow,
|
|
|
|
themeStyles.justifyCenter,
|
2021-07-07 11:04:36 +02:00
|
|
|
styles.infoLink
|
|
|
|
)}
|
2021-10-19 15:38:20 +02:00
|
|
|
to={`/projects/${id}/health`}
|
2021-07-07 11:04:36 +02:00
|
|
|
>
|
2021-07-16 15:41:54 +02:00
|
|
|
<span className={styles.linkText} data-loading>
|
|
|
|
view more{' '}
|
|
|
|
</span>
|
|
|
|
<ArrowForwardIcon
|
|
|
|
data-loading
|
|
|
|
className={styles.arrowIcon}
|
|
|
|
/>
|
2021-07-07 11:04:36 +02:00
|
|
|
</Link>
|
|
|
|
</div>
|
2022-10-05 10:51:47 +02:00
|
|
|
<ConditionallyRender
|
|
|
|
condition={id !== DEFAULT_PROJECT_ID}
|
|
|
|
show={
|
|
|
|
<div
|
|
|
|
className={styles.infoSection}
|
|
|
|
style={{ marginBottom: '0' }}
|
|
|
|
>
|
|
|
|
<p className={styles.subtitle} data-loading>
|
|
|
|
Project members
|
|
|
|
</p>
|
|
|
|
<p data-loading className={styles.emphazisedText}>
|
|
|
|
{memberCount}
|
|
|
|
</p>
|
|
|
|
<Link
|
|
|
|
data-loading
|
|
|
|
className={classnames(
|
|
|
|
themeStyles.flexRow,
|
|
|
|
themeStyles.justifyCenter,
|
|
|
|
styles.infoLink
|
|
|
|
)}
|
|
|
|
to={link}
|
|
|
|
>
|
|
|
|
<span className={styles.linkText} data-loading>
|
|
|
|
view more{' '}
|
|
|
|
</span>
|
|
|
|
<ArrowForwardIcon
|
|
|
|
data-loading
|
|
|
|
className={styles.arrowIcon}
|
|
|
|
/>
|
|
|
|
</Link>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
/>
|
2021-07-16 15:41:54 +02:00
|
|
|
</div>
|
2021-07-07 11:04:36 +02:00
|
|
|
</aside>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default ProjectInfo;
|