From 22b50422da6253bdcfd7a13febbfff3f776df3e5 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Thu, 22 Oct 2026 12:14:06 +1100 Subject: [PATCH] PM-6648: Link manual review scorecard in challenge Review Style What was broken The opportunities challenge sidebar listed the manual review in Review Style only as "Manual". Members could not open the scorecard the manual review uses. The design asks for "Manual: Scorecard Link". Root cause The sidebar only knew the AI review config mode. It never read the challenge review definition (challenge.reviewers), which holds the member reviewer's scorecardId. The opportunities models did not type those reviewer fields or the phase type id the reviewers point to. What was changed - Added challengeManualReviewScorecardId and challengeManualReviewScorecardUrl to challenge-detail.utils. They pick the member (non-AI) reviewer on the Review phase, falling back to Iterative Review, and build the public Review App scorecard URL (REVIEW_APP_URL/scorecard/). - ChallengeSidebar passes that URL to ReviewStyleSection. The Manual bullet now reads "Manual: Scorecard Link" with the existing tooltip. The link is only added when no AI review config exists. - Typed ChallengeReviewer isMemberReview/phaseId/scorecardId and ChallengePhase phaseId. Added/updated tests - challenge-detail.utils.spec.ts covers Review phase selection, the Iterative Review fallback, id encoding, and ignoring AI and screening reviewers. - ChallengeSidebar.spec.tsx covers the Manual scorecard link and checks that AI review modes do not get the link. Co-Authored-By: Claude Opus 5.5 --- .../src/components/ChallengeSidebar.spec.tsx | 40 +++++++++++ .../src/components/ChallengeSidebar.tsx | 30 ++++++-- .../src/models/opportunity.models.ts | 10 ++- .../src/utils/challenge-detail.utils.spec.ts | 71 +++++++++++++++++++ .../src/utils/challenge-detail.utils.ts | 57 +++++++++++++++ 5 files changed, 203 insertions(+), 5 deletions(-) diff --git a/src/apps/opportunities/src/components/ChallengeSidebar.spec.tsx b/src/apps/opportunities/src/components/ChallengeSidebar.spec.tsx index b32cde9cf..dc3432710 100644 --- a/src/apps/opportunities/src/components/ChallengeSidebar.spec.tsx +++ b/src/apps/opportunities/src/components/ChallengeSidebar.spec.tsx @@ -39,6 +39,7 @@ const topgearChallengesExplainedUrl const mockUseSWR = jest.fn() const mockChallengeAllowsStockArt = jest.fn() const mockChallengeFileTypes = jest.fn() +const mockChallengeManualReviewScorecardUrl = jest.fn() const mockChallengeSidebarLinks = jest.fn() const mockIsTopgearChallenge = jest.fn() @@ -64,6 +65,7 @@ jest.mock('../utils', () => ({ challengeAllowsStockArt: (...args: unknown[]) => mockChallengeAllowsStockArt(...args), challengeFileTypes: (...args: unknown[]) => mockChallengeFileTypes(...args), challengeForumUrl: (): undefined => undefined, + challengeManualReviewScorecardUrl: (...args: unknown[]) => mockChallengeManualReviewScorecardUrl(...args), challengeReviewAppUrl: (challengeId: string): string => ( `https://review.topcoder-dev.com/active-challenges/${challengeId}/challenge-details` ), @@ -137,6 +139,7 @@ describe('ChallengeSidebar Review Style', () => { mockUseSWR.mockReturnValue({ data: undefined }) mockChallengeAllowsStockArt.mockReturnValue(false) mockChallengeFileTypes.mockReturnValue([]) + mockChallengeManualReviewScorecardUrl.mockReturnValue(undefined) mockIsTopgearChallenge.mockReturnValue(false) mockChallengeSidebarLinks.mockReturnValue({ attachments: [], @@ -171,6 +174,43 @@ describe('ChallengeSidebar Review Style', () => { .toBeInTheDocument() expect(screen.queryByText(/Instant Review is/)) .not.toBeInTheDocument() + expect(screen.queryByRole('link', { name: 'Scorecard Link' })) + .not.toBeInTheDocument() + }) + + it('links the manual review scorecard from the challenge review definition', () => { + const scorecardUrl = 'https://review.topcoder-dev.com/scorecard/hFU73Ve2XlYCK-' + mockChallengeManualReviewScorecardUrl.mockReturnValue(scorecardUrl) + + renderSidebar(undefined, developmentChallenge) + + expect(mockChallengeManualReviewScorecardUrl) + .toHaveBeenCalledWith(developmentChallenge) + const scorecardLink = screen.getByRole('link', { name: 'Scorecard Link' }) + expect(scorecardLink) + .toHaveAttribute('href', scorecardUrl) + expect(scorecardLink) + .toHaveAttribute('target', '_blank') + expect(scorecardLink.closest('li')?.textContent) + .toContain('Manual: Scorecard Link') + expect(screen.getByRole('button', { name: 'About Manual' })) + .toBeInTheDocument() + }) + + it('does not attach the manual scorecard link to AI review modes', () => { + mockChallengeManualReviewScorecardUrl.mockReturnValue('https://review.topcoder-dev.com/scorecard/manual') + + renderSidebar({ + challengeId: challenge.id, + id: 'ai-gating-config', + instantReview: false, + mode: 'AI_GATING', + }, developmentChallenge) + + expect(screen.getByText('AI Gating')) + .toBeInTheDocument() + expect(screen.queryByRole('link', { name: 'Scorecard Link' })) + .not.toBeInTheDocument() }) it('shows AI-only review and the disabled Instant Review state', () => { diff --git a/src/apps/opportunities/src/components/ChallengeSidebar.tsx b/src/apps/opportunities/src/components/ChallengeSidebar.tsx index 71098a6c6..a9e9f78dd 100644 --- a/src/apps/opportunities/src/components/ChallengeSidebar.tsx +++ b/src/apps/opportunities/src/components/ChallengeSidebar.tsx @@ -19,6 +19,7 @@ import { challengeAllowsStockArt, challengeFileTypes, challengeForumUrl, + challengeManualReviewScorecardUrl, challengeReviewAppUrl, ChallengeSidebarLink, challengeSidebarLinks, @@ -77,26 +78,44 @@ interface SidebarCardProps { interface ReviewStyleItemProps { label: string + scorecardUrl?: string tooltip: string } interface ReviewStyleSectionProps { config?: ChallengeAiReviewConfig loading?: boolean + manualReviewScorecardUrl?: string unavailable?: boolean } /** * Renders one review-style bullet with an accessible tooltip. * - * @param props member-facing label and tooltip copy. + * @param props member-facing label, tooltip copy, and optional scorecard destination + * rendered as "