Skip to content

Commit a831af1

Browse files
committed
fix: back to challenge redirection
1 parent f113220 commit a831af1

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,13 @@ export const ScorecardDetails: FC<Props> = (props: Props) => {
418418
// no-op: navigation should still occur even if revalidation fails
419419
}
420420

421-
navigate(-1, {
421+
const pastPrefix = '/past-challenges/'
422+
// eslint-disable-next-line no-restricted-globals
423+
const idx = location.pathname.indexOf(pastPrefix)
424+
const url = idx > -1
425+
? `${rootRoute}/past-challenges/${challengeInfo?.id}/challenge-details`
426+
: `${rootRoute}/active-challenges/${challengeInfo?.id}/challenge-details`
427+
navigate(url, {
422428
fallback: './../../../../challenge-details',
423429
})
424430
}, [challengeId, mutate, navigate])

src/apps/review/src/pages/active-review-assignements/ScorecardDetailsPage/ScorecardDetailsPage.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ export const ScorecardDetailsPage: FC<Props> = (props: Props) => {
272272
?? reviewId,
273273
[reviewId, reviewInfo?.submissionId, submissionInfo?.id],
274274
)
275+
const containsPastChallenges = location.pathname.indexOf('/past-challenges/')
275276

276277
const breadCrumb = useMemo<BreadCrumbData[]>(() => [
277278
{
@@ -283,7 +284,9 @@ export const ScorecardDetailsPage: FC<Props> = (props: Props) => {
283284
fallback: './../../../../challenge-details',
284285
index: 2,
285286
label: challengeInfo?.name,
286-
path: -1,
287+
path: containsPastChallenges > -1
288+
? `${rootRoute}/past-challenges/${challengeInfo?.id}/challenge-details`
289+
: `${rootRoute}/active-challenges/${challengeInfo?.id}/challenge-details`,
287290
},
288291
{
289292
index: 3,

0 commit comments

Comments
 (0)