From 54ed5919ef5f95988a4add0f3ab8ab2e2daefc76 Mon Sep 17 00:00:00 2001 From: stevenfrog Date: Sun, 4 May 2025 19:57:39 +0800 Subject: [PATCH] review-mamangement-update-f2f --- .../ReviewSummaryList/ReviewSummaryList.tsx | 20 ++++++------ .../components/ReviewerList/ReviewerList.tsx | 31 ++++++++++++++++--- .../components/RolesFilter/RolesFilter.tsx | 2 +- .../ManageReviewerPage/ManageReviewerPage.tsx | 11 ++++++- 4 files changed, 48 insertions(+), 16 deletions(-) diff --git a/src/apps/admin/src/lib/components/ReviewSummaryList/ReviewSummaryList.tsx b/src/apps/admin/src/lib/components/ReviewSummaryList/ReviewSummaryList.tsx index ae2103f54..34d009582 100644 --- a/src/apps/admin/src/lib/components/ReviewSummaryList/ReviewSummaryList.tsx +++ b/src/apps/admin/src/lib/components/ReviewSummaryList/ReviewSummaryList.tsx @@ -58,11 +58,11 @@ const ChallengeTitle: FC<{ const ReviewSummaryList: FC = props => { const columns = useMemo[]>( () => [ - { - label: 'Challenge type', - propertyName: '', - type: 'text', - }, + // { + // label: 'Challenge type', + // propertyName: '', + // type: 'text', + // }, { label: 'Challenge Title', propertyName: 'challengeName', @@ -76,11 +76,11 @@ const ReviewSummaryList: FC = props => { propertyName: 'legacyChallengeId', type: 'text', }, - { - label: 'Current phase', - propertyName: '', - type: 'text', - }, + // { + // label: 'Current phase', + // propertyName: '', + // type: 'text', + // }, { label: 'Status', propertyName: 'challengeStatus', type: 'text' }, // I think this column is important, and it exits in `admin-app` // but resp does not have it, so I just comment it here diff --git a/src/apps/admin/src/lib/components/ReviewerList/ReviewerList.tsx b/src/apps/admin/src/lib/components/ReviewerList/ReviewerList.tsx index a3e8cca39..e8a826ca1 100644 --- a/src/apps/admin/src/lib/components/ReviewerList/ReviewerList.tsx +++ b/src/apps/admin/src/lib/components/ReviewerList/ReviewerList.tsx @@ -1,7 +1,7 @@ import { FC, useMemo } from 'react' import { format } from 'date-fns' -import { CheckIcon } from '@heroicons/react/solid' +import { CheckIcon, XIcon } from '@heroicons/react/solid' import { useWindowSize, WindowSize } from '~/libs/shared' import { Button, @@ -27,6 +27,7 @@ export interface ReviewerListProps { approvingReviewerId: number onPageChange: (page: number) => void onApproveApplication: (reviewer: Reviewer) => void + onUnapproveApplication: (reviewer: Reviewer) => void onToggleSort: (sort: Sort) => void } @@ -35,15 +36,22 @@ const ApproveButton: FC<{ openReviews: number approvingReviewerId: number onApproveApplication: ReviewerListProps['onApproveApplication'] + onUnapproveApplication: ReviewerListProps['onUnapproveApplication'] }> = props => { const handleApprove = useEventCallback((): void => { props.onApproveApplication(props.reviewer) }) + const handleRemove = useEventCallback((): void => { + props.onUnapproveApplication(props.reviewer) + }) + const isApproving = props.approvingReviewerId === props.reviewer.userId const isOtherApproving = props.approvingReviewerId > 0 const hideApproveButton = props.openReviews < 1 || props.reviewer.applicationStatus !== 'Pending' + const showRemoveButton + = props.reviewer.applicationStatus === 'Approved' return ( <> @@ -53,7 +61,19 @@ const ApproveButton: FC<{ className={styles.approvingLoadingSpinner} /> ) : ( - !hideApproveButton && ( + hideApproveButton ? ( + showRemoveButton && ( + + ) + ) : (