Skip to content

Commit f5915ab

Browse files
authored
Merge pull request #4165 from Northeastern-Electric-Racing/#4127-guest-info-page
#4127 guest info page
2 parents 36a9f0e + 509b7b4 commit f5915ab

4 files changed

Lines changed: 38 additions & 1 deletion

File tree

src/frontend/src/app/AppAuthenticated.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import Statistics from '../pages/StatisticsPage/Statistics';
2929
import RetrospectiveGanttChartPage from '../pages/RetrospectivePage/Retrospective';
3030
import Calendar from '../pages/CalendarPage/Calendar';
3131
import GuestEventPage from '../pages/GuestEventPage/GuestEventPage';
32+
import GuestInfoPage from '../pages/GuestInfoPage/GuestInfoPage';
3233
import ProjectManagementPage from '../pages/ProjectManagementPage/ProjectManagementPage';
3334
import SidebarLayout from '../layouts/SidebarLayout';
3435

@@ -82,6 +83,7 @@ const AppAuthenticated: React.FC<AppAuthenticatedProps> = ({ userId, userRole })
8283
<Route path={routes.RETROSPECTIVE} component={RetrospectiveGanttChartPage} />
8384
<Route path={routes.PROJECT_MANAGEMENT} component={ProjectManagementPage} />
8485
<Route path={routes.EVENTS} component={GuestEventPage} />
86+
<Route path={routes.GUEST_INFO} component={GuestInfoPage} />
8587
<Redirect from={routes.BASE} to={routes.HOME} />
8688
<Route path="*" component={PageNotFound} />
8789
</Switch>

src/frontend/src/layouts/Sidebar/Sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ const Sidebar = ({ drawerOpen, setDrawerOpen, moveContent, setMoveContent }: Sid
170170
{
171171
name: 'Info',
172172
icon: <QuestionMarkIcon />,
173-
route: routes.INFO
173+
route: isGuest(user.role) ? routes.GUEST_INFO : routes.INFO
174174
}
175175
].filter(Boolean) as LinkItem[];
176176

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { useAllGuestDefinitions } from '../../hooks/recruitment.hooks';
2+
import ErrorPage from '../ErrorPage';
3+
import LoadingIndicator from '../../components/LoadingIndicator';
4+
import { GuestDefinitionType } from 'shared';
5+
import PageLayout from '../../components/PageLayout';
6+
import PageBlock from '../../layouts/PageBlock';
7+
import { Typography } from '@mui/material';
8+
9+
const GuestInfoPage: React.FC = () => {
10+
const { data: definitions, isLoading, isError, error } = useAllGuestDefinitions();
11+
12+
if (isError) {
13+
return <ErrorPage message={error.message} />;
14+
}
15+
if (isLoading || !definitions) return <LoadingIndicator />;
16+
17+
const filteredDefinitions = definitions
18+
.filter((definition) => definition.type === GuestDefinitionType.INFO_PAGE)
19+
.sort((a, b) => a.order - b.order);
20+
return (
21+
<PageLayout title="Information">
22+
{filteredDefinitions.map((def) => {
23+
return (
24+
<PageBlock title={def.term}>
25+
<Typography>{def.description}</Typography>
26+
</PageBlock>
27+
);
28+
})}
29+
</PageLayout>
30+
);
31+
};
32+
33+
export default GuestInfoPage;

src/frontend/src/utils/routes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
const BASE = `/`;
88
const LOGIN = `/login`;
99
const INFO = `/info`;
10+
const GUEST_INFO = `/guestinfo`;
1011
const GANTT = `/gantt`;
1112
const CREDITS = `/credits`;
1213

@@ -85,6 +86,7 @@ export const routes = {
8586
BASE,
8687
LOGIN,
8788
INFO,
89+
GUEST_INFO,
8890
CREDITS,
8991

9092
HOME,

0 commit comments

Comments
 (0)