1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00
unleash.unleash/frontend/src/component/project/Project/ProjectInfo/ProjectInfo.tsx
andreas-unleash c83f5cc432
Fix CI (#3042)
Signed-off-by: andreas-unleash <andreas@getunleash.ai>

<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->

## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-02-03 09:52:55 +02:00

72 lines
2.6 KiB
TypeScript

import type { IFeatureToggleListItem } from 'interfaces/featureToggle';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import { DEFAULT_PROJECT_ID } from 'hooks/api/getters/useDefaultProject/useDefaultProjectId';
import { StyledProjectInfoSidebarContainer } from './ProjectInfo.styles';
import { HealthWidget } from './HealthWidget';
import { ToggleTypesWidget } from './ToggleTypesWidget';
import { MetaWidget } from './MetaWidget';
import { ProjectMembersWidget } from './ProjectMembersWidget';
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
import { ProjectStatsSchema } from 'openapi/models/projectStatsSchema';
import { ChangeRequestsWidget } from './ChangeRequestsWidget';
interface IProjectInfoProps {
id: string;
memberCount: number;
features: IFeatureToggleListItem[];
health: number;
description?: string;
stats: ProjectStatsSchema;
}
const ProjectInfo = ({
id,
description,
memberCount,
health,
features,
stats,
}: IProjectInfoProps) => {
const { uiConfig, isEnterprise } = useUiConfig();
return (
<aside>
<StyledProjectInfoSidebarContainer>
<ConditionallyRender
condition={
isEnterprise() &&
Boolean(uiConfig?.flags.newProjectOverview)
}
show={<ChangeRequestsWidget projectId={id} />}
/>
<ConditionallyRender
condition={Boolean(uiConfig?.flags.newProjectOverview)}
show={<MetaWidget id={id} description={description} />}
/>
<HealthWidget
projectId={id}
health={health}
total={features.length}
stale={features.filter(feature => feature.stale).length}
/>
<ConditionallyRender
condition={id !== DEFAULT_PROJECT_ID}
show={
<ProjectMembersWidget
projectId={id}
memberCount={memberCount}
change={stats?.projectMembersAddedCurrentWindow}
/>
}
/>
<ConditionallyRender
condition={Boolean(uiConfig?.flags.newProjectOverview)}
show={<ToggleTypesWidget features={features} />}
/>
</StyledProjectInfoSidebarContainer>
</aside>
);
};
export default ProjectInfo;