Skip to content

Commit 4658baa

Browse files
committed
#3875 finished, need hook
1 parent d46e3c0 commit 4658baa

6 files changed

Lines changed: 107 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
@@ -28,6 +28,7 @@ import Statistics from '../pages/StatisticsPage/Statistics';
2828
import RetrospectiveGanttChartPage from '../pages/RetrospectivePage/Retrospective';
2929
import Calendar from '../pages/CalendarPage/Calendar';
3030
import GuestEventPage from '../pages/GuestEventPage/GuestEventPage';
31+
import ProjectManagementPage from '../pages/ProjectManagementPage/ProjectManagementPage';
3132
import SidebarLayout from '../layouts/SidebarLayout';
3233

3334
interface AppAuthenticatedProps {
@@ -77,6 +78,7 @@ const AppAuthenticated: React.FC<AppAuthenticatedProps> = ({ userId, userRole })
7778
<Route path={routes.HOME} component={Home} />
7879
<Route path={routes.RETROSPECTIVE} component={RetrospectiveGanttChartPage} />
7980
<Route path={routes.EVENTS} component={GuestEventPage} />
81+
<Route path={routes.PROJECT_MANAGEMENT} component={ProjectManagementPage} />
8082
<Redirect from={routes.BASE} to={routes.HOME} />
8183
<Route path="*" component={PageNotFound} />
8284
</Switch>

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';
@@ -26,6 +26,7 @@ const NavPageLink: React.FC<NavPageLinkItemProps> = ({
2626
isSubItem = false
2727
}) => {
2828
const theme = useTheme();
29+
const history = useHistory();
2930

3031
const renderLink = () => {
3132
const content = (
@@ -45,6 +46,7 @@ const NavPageLink: React.FC<NavPageLinkItemProps> = ({
4546
return (
4647
<Box
4748
onMouseEnter={onSubmenuHover}
49+
onClick={() => route && history.push(route)}
4850
sx={{
4951
textDecoration: 'none',
5052
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
@@ -83,7 +83,7 @@ const Sidebar = ({ drawerOpen, setDrawerOpen, moveContent, setMoveContent }: Sid
8383
: {
8484
name: 'Project Management',
8585
icon: <DashboardIcon />,
86-
route: routes.PROJECTS,
86+
route: routes.PROJECT_MANAGEMENT,
8787
subItems: [
8888
{
8989
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: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { Grid } from '@mui/material';
2+
import { GuestDefinition } from 'shared';
3+
import PageLayout from '../../components/PageLayout';
4+
import ProjectManagementCard from './ProjectManagementCard';
5+
6+
const ProjectManagementPage: React.FC = () => {
7+
// 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+
];
26+
27+
return (
28+
<PageLayout title="Project Management">
29+
<Grid container spacing={2} sx={{ mt: 1 }}>
30+
{definitions
31+
.sort((a, b) => a.order - b.order)
32+
.map((definition) => (
33+
<Grid item xs={12} sm={6} md={4} key={definition.definitionId} sx={{ display: 'flex' }}>
34+
<ProjectManagementCard definition={definition} />
35+
</Grid>
36+
))}
37+
</Grid>
38+
</PageLayout>
39+
);
40+
};
41+
42+
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)