@@ -4,17 +4,19 @@ import { WbsElementStatus } from 'shared';
44import { useCurrentUser } from '../../hooks/users.hooks' ;
55import { useState } from 'react' ;
66import { wbsPipe } from 'shared' ;
7- import { Box , Alert , IconButton , Collapse , Link , Typography , AlertTitle } from '@mui/material' ;
7+ import { Box , Alert , IconButton , Collapse , Typography , AlertTitle , Grid } from '@mui/material' ;
88import CloseIcon from '@mui/icons-material/Close' ;
99import { routes } from '../../utils/routes' ;
10- import { Link as RouterLink } from 'react-router-dom' ;
1110import { datePipe } from '../../utils/pipes' ;
11+ import { NERButton } from '../../components/NERButton' ;
12+ import { useHistory } from 'react-router-dom' ;
1213
1314const OverdueWorkPackageAlerts : React . FC = ( ) => {
1415 const user = useCurrentUser ( ) ;
1516 const workPackages = useAllWorkPackages ( { status : WbsElementStatus . Active } ) ;
1617 const currentDate = new Date ( ) ;
1718 const [ open , setOpen ] = useState ( true ) ;
19+ const history = useHistory ( ) ;
1820
1921 // Filter for work packages that are overdue and the user is the project lead
2022 const userOverdueWorkPackages = workPackages . data
@@ -31,6 +33,11 @@ const OverdueWorkPackageAlerts: React.FC = () => {
3133 < Alert
3234 variant = "filled"
3335 severity = "warning"
36+ sx = { {
37+ '& .MuiAlert-message' : {
38+ width : '100%'
39+ }
40+ } }
3441 action = {
3542 < IconButton
3643 aria-label = "close"
@@ -44,21 +51,28 @@ const OverdueWorkPackageAlerts: React.FC = () => {
4451 </ IconButton >
4552 }
4653 >
47- < AlertTitle >
48- { userOverdueWorkPackages . length > 1 ? 'Overdue Work Packages:' : 'Overdue Work Package:' }
49- </ AlertTitle >
50- { userOverdueWorkPackages . map ( ( wp ) => (
51- < React . Fragment key = { wp . id } >
52- < Link color = "inherit" component = { RouterLink } to = { ` ${ routes . PROJECTS } / ${ wbsPipe ( wp . wbsNum ) } ` } noWrap >
53- < Typography fontWeight = { 'regular' } variant = "inherit" >
54+ < Box >
55+ < AlertTitle >
56+ { userOverdueWorkPackages . length > 1 ? 'Overdue Work Packages:' : 'Overdue Work Package:' }
57+ </ AlertTitle >
58+ < Grid container spacing = { 2 } >
59+ { userOverdueWorkPackages . map ( ( wp ) => (
60+ < Grid item xs = { 6 } md = { 3 } key = { wp . id } >
5461 { wbsPipe ( wp . wbsNum ) } - { wp . name }
55- </ Typography >
56- </ Link >
57- < Typography fontWeight = { 'regular' } variant = "inherit" noWrap my = { 0.5 } >
58- { 'Due: ' + datePipe ( wp . endDate ) }
59- </ Typography >
60- </ React . Fragment >
61- ) ) }
62+ < Typography fontWeight = { 'regular' } variant = "inherit" noWrap my = { 0.5 } >
63+ { 'Due: ' + datePipe ( wp . endDate ) }
64+ </ Typography >
65+ < NERButton
66+ variant = "contained"
67+ size = "small"
68+ onClick = { ( ) => history . push ( `${ routes . PROJECTS } /${ wbsPipe ( wp . wbsNum ) } ` ) }
69+ >
70+ Create Change Request
71+ </ NERButton >
72+ </ Grid >
73+ ) ) }
74+ </ Grid >
75+ </ Box >
6276 </ Alert >
6377 </ Collapse >
6478 </ Box >
0 commit comments