2022-08-04 13:57:25 +02:00
|
|
|
|
import useProject, {
|
|
|
|
|
useProjectNameOrId,
|
|
|
|
|
} from 'hooks/api/getters/useProject/useProject';
|
2022-02-28 17:20:47 +01:00
|
|
|
|
import { ProjectFeatureToggles } from './ProjectFeatureToggles/ProjectFeatureToggles';
|
2021-10-01 12:15:02 +02:00
|
|
|
|
import ProjectInfo from './ProjectInfo/ProjectInfo';
|
|
|
|
|
import { useStyles } from './Project.styles';
|
2022-06-21 09:08:37 +02:00
|
|
|
|
import { usePageTitle } from 'hooks/usePageTitle';
|
2022-08-04 13:57:25 +02:00
|
|
|
|
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
2022-11-23 14:58:02 +01:00
|
|
|
|
import { useLastViewedProject } from '../../../hooks/useLastViewedProject';
|
|
|
|
|
import { useEffect } from 'react';
|
2021-10-01 12:15:02 +02:00
|
|
|
|
|
2022-08-04 13:57:25 +02:00
|
|
|
|
const refreshInterval = 15 * 1000;
|
2021-10-01 12:15:02 +02:00
|
|
|
|
|
2022-08-04 13:57:25 +02:00
|
|
|
|
const ProjectOverview = () => {
|
|
|
|
|
const projectId = useRequiredPathParam('projectId');
|
|
|
|
|
const projectName = useProjectNameOrId(projectId);
|
|
|
|
|
const { project, loading } = useProject(projectId, { refreshInterval });
|
2022-05-13 14:51:22 +02:00
|
|
|
|
const { members, features, health, description, environments } = project;
|
2022-05-02 15:52:41 +02:00
|
|
|
|
const { classes: styles } = useStyles();
|
2022-06-21 09:08:37 +02:00
|
|
|
|
usePageTitle(`Project overview – ${projectName}`);
|
2022-11-23 14:58:02 +01:00
|
|
|
|
const { setLastViewed } = useLastViewedProject();
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
2022-11-24 14:38:39 +01:00
|
|
|
|
setLastViewed(projectId);
|
|
|
|
|
}, [projectId, setLastViewed]);
|
2021-10-01 12:15:02 +02:00
|
|
|
|
|
|
|
|
|
return (
|
2022-12-07 12:52:17 +01:00
|
|
|
|
<div className={styles.containerStyles}>
|
|
|
|
|
<ProjectInfo
|
|
|
|
|
id={projectId}
|
|
|
|
|
description={description}
|
|
|
|
|
memberCount={members}
|
|
|
|
|
health={health}
|
|
|
|
|
featureCount={features?.length}
|
|
|
|
|
/>
|
|
|
|
|
<div className={styles.projectToggles}>
|
|
|
|
|
<ProjectFeatureToggles
|
|
|
|
|
features={features}
|
|
|
|
|
environments={environments}
|
|
|
|
|
loading={loading}
|
2021-10-01 12:15:02 +02:00
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default ProjectOverview;
|