Skip to content

Commit 68838e3

Browse files
committed
Removed the Cancel and Reassign buttons from the review tab.
1 parent 13dce16 commit 68838e3

File tree

1 file changed

+0
-150
lines changed

1 file changed

+0
-150
lines changed

web-ui/src/components/reviews/TeamMemberReview.jsx

Lines changed: 0 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -98,25 +98,6 @@ const TeamMemberReview = ({
9898
const currentUser = selectCurrentUser(state);
9999
const theme = useTheme();
100100
const [value, setValue] = useState(1);
101-
const [reassignOpen, setReassignOpen] = useState(false);
102-
const [cancelOpen, setCancelOpen] = useState(false);
103-
104-
const handleOpenReassign = useCallback(
105-
() => setReassignOpen(true),
106-
[setReassignOpen]
107-
);
108-
const handleCloseReassign = useCallback(
109-
() => setReassignOpen(false),
110-
[setReassignOpen]
111-
);
112-
const handleOpenCancel = useCallback(
113-
() => setCancelOpen(true),
114-
[setCancelOpen]
115-
);
116-
const handleCloseCancel = useCallback(
117-
() => setCancelOpen(false),
118-
[setCancelOpen]
119-
);
120101

121102
const review = reviews && reviews[value - 1];
122103
const recipient = selectProfile(state, review?.recipientId);
@@ -129,84 +110,6 @@ const TeamMemberReview = ({
129110
setValue(index);
130111
};
131112

132-
const handleCancelClick = useCallback(() => {
133-
const cancelRequest = async () => {
134-
const res = await cancelFeedbackRequest(review, csrf);
135-
const cancellationResponse =
136-
res && res.payload && res.payload.status === 200 && !res.error
137-
? res.payload.data
138-
: null;
139-
if (!cancellationResponse) {
140-
window.snackDispatch({
141-
type: UPDATE_TOAST,
142-
payload: {
143-
severity: 'error',
144-
toast:
145-
'There was an error cancelling the review. Please contact your administrator.'
146-
}
147-
});
148-
}
149-
return cancellationResponse;
150-
};
151-
152-
handleCloseCancel();
153-
if (csrf) {
154-
cancelRequest().then(res => {
155-
if (res) {
156-
reloadReviews();
157-
window.snackDispatch({
158-
type: UPDATE_TOAST,
159-
payload: {
160-
severity: 'success',
161-
toast: 'Review canceled'
162-
}
163-
});
164-
}
165-
});
166-
}
167-
}, [csrf, handleCloseCancel, review, reloadReviews]);
168-
169-
const handleReassign = useCallback(
170-
assignee => {
171-
const reassignRequest = async () => {
172-
review.recipientId = assignee.id;
173-
const res = await updateFeedbackRequest(review, csrf);
174-
const updateResponse =
175-
res && res.payload && res.payload.status === 200 && !res.error
176-
? res.payload.data
177-
: null;
178-
if (!updateResponse) {
179-
window.snackDispatch({
180-
type: UPDATE_TOAST,
181-
payload: {
182-
severity: 'error',
183-
toast:
184-
'There was an error reassigning the review. Please contact your administrator.'
185-
}
186-
});
187-
}
188-
return updateResponse;
189-
};
190-
191-
handleCloseReassign();
192-
if (csrf) {
193-
reassignRequest().then(res => {
194-
if (res) {
195-
reloadReviews();
196-
window.snackDispatch({
197-
type: UPDATE_TOAST,
198-
payload: {
199-
severity: 'success',
200-
toast: 'Review reassigned'
201-
}
202-
});
203-
}
204-
});
205-
}
206-
},
207-
[csrf, handleCloseReassign, review, reloadReviews]
208-
);
209-
210113
let selfReviewIcon = <HourglassEmptyIcon />;
211114
if (selfReview && selfReview.status?.toUpperCase() === 'SUBMITTED') {
212115
selfReviewIcon = <CheckCircleIcon />;
@@ -280,26 +183,6 @@ const TeamMemberReview = ({
280183

281184
return (
282185
<TabPanel value={value} index={index + 1} dir={theme.direction}>
283-
{review.status?.toUpperCase() !== 'SUBMITTED' && (
284-
<div className={classes.buttonRow}>
285-
<Button
286-
onClick={handleOpenCancel}
287-
className={classes.actionButtons}
288-
variant="outlined"
289-
color="secondary"
290-
>
291-
Cancel
292-
</Button>
293-
<Button
294-
onClick={handleOpenReassign}
295-
className={classes.actionButtons}
296-
variant="outlined"
297-
color="primary"
298-
>
299-
Reassign
300-
</Button>
301-
</div>
302-
)}
303186
<FeedbackSubmitForm
304187
requesteeName={requesteeName}
305188
requestId={review.id}
@@ -310,39 +193,6 @@ const TeamMemberReview = ({
310193
);
311194
})}
312195
</SwipeableViews>
313-
<SelectUserModal
314-
userLabel="Reviewer"
315-
open={reassignOpen}
316-
onSelect={handleReassign}
317-
onClose={handleCloseReassign}
318-
/>
319-
<Modal open={cancelOpen} onClose={handleCloseCancel}>
320-
<Card className="cancel-feedback-request-modal">
321-
<CardHeader
322-
title={
323-
<Typography variant="h5" fontWeight="bold">
324-
Cancel Review
325-
</Typography>
326-
}
327-
/>
328-
<CardContent>
329-
<Typography variant="body1">
330-
Are you sure you want to cancel the review sent to{' '}
331-
<b>{recipient?.name}</b> on <b>{review?.sendDate}</b>? The
332-
recipient will not be able to respond to this request once it is
333-
canceled.
334-
</Typography>
335-
</CardContent>
336-
<CardActions>
337-
<Button color="secondary" onClick={handleCloseCancel}>
338-
No, Keep Feedback Request
339-
</Button>
340-
<Button color="primary" onClick={handleCancelClick}>
341-
Yes, Cancel Feedback Request
342-
</Button>
343-
</CardActions>
344-
</Card>
345-
</Modal>
346196
</Box>
347197
</Root>
348198
);

0 commit comments

Comments
 (0)