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';
|
2023-01-05 09:45:17 +01:00
|
|
|
import {
|
|
|
|
StyledDivContainer,
|
|
|
|
StyledDivInfoContainer,
|
|
|
|
StyledDivPercentageContainer,
|
|
|
|
StyledParagraphSubtitle,
|
|
|
|
StyledParagraphEmphasizedText,
|
|
|
|
StyledLink,
|
|
|
|
StyledSpanLinkText,
|
|
|
|
StyledArrowIcon,
|
|
|
|
} from './ProjectInfo.styles';
|
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
|
|
|
}
|
|
|
|
|
2022-12-13 12:41:40 +01:00
|
|
|
const ProjectInfo = ({ id, memberCount, health }: IProjectInfoProps) => {
|
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) {
|
2022-12-13 12:41:40 +01:00
|
|
|
link = `/projects/${id}/settings/access`;
|
2021-07-07 11:04:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<aside>
|
2023-01-05 09:45:17 +01:00
|
|
|
<StyledDivContainer>
|
|
|
|
<StyledDivInfoContainer>
|
|
|
|
<StyledDivPercentageContainer>
|
2021-10-08 15:18:43 +02:00
|
|
|
<PercentageCircle percentage={health} />
|
2023-01-05 09:45:17 +01:00
|
|
|
</StyledDivPercentageContainer>
|
|
|
|
<StyledParagraphSubtitle data-loading>
|
2021-07-16 15:41:54 +02:00
|
|
|
Overall health rating
|
2023-01-05 09:45:17 +01:00
|
|
|
</StyledParagraphSubtitle>
|
|
|
|
<StyledParagraphEmphasizedText data-loading>
|
2021-07-16 15:41:54 +02:00
|
|
|
{health}%
|
2023-01-05 09:45:17 +01:00
|
|
|
</StyledParagraphEmphasizedText>
|
|
|
|
<StyledLink data-loading to={`/projects/${id}/health`}>
|
|
|
|
<StyledSpanLinkText data-loading>
|
2021-07-16 15:41:54 +02:00
|
|
|
view more{' '}
|
2023-01-05 09:45:17 +01:00
|
|
|
</StyledSpanLinkText>
|
|
|
|
<StyledArrowIcon data-loading />
|
|
|
|
</StyledLink>
|
|
|
|
</StyledDivInfoContainer>
|
2022-10-05 10:51:47 +02:00
|
|
|
<ConditionallyRender
|
|
|
|
condition={id !== DEFAULT_PROJECT_ID}
|
|
|
|
show={
|
2023-01-05 09:45:17 +01:00
|
|
|
<StyledDivInfoContainer style={{ marginBottom: '0' }}>
|
|
|
|
<StyledParagraphSubtitle data-loading>
|
2022-10-05 10:51:47 +02:00
|
|
|
Project members
|
2023-01-05 09:45:17 +01:00
|
|
|
</StyledParagraphSubtitle>
|
|
|
|
<StyledParagraphEmphasizedText data-loading>
|
2022-10-05 10:51:47 +02:00
|
|
|
{memberCount}
|
2023-01-05 09:45:17 +01:00
|
|
|
</StyledParagraphEmphasizedText>
|
|
|
|
<StyledLink data-loading to={link}>
|
|
|
|
<StyledSpanLinkText data-loading>
|
2022-10-05 10:51:47 +02:00
|
|
|
view more{' '}
|
2023-01-05 09:45:17 +01:00
|
|
|
</StyledSpanLinkText>
|
|
|
|
<StyledArrowIcon data-loading />
|
|
|
|
</StyledLink>
|
|
|
|
</StyledDivInfoContainer>
|
2022-10-05 10:51:47 +02:00
|
|
|
}
|
|
|
|
/>
|
2023-01-05 09:45:17 +01:00
|
|
|
</StyledDivContainer>
|
2021-07-07 11:04:36 +02:00
|
|
|
</aside>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default ProjectInfo;
|