@@ -2,9 +2,8 @@ import React from 'react';
22import { useAllWorkPackages } from '../../hooks/work-packages.hooks' ;
33import { WbsElementStatus } from 'shared' ;
44import { useCurrentUser } from '../../hooks/users.hooks' ;
5- import { useState } from 'react' ;
65import { wbsPipe } from 'shared' ;
7- import { Box , Alert , IconButton , Collapse , Typography , AlertTitle , Grid } from '@mui/material' ;
6+ import { Box , Alert , Typography , AlertTitle , Grid } from '@mui/material' ;
87import { routes } from '../../utils/routes' ;
98import { datePipe } from '../../utils/pipes' ;
109import { NERButton } from '../../components/NERButton' ;
@@ -14,7 +13,6 @@ const OverdueWorkPackageAlerts: React.FC = () => {
1413 const user = useCurrentUser ( ) ;
1514 const workPackages = useAllWorkPackages ( { status : WbsElementStatus . Active } ) ;
1615 const currentDate = new Date ( ) ;
17- const [ open , setOpen ] = useState ( true ) ;
1816 const history = useHistory ( ) ;
1917
2018 // Filter for work packages that are overdue and the user is the project lead
@@ -28,40 +26,38 @@ const OverdueWorkPackageAlerts: React.FC = () => {
2826 } else {
2927 return (
3028 < Box sx = { { width : '100%' , my : 2 } } >
31- < Collapse in = { open } >
32- < Alert
33- variant = "filled"
34- severity = "warning"
35- sx = { {
36- '& .MuiAlert-message' : {
37- width : '100%'
38- }
39- } }
40- >
41- < Box >
42- < AlertTitle >
43- { userOverdueWorkPackages . length > 1 ? 'Overdue Work Packages:' : 'Overdue Work Package:' }
44- </ AlertTitle >
45- < Grid container spacing = { 2 } >
46- { userOverdueWorkPackages . map ( ( wp ) => (
47- < Grid item xs = { 6 } md = { 3 } key = { wp . id } >
48- { wbsPipe ( wp . wbsNum ) } - { wp . name }
49- < Typography fontWeight = { 'regular' } variant = "inherit" noWrap my = { 0.5 } >
50- { 'Due: ' + datePipe ( wp . endDate ) }
51- </ Typography >
52- < NERButton
53- variant = "contained"
54- size = "small"
55- onClick = { ( ) => history . push ( `${ routes . PROJECTS } /${ wbsPipe ( wp . wbsNum ) } ` ) }
56- >
57- Create Change Request
58- </ NERButton >
59- </ Grid >
60- ) ) }
61- </ Grid >
62- </ Box >
63- </ Alert >
64- </ Collapse >
29+ < Alert
30+ variant = "filled"
31+ severity = "warning"
32+ sx = { {
33+ '& .MuiAlert-message' : {
34+ width : '100%'
35+ }
36+ } }
37+ >
38+ < Box >
39+ < AlertTitle >
40+ { userOverdueWorkPackages . length > 1 ? 'Overdue Work Packages:' : 'Overdue Work Package:' }
41+ </ AlertTitle >
42+ < Grid container spacing = { 2 } >
43+ { userOverdueWorkPackages . map ( ( wp ) => (
44+ < Grid item xs = { 6 } md = { 3 } key = { wp . id } >
45+ { wbsPipe ( wp . wbsNum ) } - { wp . name }
46+ < Typography fontWeight = { 'regular' } variant = "inherit" noWrap my = { 0.5 } >
47+ { 'Due: ' + datePipe ( wp . endDate ) }
48+ </ Typography >
49+ < NERButton
50+ variant = "contained"
51+ size = "small"
52+ onClick = { ( ) => history . push ( `${ routes . PROJECTS } /${ wbsPipe ( wp . wbsNum ) } ` ) }
53+ >
54+ Create Change Request
55+ </ NERButton >
56+ </ Grid >
57+ ) ) }
58+ </ Grid >
59+ </ Box >
60+ </ Alert >
6561 </ Box >
6662 ) ;
6763 }
0 commit comments