Skip to content

Commit 54ed591

Browse files
committed
review-mamangement-update-f2f
1 parent bd7518e commit 54ed591

File tree

4 files changed

+48
-16
lines changed

4 files changed

+48
-16
lines changed

src/apps/admin/src/lib/components/ReviewSummaryList/ReviewSummaryList.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ const ChallengeTitle: FC<{
5858
const ReviewSummaryList: FC<ReviewListProps> = props => {
5959
const columns = useMemo<TableColumn<ReviewSummary>[]>(
6060
() => [
61-
{
62-
label: 'Challenge type',
63-
propertyName: '',
64-
type: 'text',
65-
},
61+
// {
62+
// label: 'Challenge type',
63+
// propertyName: '',
64+
// type: 'text',
65+
// },
6666
{
6767
label: 'Challenge Title',
6868
propertyName: 'challengeName',
@@ -76,11 +76,11 @@ const ReviewSummaryList: FC<ReviewListProps> = props => {
7676
propertyName: 'legacyChallengeId',
7777
type: 'text',
7878
},
79-
{
80-
label: 'Current phase',
81-
propertyName: '',
82-
type: 'text',
83-
},
79+
// {
80+
// label: 'Current phase',
81+
// propertyName: '',
82+
// type: 'text',
83+
// },
8484
{ label: 'Status', propertyName: 'challengeStatus', type: 'text' },
8585
// I think this column is important, and it exits in `admin-app`
8686
// but resp does not have it, so I just comment it here

src/apps/admin/src/lib/components/ReviewerList/ReviewerList.tsx

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { FC, useMemo } from 'react'
22
import { format } from 'date-fns'
33

4-
import { CheckIcon } from '@heroicons/react/solid'
4+
import { CheckIcon, XIcon } from '@heroicons/react/solid'
55
import { useWindowSize, WindowSize } from '~/libs/shared'
66
import {
77
Button,
@@ -27,6 +27,7 @@ export interface ReviewerListProps {
2727
approvingReviewerId: number
2828
onPageChange: (page: number) => void
2929
onApproveApplication: (reviewer: Reviewer) => void
30+
onUnapproveApplication: (reviewer: Reviewer) => void
3031
onToggleSort: (sort: Sort) => void
3132
}
3233

@@ -35,15 +36,22 @@ const ApproveButton: FC<{
3536
openReviews: number
3637
approvingReviewerId: number
3738
onApproveApplication: ReviewerListProps['onApproveApplication']
39+
onUnapproveApplication: ReviewerListProps['onUnapproveApplication']
3840
}> = props => {
3941
const handleApprove = useEventCallback((): void => {
4042
props.onApproveApplication(props.reviewer)
4143
})
4244

45+
const handleRemove = useEventCallback((): void => {
46+
props.onUnapproveApplication(props.reviewer)
47+
})
48+
4349
const isApproving = props.approvingReviewerId === props.reviewer.userId
4450
const isOtherApproving = props.approvingReviewerId > 0
4551
const hideApproveButton
4652
= props.openReviews < 1 || props.reviewer.applicationStatus !== 'Pending'
53+
const showRemoveButton
54+
= props.reviewer.applicationStatus === 'Approved'
4755

4856
return (
4957
<>
@@ -53,7 +61,19 @@ const ApproveButton: FC<{
5361
className={styles.approvingLoadingSpinner}
5462
/>
5563
) : (
56-
!hideApproveButton && (
64+
hideApproveButton ? (
65+
showRemoveButton && (
66+
<Button
67+
primary
68+
variant='danger'
69+
onClick={handleRemove}
70+
>
71+
<XIcon className='icon icon-fill' />
72+
{' '}
73+
Remove Reviewer
74+
</Button>
75+
)
76+
) : (
5777
<Button
5878
primary
5979
onClick={handleApprove}
@@ -105,13 +125,15 @@ const Actions: FC<{
105125
openReviews: number
106126
approvingReviewerId: number
107127
onApproveApplication: ReviewerListProps['onApproveApplication']
128+
onUnapproveApplication: ReviewerListProps['onUnapproveApplication']
108129
}> = props => (
109130
<div className={styles.rowActions}>
110131
<ApproveButton
111132
reviewer={props.reviewer}
112133
openReviews={props.openReviews}
113134
approvingReviewerId={props.approvingReviewerId}
114135
onApproveApplication={props.onApproveApplication}
136+
onUnapproveApplication={props.onUnapproveApplication}
115137
/>
116138
</div>
117139
)
@@ -155,7 +177,7 @@ const ReviewerList: FC<ReviewerListProps> = props => {
155177
type: 'element',
156178
},
157179
{
158-
label: 'Open Review Opp',
180+
label: 'Open Reviews',
159181
propertyName: '',
160182
renderer: (reviewer: Reviewer) => (
161183
// eslint-disable-next-line jsx-a11y/anchor-is-valid
@@ -170,7 +192,7 @@ const ReviewerList: FC<ReviewerListProps> = props => {
170192
propertyName: 'reviewsInPast60Days',
171193
type: 'number',
172194
},
173-
{ label: 'Matching Skills', propertyName: '', type: 'text' },
195+
// { label: 'Matching Skills', propertyName: '', type: 'text' },
174196
{
175197
label: '',
176198
renderer: (reviewer: Reviewer) => (
@@ -179,6 +201,7 @@ const ReviewerList: FC<ReviewerListProps> = props => {
179201
openReviews={props.openReviews}
180202
approvingReviewerId={props.approvingReviewerId}
181203
onApproveApplication={props.onApproveApplication}
204+
onUnapproveApplication={props.onUnapproveApplication}
182205
/>
183206
),
184207
type: 'action',

src/apps/admin/src/lib/components/RolesFilter/RolesFilter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const RolesFilter: FC<Props> = props => {
7373
})
7474
setNewOption(undefined)
7575
setSearchKey('')
76-
}, [])
76+
}, []) // eslint-disable-line react-hooks/exhaustive-deps
7777

7878
const onSubmit = useCallback(
7979
(value: string) => {

src/apps/admin/src/review-management/ManageReviewerPage/ManageReviewerPage.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
useRef,
88
useState,
99
} from 'react'
10-
import { useParams } from 'react-router-dom'
10+
import { NavigateFunction, useNavigate, useParams } from 'react-router-dom'
1111
import { sortBy } from 'lodash'
1212

1313
import { XIcon } from '@heroicons/react/solid'
@@ -61,6 +61,7 @@ export const ManageReviewerPage: FC = () => {
6161
const { challengeId = '' }: { challengeId?: string } = useParams<{
6262
challengeId: string
6363
}>()
64+
const navigate: NavigateFunction = useNavigate()
6465
const [filterCriteria, setFilterCriteria]: [
6566
ReviewFilterCriteria,
6667
Dispatch<SetStateAction<ReviewFilterCriteria>>
@@ -134,6 +135,13 @@ export const ManageReviewerPage: FC = () => {
134135
})
135136
})
136137

138+
const unapprove = useEventCallback((): void => {
139+
// how to get challenge Id?
140+
// Now we use one specific challenge id for testing
141+
const realChallengeId = 'c713e250-ecb4-4192-8717-d607ddda8db4'
142+
navigate(`${rootRoute}/challenge-management/${realChallengeId}/manage-user`)
143+
})
144+
137145
// Init
138146
useEffect(() => {
139147
search()
@@ -214,6 +222,7 @@ export const ManageReviewerPage: FC = () => {
214222
reviewers={reviewers}
215223
openReviews={openReviews}
216224
onApproveApplication={approve}
225+
onUnapproveApplication={unapprove}
217226
approvingReviewerId={userId}
218227
paging={{
219228
page: filterCriteria.page,

0 commit comments

Comments
 (0)