import { useEffect, useState } from 'react'; import useProject, { useProjectNameOrId, } from 'hooks/api/getters/useProject/useProject'; import { Box, styled } from '@mui/material'; import { ProjectFeatureToggles as LegacyProjectFeatureToggles } from './ProjectFeatureToggles/LegacyProjectFeatureToggles'; import { ProjectFeatureToggles } from './ProjectFeatureToggles/ProjectFeatureToggles'; import ProjectInfo from './ProjectInfo/ProjectInfo'; import { usePageTitle } from 'hooks/usePageTitle'; import { useRequiredPathParam } from 'hooks/useRequiredPathParam'; import { useLastViewedProject } from 'hooks/useLastViewedProject'; import { ProjectStats } from './ProjectStats/ProjectStats'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; import { useUiFlag } from 'hooks/useUiFlag'; import { useFeatureSearch } from '../../../hooks/api/getters/useFeatureSearch/useFeatureSearch'; const refreshInterval = 15 * 1000; const StyledContainer = styled('div')(({ theme }) => ({ display: 'flex', [theme.breakpoints.down('md')]: { flexDirection: 'column', }, })); const StyledProjectToggles = styled('div')(() => ({ width: '100%', minWidth: 0, })); const StyledContentContainer = styled(Box)(() => ({ display: 'flex', flexDirection: 'column', width: '100%', minWidth: 0, })); const InfiniteProjectOverview = () => { const projectId = useRequiredPathParam('projectId'); const { project, loading: projectLoading } = useProject(projectId, { refreshInterval, }); const [nextCursor, setNextCursor] = useState(''); const { features: searchFeatures, refetch, loading, } = useFeatureSearch(nextCursor, projectId, { refreshInterval }); const { members, features, health, description, environments, stats } = project; return ( ); }; const ProjectOverview = () => { const projectId = useRequiredPathParam('projectId'); const projectName = useProjectNameOrId(projectId); const { project, loading, refetch } = useProject(projectId, { refreshInterval, }); const { members, features, health, description, environments, stats } = project; usePageTitle(`Project overview – ${projectName}`); const { setLastViewed } = useLastViewedProject(); const featureSwitchRefactor = useUiFlag('featureSwitchRefactor'); const featureSearchFrontend = useUiFlag('featureSearchFrontend'); useEffect(() => { setLastViewed(projectId); }, [projectId, setLastViewed]); if (featureSearchFrontend) return ; return ( ( )} elseShow={() => ( )} /> ); }; export default ProjectOverview;