Skip to content

Commit 11232bd

Browse files
committed
review and billing account update
1 parent 2d59f23 commit 11232bd

File tree

6 files changed

+61
-25
lines changed

6 files changed

+61
-25
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,22 @@ const MobileListView: FC<MobileListViewProps<ReviewSummary>> = props => {
6767
<div className={styles.mobileListViewItemContainer} key={d.legacyChallengeId}>
6868
<div className={styles.rows}>
6969
<div className={styles.row1}>
70-
{/* Title */ propertyElements[1]}
71-
{/* Status */ propertyElements[4]}
70+
{/* Title */ propertyElements[0]}
71+
{/* Status */ propertyElements[2]}
7272
</div>
7373
<div className={styles.row2}>
74-
{/* Legacy ID */ propertyElements[2]}
74+
{/* Legacy ID */ propertyElements[1]}
7575
</div>
7676
<div className={styles.row3}>
77-
{propertyElementLabels[5]}
78-
{/* Open Review Opp' */ propertyElements[5]}
77+
{/* propertyElementLabels[5] */}
78+
{/* Open Review Opp' */ propertyElements[3]}
7979
</div>
8080
<div className={styles.row4}>
81-
{propertyElementLabels[6]}
82-
{/* Review Applications */ propertyElements[6]}
81+
{propertyElementLabels[4]}
82+
{/* Review Applications */ propertyElements[4]}
8383
</div>
8484
<div className={styles.row5}>
85-
{/* Action */ propertyElements[7]}
85+
{/* Action */ propertyElements[5]}
8686
</div>
8787
</div>
8888
</div>

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,12 @@ 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+
// Hide the columns temporary, we do not have these data now
62+
// {
63+
// label: 'Challenge type',
64+
// propertyName: '',
65+
// type: 'text',
66+
// },
6667
{
6768
label: 'Challenge Title',
6869
propertyName: 'challengeName',
@@ -76,11 +77,11 @@ const ReviewSummaryList: FC<ReviewListProps> = props => {
7677
propertyName: 'legacyChallengeId',
7778
type: 'text',
7879
},
79-
{
80-
label: 'Current phase',
81-
propertyName: '',
82-
type: 'text',
83-
},
80+
// {
81+
// label: 'Current phase',
82+
// propertyName: '',
83+
// type: 'text',
84+
// },
8485
{ label: 'Status', propertyName: 'challengeStatus', type: 'text' },
8586
// I think this column is important, and it exits in `admin-app`
8687
// but resp does not have it, so I just comment it here

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

Lines changed: 28 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 Review',
159181
propertyName: '',
160182
renderer: (reviewer: Reviewer) => (
161183
// eslint-disable-next-line jsx-a11y/anchor-is-valid
@@ -170,7 +192,8 @@ const ReviewerList: FC<ReviewerListProps> = props => {
170192
propertyName: 'reviewsInPast60Days',
171193
type: 'number',
172194
},
173-
{ label: 'Matching Skills', propertyName: '', type: 'text' },
195+
// Hide the columns temporary, we do not have these data now
196+
// { label: 'Matching Skills', propertyName: '', type: 'text' },
174197
{
175198
label: '',
176199
renderer: (reviewer: Reviewer) => (
@@ -179,6 +202,7 @@ const ReviewerList: FC<ReviewerListProps> = props => {
179202
openReviews={props.openReviews}
180203
approvingReviewerId={props.approvingReviewerId}
181204
onApproveApplication={props.onApproveApplication}
205+
onUnapproveApplication={props.onUnapproveApplication}
182206
/>
183207
),
184208
type: 'action',

src/apps/admin/src/lib/hooks/useTableFilterBackend.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export function useTableFilterBackend<T>(
6262
fetchDataRef.current.filterCriteria,
6363
() => {
6464
fetchDataRef.current.isLoading = false
65+
window.scrollTo({ left: 0, top: 200 })
6566
},
6667
() => {
6768
fetchDataRef.current.isLoading = false

src/apps/admin/src/lib/models/BillingAccountResource.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ export interface BillingAccountResource {
55
id: number
66
name: string
77
status: string
8+
mobileType?: 'label' | 'last-value'
89
}

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

Lines changed: 12 additions & 3 deletions
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,
@@ -519,8 +528,8 @@ const ApproveActionType = {
519528
type ApproveActionType =
520529
| {
521530
type: // | typeof ApproveActionType.APPROVE_INIT
522-
| typeof ApproveActionType.APPROVE_FAILED
523-
| typeof ApproveActionType.APPROVE_DONE
531+
| typeof ApproveActionType.APPROVE_FAILED
532+
| typeof ApproveActionType.APPROVE_DONE
524533
}
525534
| {
526535
type: typeof ApproveActionType.APPROVE_INIT

0 commit comments

Comments
 (0)