Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/apps/review/src/config/index.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export const REVIEWER = 'Reviewer'
export const SUBMITTER = 'Submitter'
export const COPILOT = 'Copilot'
export const ADMIN = 'Admin'
export const MANAGER = 'Manager'

export const MOCKHANDLE = 'stevenfrog'
export const REVIEWCOUNT = 3
Expand Down
2 changes: 1 addition & 1 deletion src/apps/review/src/lib/models/ChallengeRole.type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
* Challenge role use for review flow
*/
export type ChallengeRole = 'Reviewer' | 'Submitter' | 'Copilot' | 'Admin' | ''
export type ChallengeRole = 'Reviewer' | 'Submitter' | 'Copilot' | 'Admin' | 'Manager' | ''
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
import { BreadCrumbData, ChallengeDetailContextModel } from '../../../lib/models'
import { SubmissionBarInfo } from '../../../lib/components/SubmissionBarInfo'
import { ChallengeLinksForAdmin } from '../../../lib/components/ChallengeLinksForAdmin'
import { ADMIN, COPILOT } from '../../../config/index.config'
import { ADMIN, COPILOT, MANAGER } from '../../../config/index.config'
import { useIsEditReview, useIsEditReviewProps } from '../../../lib/hooks/useIsEditReview'
import { activeReviewAssigmentsRouteId, rootRoute } from '../../../config/routes.config'

Expand Down Expand Up @@ -319,6 +319,13 @@ export const ScorecardDetailsPage: FC<Props> = (props: Props) => {
[myChallengeRoles],
)

const hasChallengeManagerRole = useMemo(
() => myChallengeResources.some(
resource => resource.roleName?.toLowerCase() === MANAGER.toLowerCase(),
),
[myChallengeResources],
)

const hasChallengeCopilotRole = useMemo(
() => myChallengeResources.some(
resource => resource.roleName?.toLowerCase() === COPILOT.toLowerCase(),
Expand All @@ -331,11 +338,13 @@ export const ScorecardDetailsPage: FC<Props> = (props: Props) => {
reviewInfo?.committed
&& (hasChallengeAdminRole
|| hasTopcoderAdminRole
|| hasChallengeManagerRole
|| hasChallengeCopilotRole),
),
[
hasChallengeAdminRole,
hasChallengeCopilotRole,
hasChallengeManagerRole,
hasTopcoderAdminRole,
reviewInfo?.committed,
],
Expand Down Expand Up @@ -381,18 +390,21 @@ export const ScorecardDetailsPage: FC<Props> = (props: Props) => {
<>
<div className={styles.summary}>
<SubmissionBarInfo submission={submissionInfo} />
{actionChallengeRole === ADMIN || actionChallengeRole === COPILOT ? (
<ChallengeLinksForAdmin
isSavingReview={isSavingReview}
saveReviewInfo={saveReviewInfo}
reviewInfo={reviewInfo}
canEditScorecard={canEditScorecard}
isManagerEdit={isManagerEdit}
onToggleManagerEdit={toggleManagerEdit}
/>
) : (
<ChallengeLinks />
)}
{actionChallengeRole === ADMIN
|| actionChallengeRole === COPILOT
|| actionChallengeRole === MANAGER

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using parentheses around the condition for better readability when combining multiple conditions with logical operators.

? (
<ChallengeLinksForAdmin
isSavingReview={isSavingReview}
saveReviewInfo={saveReviewInfo}
reviewInfo={reviewInfo}
canEditScorecard={canEditScorecard}
isManagerEdit={isManagerEdit}
onToggleManagerEdit={toggleManagerEdit}
/>
) : (
<ChallengeLinks />
)}
</div>

<ScorecardDetails
Expand Down