Skip to content

Commit e161c0f

Browse files
committed
#3875 use hook and click page works
1 parent 9893b71 commit e161c0f

2 files changed

Lines changed: 14 additions & 20 deletions

File tree

src/frontend/src/app/AppAuthenticated.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ const AppAuthenticated: React.FC<AppAuthenticatedProps> = ({ userId, userRole })
8080
<Route path={routes.STATISTICS} component={Statistics} />
8181
<Route path={routes.HOME} component={Home} />
8282
<Route path={routes.RETROSPECTIVE} component={RetrospectiveGanttChartPage} />
83+
<Route path={routes.PROJECT_MANAGEMENT} component={ProjectManagementPage} />
8384
<Route path={routes.EVENTS} component={GuestEventPage} />
8485
<Redirect from={routes.BASE} to={routes.HOME} />
8586
<Route path="*" component={PageNotFound} />

src/frontend/src/pages/ProjectManagementPage/ProjectManagementPage.tsx

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,26 @@
11
import { Grid } from '@mui/material';
2-
import { GuestDefinition } from 'shared';
2+
import { GuestDefinition, GuestDefinitionType } from 'shared';
33
import PageLayout from '../../components/PageLayout';
44
import ProjectManagementCard from './ProjectManagementCard';
5+
import { useAllGuestDefinitions } from '../../hooks/recruitment.hooks';
6+
import LoadingIndicator from '../../components/LoadingIndicator';
7+
import ErrorPage from '../ErrorPage';
58

69
const ProjectManagementPage: React.FC = () => {
710
// replace when hook is ready
8-
const definitions: GuestDefinition[] = [
9-
{
10-
definitionId: '1',
11-
term: 'NER',
12-
description: 'A really awesome organization!',
13-
order: 1,
14-
buttonText: 'learn more!',
15-
buttonLink: '/home'
16-
},
17-
{
18-
definitionId: '2',
19-
term: 'NER2',
20-
description: 'A really awesome organization2!',
21-
order: 0,
22-
buttonText: 'learn more2!',
23-
buttonLink: '/home'
24-
}
25-
];
11+
const { data: definitions, isLoading, isError, error } = useAllGuestDefinitions();
12+
13+
if (isError) {
14+
return <ErrorPage message={error.message} />;
15+
}
16+
if (isLoading || !definitions) return <LoadingIndicator />;
17+
18+
const filteredDefinitions = definitions.filter((definition) => definition.type === GuestDefinitionType.PROJECT_MANAGEMENT);
2619

2720
return (
2821
<PageLayout title="Project Management">
2922
<Grid container spacing={2} sx={{ mt: 1 }}>
30-
{definitions
23+
{filteredDefinitions
3124
.sort((a, b) => a.order - b.order)
3225
.map((definition) => (
3326
<Grid item xs={12} sm={6} md={4} key={definition.definitionId} sx={{ display: 'flex' }}>

0 commit comments

Comments
 (0)