@@ -15,6 +15,7 @@ import StageGateWorkPackageModalContainer from '../StageGateWorkPackageModalCont
1515import { NERButton } from '../../../components/NERButton' ;
1616import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown' ;
1717import { Menu , MenuItem } from '@mui/material' ;
18+ import ContentPasteIcon from '@mui/icons-material/ContentPaste' ;
1819import ListItemIcon from '@mui/material/ListItemIcon' ;
1920import EditIcon from '@mui/icons-material/Edit' ;
2021import SyncAltIcon from '@mui/icons-material/SyncAlt' ;
@@ -29,6 +30,7 @@ import ErrorPage from '../../ErrorPage';
2930import ScopeTab from './ScopeTab' ;
3031import FullPageTabs from '../../../components/FullPageTabs' ;
3132import ChangeRequestTab from '../../../components/ChangeRequestTab' ;
33+ import ActionsMenu , { ButtonInfo } from '../../../components/ActionsMenu' ;
3234
3335interface WorkPackageViewContainerProps {
3436 workPackage : WorkPackage ;
@@ -90,68 +92,49 @@ const WorkPackageViewContainer: React.FC<WorkPackageViewContainerProps> = ({
9092 handleDropdownClose ( ) ;
9193 } ;
9294
93- const editButton = (
94- < MenuItem onClick = { handleClickEdit } disabled = { ! allowEdit } >
95- < ListItemIcon >
96- < EditIcon fontSize = "small" />
97- </ ListItemIcon >
98- Edit
99- </ MenuItem >
100- ) ;
101- const activateButton = (
102- < MenuItem onClick = { handleClickActivate } disabled = { ! allowActivate } >
103- < ListItemIcon >
104- < KeyboardDoubleArrowUpIcon fontSize = "small" />
105- </ ListItemIcon >
106- Activate
107- </ MenuItem >
108- ) ;
109- const stageGateButton = (
110- < MenuItem onClick = { handleClickStageGate } disabled = { ! allowStageGate } >
111- < ListItemIcon >
112- < DoneOutlineIcon fontSize = "small" />
113- </ ListItemIcon >
114- Stage Gate
115- </ MenuItem >
116- ) ;
117- const deleteButton = (
118- < MenuItem onClick = { handleClickDelete } disabled = { ! allowDelete } >
119- < ListItemIcon >
120- < Delete fontSize = "small" />
121- </ ListItemIcon >
122- Delete
123- </ MenuItem >
124- ) ;
125- const createCRButton = (
126- < MenuItem
127- component = { RouterLink }
128- to = { routes . CHANGE_REQUESTS_NEW_WITH_WBS + wbsPipe ( workPackage . wbsNum ) }
129- disabled = { ! allowRequestChange }
130- onClick = { handleDropdownClose }
131- >
132- < ListItemIcon >
133- < SyncAltIcon fontSize = "small" />
134- </ ListItemIcon >
135- Request Change
136- </ MenuItem >
137- ) ;
95+ const stageGateButton : ButtonInfo = {
96+ title : 'Stage Gate' ,
97+ onClick : handleClickStageGate ,
98+ disabled : ! allowStageGate ,
99+ icon : < DoneOutlineIcon fontSize = "small" /> ,
100+ } ;
101+
102+ const activateButton : ButtonInfo = {
103+ title : 'Activate' ,
104+ onClick : handleClickActivate ,
105+ disabled : ! allowActivate ,
106+ icon : < KeyboardDoubleArrowUpIcon fontSize = "small" /> ,
107+ } ;
108+
138109 const projectActionsDropdown = (
139- < div >
140- < NERButton
141- endIcon = { < ArrowDropDownIcon style = { { fontSize : 28 } } /> }
142- variant = "contained"
143- id = "work-package-actions-dropdown"
144- onClick = { handleClick }
145- >
146- Actions
147- </ NERButton >
148- < Menu open = { dropdownOpen } anchorEl = { anchorEl } onClose = { handleDropdownClose } >
149- { editButton }
150- { workPackage . status === WbsElementStatus . Inactive ? activateButton : '' }
151- { workPackage . status === WbsElementStatus . Active ? stageGateButton : '' }
152- { createCRButton }
153- { deleteButton }
154- </ Menu >
110+ < div style = { { marginTop : '10px' } } >
111+ < ActionsMenu
112+ buttons = { [
113+ {
114+ title : 'Edit' ,
115+ onClick : handleClickEdit ,
116+ disabled : ! allowEdit ,
117+ icon : < EditIcon fontSize = "small" />
118+ } ,
119+ ...( workPackage . status === WbsElementStatus . Inactive ? [ activateButton ] : [ ] ) ,
120+ ...( workPackage . status === WbsElementStatus . Active ? [ stageGateButton ] : [ ] ) ,
121+ {
122+ title : 'Request Change' ,
123+ component : RouterLink ,
124+ to : routes . CHANGE_REQUESTS_NEW_WITH_WBS + wbsPipe ( workPackage . wbsNum ) ,
125+ onClick : handleDropdownClose ,
126+ disabled : ! allowRequestChange ,
127+ icon : < SyncAltIcon fontSize = "small" /> ,
128+ } ,
129+ {
130+ title : 'Delete' ,
131+ onClick : handleClickDelete ,
132+ disabled : ! allowDelete ,
133+ icon : < Delete fontSize = "small" /> ,
134+ dividerTop : true
135+ }
136+ ] }
137+ />
155138 </ div >
156139 ) ;
157140
0 commit comments