1- import React from 'react' ;
21import { Modal , ModalHeader , ModalBody , ModalFooter , Row , Col , Button } from 'reactstrap' ;
2+ import { useStore } from 'react-redux' ;
3+ import { useDispatch } from 'react-redux' ;
4+ import { toast } from 'react-toastify' ;
35import {
46 resourcesToString ,
57 booleanToString ,
68 numberToString ,
79 arrayToString ,
810 trimParagraphTags ,
911 datetimeToDate ,
10- } from 'components/TeamMemberTasks/components/TaskDifferenceModal' ;
11- import DiffedText from 'components/TeamMemberTasks/components/DiffedText' ;
12- import { useDispatch } from 'react-redux' ;
13- import { updateTask } from 'actions/task' ;
14- import hasPermission from 'utils/permissions' ;
15- import { useSelector , useStore } from 'react-redux' ;
16- import { useState } from 'react' ;
17- import { toast } from 'react-toastify' ;
12+ } from '../../TeamMemberTasks/components/TaskDifferenceModal' ;
13+ import DiffedText from '../../TeamMemberTasks/components/DiffedText' ;
14+ import { updateTask } from '../../../actions/task' ;
15+ import hasPermission from '../../../utils/permissions' ;
16+ import { incrementDashboardTaskCount } from '../../../actions/dashboardActions' ;
1817import { rejectTaskEditSuggestionHTTP } from '../service' ;
1918import { rejectTaskEditSuggestionSuccess } from '../actions' ;
2019import { fetchTaskEditSuggestions } from '../thunks' ;
21- import { incrementDashboardTaskCount } from 'actions/dashboardActions' ;
2220
23- export const TaskEditSuggestionsModal = ( {
21+ // eslint-disable-next-line import/prefer-default-export
22+ export function TaskEditSuggestionsModal ( {
2423 isTaskEditSuggestionModalOpen,
2524 taskEditSuggestion,
2625 handleToggleTaskEditSuggestionModal,
27- userRole
28- } ) => {
26+ userRole,
27+ } ) {
2928 const dispatch = useDispatch ( ) ;
3029
3130 const { getState } = useStore ( ) ;
@@ -40,28 +39,31 @@ export const TaskEditSuggestionsModal = ({
4039 ) ( dispatch , getState ) ;
4140 } ) ;
4241 dispatch ( rejectTaskEditSuggestionSuccess ( taskEditSuggestion . _id ) ) ;
43-
42+
4443 if ( userRole !== 'Volunteer' ) {
45- console . log ( `Incrementing count for task ${ taskEditSuggestion . taskId } ` ) ;
4644 dispatch ( incrementDashboardTaskCount ( taskEditSuggestion . taskId ) ) ;
4745 }
4846 } catch ( e ) {
49- dispatch ( fetchTaskEditSuggestions ( ) ) ;
50- toast . error ( 'The suggestion might have already been resolved. Reloading the suggestion list...' ) ;
47+ dispatch ( fetchTaskEditSuggestions ( ) ) ;
48+ toast . error (
49+ 'The suggestion might have already been resolved. Reloading the suggestion list...' ,
50+ ) ;
5151 }
5252 handleToggleTaskEditSuggestionModal ( ) ;
5353 } ;
54-
54+
5555 const rejectTask = async ( ) => {
5656 try {
5757 await rejectTaskEditSuggestionHTTP ( taskEditSuggestion . _id ) ;
5858 dispatch ( rejectTaskEditSuggestionSuccess ( taskEditSuggestion . _id ) ) ;
5959 } catch ( e ) {
6060 dispatch ( fetchTaskEditSuggestions ( ) ) ;
61- toast . error ( 'The suggestion might have already been resolved. Reloading the suggestion list...' ) ;
61+ toast . error (
62+ 'The suggestion might have already been resolved. Reloading the suggestion list...' ,
63+ ) ;
6264 }
6365 handleToggleTaskEditSuggestionModal ( ) ;
64- }
66+ } ;
6567
6668 return (
6769 < Modal
@@ -87,121 +89,123 @@ export const TaskEditSuggestionsModal = ({
8789 < table className = "table table-bordered" >
8890 < tbody >
8991 < tr >
90- < td scope = "col" data-tip = "WBS ID" >
92+ < th scope = "col" data-tip = "WBS ID" >
9193 WBS #
92- </ td >
93- { taskEditSuggestion && taskEditSuggestion . oldTask && < td scope = "col" > { taskEditSuggestion . oldTask . num } </ td > }
94+ </ th >
95+ { taskEditSuggestion && taskEditSuggestion . oldTask && (
96+ < th scope = "col" > { taskEditSuggestion . oldTask . num } </ th >
97+ ) }
9498 </ tr >
9599 < tr >
96- < td scope = "col" > Task Name</ td >
97- < td scope = "col" >
100+ < th scope = "col" > Task Name</ th >
101+ < th scope = "col" aria-label = "Task Name ">
98102 < DiffedText
99103 oldText = { taskEditSuggestion . oldTask . taskName }
100104 newText = { taskEditSuggestion . newTask . taskName }
101105 />
102- </ td >
106+ </ th >
103107 </ tr >
104108 < tr >
105- < td scope = "col" > Priority</ td >
106- < td scope = "col" >
109+ < th scope = "col" > Priority</ th >
110+ < th scope = "col" aria-label = "Priority ">
107111 < DiffedText
108112 oldText = { taskEditSuggestion . oldTask . priority }
109113 newText = { taskEditSuggestion . newTask . priority }
110114 />
111- </ td >
115+ </ th >
112116 </ tr >
113117 < tr >
114- < td scope = "col" > Resources</ td >
115- < td scope = "col" >
118+ < th scope = "col" > Resources</ th >
119+ < th scope = "col" aria-label = "Resources ">
116120 < DiffedText
117121 oldText = { resourcesToString ( taskEditSuggestion . oldTask . resources ) }
118122 newText = { resourcesToString ( taskEditSuggestion . newTask . resources ) }
119123 />
120- </ td >
124+ </ th >
121125 </ tr >
122126 < tr >
123- < td scope = "col" > Assigned</ td >
124- < td scope = "col" >
127+ < th scope = "col" > Assigned</ th >
128+ < th scope = "col" aria-label = "Assigned ">
125129 < DiffedText
126130 oldText = { booleanToString ( taskEditSuggestion . oldTask . isAssigned ) }
127131 newText = { booleanToString ( taskEditSuggestion . newTask . isAssigned ) }
128132 />
129- </ td >
133+ </ th >
130134 </ tr >
131135 < tr >
132- < td scope = "col" > Status</ td >
133- < td scope = "col" >
136+ < th scope = "col" > Status</ th >
137+ < th scope = "col" aria-label = "Status ">
134138 < DiffedText
135139 oldText = { taskEditSuggestion . oldTask . status }
136140 newText = { taskEditSuggestion . newTask . status }
137141 />
138- </ td >
142+ </ th >
139143 </ tr >
140144 < tr >
141- < td scope = "col" data-tip = "Hours - Best-case" >
145+ < th scope = "col" data-tip = "Hours - Best-case" >
142146 Hours - Best-case
143- </ td >
144- < td scope = "col" data-tip = "Hours - Best-case" >
147+ </ th >
148+ < th scope = "col" data-tip = "Hours - Best-case" aria-label = "Best Hours ">
145149 < DiffedText
146150 oldText = { numberToString ( taskEditSuggestion . oldTask . hoursBest ) }
147151 newText = { numberToString ( taskEditSuggestion . newTask . hoursBest ) }
148152 />
149- </ td >
153+ </ th >
150154 </ tr >
151155 < tr >
152- < td scope = "col" data-tip = "Hours - Worst-case" >
156+ < th scope = "col" data-tip = "Hours - Worst-case" >
153157 Hours - Worst-case
154- </ td >
155- < td scope = "col" data-tip = "Hours - Worst-case" >
158+ </ th >
159+ < th scope = "col" data-tip = "Hours - Worst-case" aria-label = "Worst Hours ">
156160 < DiffedText
157161 oldText = { numberToString ( taskEditSuggestion . oldTask . hoursWorst ) }
158162 newText = { numberToString ( taskEditSuggestion . newTask . hoursWorst ) }
159163 />
160- </ td >
164+ </ th >
161165 </ tr >
162166 < tr >
163- < td scope = "col" data-tip = "Hours - Most-case" >
167+ < th scope = "col" data-tip = "Hours - Most-case" >
164168 Hours - Most-case
165- </ td >
166- < td scope = "col" data-tip = "Hours - Most-case" >
169+ </ th >
170+ < th scope = "col" data-tip = "Hours - Most-case" aria-label = "Most Hours ">
167171 < DiffedText
168172 oldText = { numberToString ( taskEditSuggestion . oldTask . hoursMost ) }
169173 newText = { numberToString ( taskEditSuggestion . newTask . hoursMost ) }
170174 />
171- </ td >
175+ </ th >
172176 </ tr >
173177 < tr >
174- < td scope = "col" data-tip = "Estimated Hours" >
178+ < th scope = "col" data-tip = "Estimated Hours" >
175179 Estimated Hours
176- </ td >
177- < td scope = "col" data-tip = "Estimated Hours" >
180+ </ th >
181+ < th scope = "col" data-tip = "Estimated Hours" aria-label = "Estimated Hours" >
178182 < DiffedText
179183 oldText = { numberToString ( taskEditSuggestion . oldTask . estimatedHours ) }
180184 newText = { numberToString ( taskEditSuggestion . newTask . estimatedHours ) }
181185 />
182- </ td >
186+ </ th >
183187 </ tr >
184188
185189 < tr >
186- < td scope = "col" > Links</ td >
187- < td scope = "col" >
190+ < th scope = "col" > Links</ th >
191+ < th scope = "col" aria-label = "Links ">
188192 < DiffedText
189193 oldText = { arrayToString ( taskEditSuggestion . oldTask . links ) }
190194 newText = { arrayToString ( taskEditSuggestion . newTask . links ) }
191195 />
192- </ td >
196+ </ th >
193197 </ tr >
194198 < tr >
195- < td scope = "col" > Classification</ td >
196- < td scope = "col" >
199+ < th scope = "col" > Classification</ th >
200+ < th scope = "col" aria-label = "Classifications ">
197201 < DiffedText
198202 oldText = { taskEditSuggestion . oldTask . classification }
199203 newText = { taskEditSuggestion . newTask . classification }
200204 />
201- </ td >
205+ </ th >
202206 </ tr >
203207 < tr >
204- < td scope = "col" > Why this Task is Important</ td >
208+ < th scope = "col" > Why this Task is Important</ th >
205209 < td >
206210 < DiffedText
207211 oldText = { trimParagraphTags ( taskEditSuggestion . oldTask . whyInfo ) }
@@ -210,7 +214,7 @@ export const TaskEditSuggestionsModal = ({
210214 </ td >
211215 </ tr >
212216 < tr >
213- < td scope = "col" > Design Intent</ td >
217+ < th scope = "col" > Design Intent</ th >
214218 < td >
215219 < DiffedText
216220 oldText = { trimParagraphTags ( taskEditSuggestion . oldTask . intentInfo ) }
@@ -219,7 +223,7 @@ export const TaskEditSuggestionsModal = ({
219223 </ td >
220224 </ tr >
221225 < tr >
222- < td scope = "col" > Endstate</ td >
226+ < th scope = "col" > Endstate</ th >
223227 < td >
224228 < DiffedText
225229 oldText = { trimParagraphTags ( taskEditSuggestion . oldTask . endstateInfo ) }
@@ -228,22 +232,22 @@ export const TaskEditSuggestionsModal = ({
228232 </ td >
229233 </ tr >
230234 < tr >
231- < td scope = "col" > Start Date</ td >
232- < td scope = "col" >
235+ < th scope = "col" > Start Date</ th >
236+ < th scope = "col" aria-label = "Start Date ">
233237 < DiffedText
234238 oldText = { datetimeToDate ( taskEditSuggestion . oldTask . startedDatetime ) }
235239 newText = { datetimeToDate ( taskEditSuggestion . newTask . startedDatetime ) }
236240 />
237- </ td >
241+ </ th >
238242 </ tr >
239243 < tr >
240- < td scope = "col" > End Date</ td >
241- < td scope = "col" >
244+ < th scope = "col" > End Date</ th >
245+ < th scope = "col" aria-label = "End Date ">
242246 < DiffedText
243247 oldText = { datetimeToDate ( taskEditSuggestion . oldTask . dueDatetime ) }
244248 newText = { datetimeToDate ( taskEditSuggestion . newTask . dueDatetime ) }
245249 />
246- </ td >
250+ </ th >
247251 </ tr >
248252 </ tbody >
249253 </ table >
@@ -258,16 +262,12 @@ export const TaskEditSuggestionsModal = ({
258262 </ Button >
259263 </ Col >
260264 < Col style = { { display : 'flex' } } >
261- < Button
262- color = "danger"
263- style = { { marginLeft : 'auto' } }
264- onClick = { rejectTask }
265- >
265+ < Button color = "danger" style = { { marginLeft : 'auto' } } onClick = { rejectTask } >
266266 Reject
267267 </ Button >
268268 </ Col >
269269 </ Row >
270270 </ ModalFooter >
271271 </ Modal >
272272 ) ;
273- } ;
273+ }
0 commit comments