Skip to content

Commit b10cfe7

Browse files
authored
Merge pull request #4155 from Northeastern-Electric-Racing/#3875-project-management-page
#3875 project management page
2 parents e6f2c30 + ba3151f commit b10cfe7

6 files changed

Lines changed: 99 additions & 2 deletions

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 ProjectManagementPage from '../pages/ProjectManagementPage/ProjectManagementPage';
3233
import SidebarLayout from '../layouts/SidebarLayout';
3334

3435
interface AppAuthenticatedProps {
@@ -79,6 +80,7 @@ const AppAuthenticated: React.FC<AppAuthenticatedProps> = ({ userId, userRole })
7980
<Route path={routes.STATISTICS} component={Statistics} />
8081
<Route path={routes.HOME} component={Home} />
8182
<Route path={routes.RETROSPECTIVE} component={RetrospectiveGanttChartPage} />
83+
<Route path={routes.PROJECT_MANAGEMENT} component={ProjectManagementPage} />
8284
<Route path={routes.EVENTS} component={GuestEventPage} />
8385
<Redirect from={routes.BASE} to={routes.HOME} />
8486
<Route path="*" component={PageNotFound} />

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* See the LICENSE file in the repository root folder for details.
44
*/
55

6-
import { NavLink } from 'react-router-dom';
6+
import { NavLink, useHistory } from 'react-router-dom';
77
import { LinkItem } from '../../utils/types';
88
import { routes } from '../../utils/routes';
99
import { Box, Typography, useTheme, Collapse } from '@mui/material';
@@ -28,6 +28,7 @@ const NavPageLink: React.FC<NavPageLinkItemProps> = ({
2828
isClickableWithSubitems
2929
}) => {
3030
const theme = useTheme();
31+
const history = useHistory();
3132

3233
const renderLink = () => {
3334
const content = (
@@ -47,6 +48,7 @@ const NavPageLink: React.FC<NavPageLinkItemProps> = ({
4748
return (
4849
<Box
4950
onMouseEnter={onSubmenuHover}
51+
onClick={() => history.push(route)}
5052
sx={{
5153
textDecoration: 'none',
5254
color: theme.palette.text.primary,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const Sidebar = ({ drawerOpen, setDrawerOpen, moveContent, setMoveContent }: Sid
8585
: {
8686
name: 'Project Management',
8787
icon: <DashboardIcon />,
88-
route: routes.PROJECTS,
88+
route: routes.PROJECT_MANAGEMENT,
8989
subItems: [
9090
{
9191
name: 'Gantt',
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { Box, Card, CardContent, Icon, Link, Typography, useTheme } from '@mui/material';
2+
import { GuestDefinition } from 'shared';
3+
import { NERButton } from '../../components/NERButton';
4+
import { Link as RouterLink } from 'react-router-dom';
5+
6+
interface ProjectManagementCardProps {
7+
definition: GuestDefinition;
8+
}
9+
10+
const ProjectManagementCard: React.FC<ProjectManagementCardProps> = ({ definition }) => {
11+
const theme = useTheme();
12+
13+
return (
14+
<Card
15+
variant="outlined"
16+
sx={{
17+
width: '100%',
18+
height: '100%',
19+
display: 'flex',
20+
flexDirection: 'column',
21+
background: theme.palette.background.paper,
22+
borderRadius: 2
23+
}}
24+
>
25+
<CardContent sx={{ padding: 2, display: 'flex', flexDirection: 'column', flexGrow: 1 }}>
26+
<Box display="flex" alignItems="center" gap={1} mb={1}>
27+
{definition.icon && <Icon>{definition.icon}</Icon>}
28+
<Typography variant="h6" fontWeight="regular">
29+
{definition.term}
30+
</Typography>
31+
</Box>
32+
<Typography fontSize={14} color="text.secondary" sx={{ flexGrow: 1 }}>
33+
{definition.description}
34+
</Typography>
35+
{definition.buttonText && definition.buttonLink && (
36+
<Link component={RouterLink} to={definition.buttonLink} sx={{ width: '100%', textDecoration: 'none' }}>
37+
<NERButton
38+
fullWidth
39+
sx={{
40+
marginTop: 2,
41+
backgroundColor: theme.palette.error.main,
42+
color: theme.palette.error.contrastText,
43+
'&:hover': {
44+
backgroundColor: theme.palette.error.dark
45+
}
46+
}}
47+
>
48+
{definition.buttonText}
49+
</NERButton>
50+
</Link>
51+
)}
52+
</CardContent>
53+
</Card>
54+
);
55+
};
56+
57+
export default ProjectManagementCard;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { Grid } from '@mui/material';
2+
import { GuestDefinitionType } from 'shared';
3+
import PageLayout from '../../components/PageLayout';
4+
import ProjectManagementCard from './ProjectManagementCard';
5+
import { useAllGuestDefinitions } from '../../hooks/recruitment.hooks';
6+
import LoadingIndicator from '../../components/LoadingIndicator';
7+
import ErrorPage from '../ErrorPage';
8+
9+
const ProjectManagementPage: 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.filter((definition) => definition.type === GuestDefinitionType.PROJECT_MANAGEMENT);
18+
19+
return (
20+
<PageLayout title="Project Management">
21+
<Grid container spacing={2} sx={{ mt: 1 }}>
22+
{filteredDefinitions
23+
.sort((a, b) => a.order - b.order)
24+
.map((definition) => (
25+
<Grid item xs={12} sm={6} md={4} key={definition.definitionId} sx={{ display: 'flex' }}>
26+
<ProjectManagementCard definition={definition} />
27+
</Grid>
28+
))}
29+
</Grid>
30+
</PageLayout>
31+
);
32+
};
33+
34+
export default ProjectManagementPage;

src/frontend/src/utils/routes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const COMPANIES = FINANCE + `/companies`;
3030

3131
/**************** Projects Section ****************/
3232
const PROJECTS = `/projects`;
33+
const PROJECT_MANAGEMENT = `/project-management`;
3334
const PROJECTS_OVERVIEW = PROJECTS + '/overview';
3435
const PROJECTS_ALL = PROJECTS + '/all';
3536
const PROJECTS_BY_WBS = PROJECTS + `/:wbsNum`;
@@ -100,6 +101,7 @@ export const routes = {
100101
GANTT,
101102

102103
PROJECTS,
104+
PROJECT_MANAGEMENT,
103105
PROJECTS_OVERVIEW,
104106
PROJECTS_ALL,
105107
PROJECTS_BY_WBS,

0 commit comments

Comments
 (0)