2022-03-28 10:49:59 +02:00
|
|
|
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
2022-05-02 12:52:33 +02:00
|
|
|
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
2022-11-14 12:54:41 +01:00
|
|
|
|
2023-01-25 12:52:36 +01:00
|
|
|
import { DEFAULT_PROJECT_ID } from 'hooks/api/getters/useDefaultProject/useDefaultProjectId';
|
2023-01-05 09:45:17 +01:00
|
|
|
import {
|
2023-01-25 12:52:36 +01:00
|
|
|
StyledArrowIcon,
|
2023-01-05 09:45:17 +01:00
|
|
|
StyledDivContainer,
|
|
|
|
StyledDivInfoContainer,
|
|
|
|
StyledLink,
|
2023-01-25 12:52:36 +01:00
|
|
|
StyledParagraphEmphasizedText,
|
|
|
|
StyledParagraphSubtitle,
|
2023-01-05 09:45:17 +01:00
|
|
|
StyledSpanLinkText,
|
|
|
|
} from './ProjectInfo.styles';
|
2023-01-25 12:52:36 +01:00
|
|
|
import { IFeatureToggleListItem } from '../../../../interfaces/featureToggle';
|
|
|
|
import { HealthWidget } from './HealthWidget';
|
|
|
|
import { ToggleTypesWidget } from './ToggleTypesWidget';
|
2021-07-07 11:04:36 +02:00
|
|
|
|
|
|
|
interface IProjectInfoProps {
|
|
|
|
id: string;
|
|
|
|
memberCount: number;
|
2023-01-25 12:52:36 +01:00
|
|
|
features: IFeatureToggleListItem[];
|
2021-07-07 11:04:36 +02:00
|
|
|
health: number;
|
2022-03-22 08:23:51 +01:00
|
|
|
description?: string;
|
2021-07-07 11:04:36 +02:00
|
|
|
}
|
|
|
|
|
2023-01-25 12:52:36 +01:00
|
|
|
const ProjectInfo = ({
|
|
|
|
id,
|
|
|
|
memberCount,
|
|
|
|
health,
|
|
|
|
features,
|
|
|
|
}: 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>
|
2023-01-25 12:52:36 +01:00
|
|
|
<HealthWidget projectId={id} health={health} />
|
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-25 12:52:36 +01:00
|
|
|
<ToggleTypesWidget features={features} />
|
2023-01-05 09:45:17 +01:00
|
|
|
</StyledDivContainer>
|
2021-07-07 11:04:36 +02:00
|
|
|
</aside>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default ProjectInfo;
|