2023-01-27 13:00:23 +01:00
|
|
|
import type { IFeatureToggleListItem } from 'interfaces/featureToggle';
|
2022-05-02 12:52:33 +02:00
|
|
|
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
2023-01-25 12:52:36 +01:00
|
|
|
import { DEFAULT_PROJECT_ID } from 'hooks/api/getters/useDefaultProject/useDefaultProjectId';
|
2023-01-27 13:00:23 +01:00
|
|
|
import { StyledProjectInfoSidebarContainer } from './ProjectInfo.styles';
|
2023-01-25 12:52:36 +01:00
|
|
|
import { HealthWidget } from './HealthWidget';
|
|
|
|
import { ToggleTypesWidget } from './ToggleTypesWidget';
|
2023-01-27 13:00:23 +01:00
|
|
|
import { MetaWidget } from './MetaWidget';
|
2023-01-26 07:26:43 +01:00
|
|
|
import { ProjectMembersWidget } from './ProjectMembersWidget';
|
|
|
|
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
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,
|
2023-01-27 13:00:23 +01:00
|
|
|
description,
|
2023-01-25 12:52:36 +01:00
|
|
|
memberCount,
|
|
|
|
health,
|
|
|
|
features,
|
|
|
|
}: IProjectInfoProps) => {
|
2022-11-14 12:54:41 +01:00
|
|
|
const { uiConfig } = useUiConfig();
|
2021-07-07 11:04:36 +02:00
|
|
|
return (
|
|
|
|
<aside>
|
2023-01-27 13:00:23 +01:00
|
|
|
<StyledProjectInfoSidebarContainer>
|
|
|
|
<ConditionallyRender
|
|
|
|
condition={Boolean(uiConfig?.flags.newProjectOverview)}
|
|
|
|
show={<MetaWidget id={id} description={description} />}
|
|
|
|
/>
|
2023-01-27 12:50:00 +01:00
|
|
|
<HealthWidget
|
|
|
|
projectId={id}
|
|
|
|
health={health}
|
|
|
|
total={features.length}
|
|
|
|
stale={features.filter(feature => feature.stale).length}
|
|
|
|
/>
|
2022-10-05 10:51:47 +02:00
|
|
|
<ConditionallyRender
|
|
|
|
condition={id !== DEFAULT_PROJECT_ID}
|
|
|
|
show={
|
2023-01-26 07:26:43 +01:00
|
|
|
<ProjectMembersWidget
|
|
|
|
projectId={id}
|
|
|
|
memberCount={memberCount}
|
|
|
|
/>
|
2022-10-05 10:51:47 +02:00
|
|
|
}
|
|
|
|
/>
|
2023-01-27 17:19:27 +01:00
|
|
|
<ConditionallyRender
|
|
|
|
condition={Boolean(uiConfig?.flags.newProjectOverview)}
|
|
|
|
show={<ToggleTypesWidget features={features} />}
|
|
|
|
/>
|
2023-01-27 13:00:23 +01:00
|
|
|
</StyledProjectInfoSidebarContainer>
|
2021-07-07 11:04:36 +02:00
|
|
|
</aside>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default ProjectInfo;
|