Skip to content

Commit 9b1890c

Browse files
committed
Updates for showing proper info to submitters in appeals / appeals response tabs
1 parent ab3b2d1 commit 9b1890c

File tree

4 files changed

+258
-63
lines changed

4 files changed

+258
-63
lines changed

src/apps/review/src/lib/components/TableReviewAppeals/TableReviewAppeals.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,11 @@ export const TableReviewAppeals: FC<Props> = (props: Props) => {
325325

326326
const canViewHistory = hasAdminRole || hasCopilotRole || isTopcoderAdmin
327327

328+
const shouldShowAggregatedReviewScore = useMemo(
329+
() => !(hasReviewerRole && !hasCopilotRole && !hasAdminRole && !isTopcoderAdmin),
330+
[hasAdminRole, hasCopilotRole, hasReviewerRole, isTopcoderAdmin],
331+
)
332+
328333
// Aggregated view groups one row per submission and shows reviewer columns + average score.
329334
const isAggregatedView = useMemo(() => {
330335
if (tab === 'Appeals' || tab === 'Review') {
@@ -860,7 +865,7 @@ export const TableReviewAppeals: FC<Props> = (props: Props) => {
860865
submissionColumn,
861866
...(handleColumnAgg ? [handleColumnAgg] : []),
862867
reviewDateColumn,
863-
reviewScoreColumn,
868+
...(shouldShowAggregatedReviewScore ? [reviewScoreColumn] : []),
864869
]
865870

866871
for (let index = 0; index < maxReviewCount; index += 1) {

src/apps/review/src/lib/components/TableReviewAppealsForSubmitter/TableReviewAppealsForSubmitter.tsx

Lines changed: 12 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ export const TableReviewAppealsForSubmitter: FC<Props> = (props: Props) => {
8686
() => (props.tab || '').toLowerCase() === 'submission',
8787
[props.tab],
8888
)
89+
const isAppealsTab = useMemo(
90+
() => (props.tab || '').toLowerCase() === 'appeals',
91+
[props.tab],
92+
)
8993
const challengeStatus = challengeInfo?.status?.toUpperCase()
9094
const isChallengeCompleted = challengeStatus === 'COMPLETED'
9195

@@ -216,11 +220,11 @@ export const TableReviewAppealsForSubmitter: FC<Props> = (props: Props) => {
216220
[challengeInfo],
217221
)
218222

219-
const shouldShowAppealsColumn = useMemo(() => {
220-
const tabName = (props.tab || '').toLowerCase()
221-
// Only show Appeals columns on the "Appeals" tab for submitters
222-
return allowsAppeals && tabName === 'appeals'
223-
}, [allowsAppeals, props.tab])
223+
// Only show Appeals columns on the "Appeals" tab for submitters
224+
const shouldShowAppealsColumn = useMemo(
225+
() => allowsAppeals && isAppealsTab,
226+
[allowsAppeals, isAppealsTab],
227+
)
224228

225229
const aggregatedRows = useMemo(
226230
() => aggregateSubmissionReviews({
@@ -434,7 +438,7 @@ export const TableReviewAppealsForSubmitter: FC<Props> = (props: Props) => {
434438
}
435439

436440
// On Appeals tab, make the average score clickable to a review page
437-
if ((props.tab || '').toLowerCase() === 'appeals') {
441+
if (isAppealsTab) {
438442
const reviewDetail = data.aggregated?.reviews?.[0]
439443
const reviewId = reviewDetail?.reviewInfo?.id || reviewDetail?.reviewId
440444
if (reviewId) {
@@ -553,7 +557,6 @@ export const TableReviewAppealsForSubmitter: FC<Props> = (props: Props) => {
553557
}
554558

555559
const totalAppeals = reviewDetail?.totalAppeals ?? 0
556-
const unresolvedAppeals = reviewDetail?.unresolvedAppeals ?? 0
557560

558561
if (!totalAppeals && (reviewInfo.status ?? '').toUpperCase() !== 'COMPLETED') {
559562
return (
@@ -571,15 +574,7 @@ export const TableReviewAppealsForSubmitter: FC<Props> = (props: Props) => {
571574
)}
572575
to={`./../review/${reviewId}`}
573576
>
574-
[
575-
{' '}
576-
<span className={styles.textBlue}>{unresolvedAppeals}</span>
577-
{' '}
578-
/
579-
{' '}
580577
<span className={styles.textBlue}>{totalAppeals}</span>
581-
{' '}
582-
]
583578
</Link>
584579
)
585580
}
@@ -623,9 +618,7 @@ export const TableReviewAppealsForSubmitter: FC<Props> = (props: Props) => {
623618
}
624619
}
625620

626-
const shouldShowAppealAction = (props.tab || '').toLowerCase() === 'appeals'
627-
&& isAppealsPhase(challengeInfo)
628-
const shouldRenderActionsColumn = shouldShowAppealAction || hasHistoryEntries
621+
const shouldRenderActionsColumn = !isAppealsTab && hasHistoryEntries
629622

630623
if (shouldRenderActionsColumn) {
631624
aggregatedColumns.push({
@@ -635,25 +628,6 @@ export const TableReviewAppealsForSubmitter: FC<Props> = (props: Props) => {
635628
renderer: (data: SubmissionRow) => {
636629
const actionEntries: Array<{ key: string; element: JSX.Element }> = []
637630

638-
if (shouldShowAppealAction) {
639-
const reviewDetail = (data.aggregated?.reviews || []).find(r => r.reviewInfo?.id)
640-
const reviewId = reviewDetail?.reviewInfo?.id || reviewDetail?.reviewId
641-
642-
if (reviewId) {
643-
actionEntries.push({
644-
element: (
645-
<Link
646-
to={`./../review/${reviewId}`}
647-
className={classNames(styles.textBlue, 'last-element')}
648-
>
649-
Appeal
650-
</Link>
651-
),
652-
key: 'appeal-action',
653-
})
654-
}
655-
}
656-
657631
const historyKeyForRow = getSubmissionHistoryKey(data.memberId, data.id)
658632
const rowHistory = historyByMember.get(historyKeyForRow) ?? []
659633
if (isSubmissionTab && rowHistory.length > 0) {
@@ -714,7 +688,7 @@ export const TableReviewAppealsForSubmitter: FC<Props> = (props: Props) => {
714688
restrictionMessage,
715689
challengeInfo,
716690
isSubmissionTab,
717-
props.tab,
691+
isAppealsTab,
718692
])
719693

720694
const columnsMobile = useMemo<MobileTableColumn<SubmissionRow>[][]>(

0 commit comments

Comments
 (0)