-
Notifications
You must be signed in to change notification settings - Fork 21
fix(PM-3065, PM-3074, PM-3076): added back button, ui issues #1347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,21 @@ | ||
| import { FC, useMemo, useState } from 'react' | ||
| import { FC, useCallback, useMemo, useState } from 'react' | ||
| import { mutate } from 'swr' | ||
| import classNames from 'classnames' | ||
|
|
||
| import { Tabs } from '~/apps/review/src/lib' | ||
| import { Tabs, useChallengeDetailsContext } from '~/apps/review/src/lib' | ||
| import { ScorecardViewer } from '~/apps/review/src/lib/components/Scorecard' | ||
| import { ScorecardAttachments } from '~/apps/review/src/lib/components/Scorecard/ScorecardAttachments' | ||
| import { | ||
| AiWorkflowRunAttachmentsResponse, | ||
| AiWorkflowRunItemsResponse, | ||
| AiWorkflowRunStatusEnum, | ||
| useAppNavigate, | ||
| useFetchAiWorkflowsRunAttachments, | ||
| useFetchAiWorkflowsRunItems, | ||
| } from '~/apps/review/src/lib/hooks' | ||
| import { ReviewsContextModel, SelectOption } from '~/apps/review/src/lib/models' | ||
| import { ChallengeDetailContextModel, ReviewsContextModel, SelectOption } from '~/apps/review/src/lib/models' | ||
| import { AiWorkflowRunStatus } from '~/apps/review/src/lib/components/AiReviewsTable' | ||
| import { rootRoute } from '~/apps/review/src/config/routes.config' | ||
|
|
||
| import { ScorecardHeader } from '../ScorecardHeader' | ||
| import { useReviewsContext } from '../../ReviewsContext' | ||
|
|
@@ -28,12 +32,21 @@ const AiReviewViewer: FC = () => { | |
| ) | ||
| const { totalCount }: AiWorkflowRunAttachmentsResponse | ||
| = useFetchAiWorkflowsRunAttachments(workflowId, workflowRun?.id) | ||
| const { | ||
| challengeInfo, | ||
| }: ChallengeDetailContextModel = useChallengeDetailsContext() | ||
| const navigate = useAppNavigate() | ||
|
|
||
| const tabItems: SelectOption[] = [ | ||
| { | ||
| indicator: workflowRun && ( | ||
| <> | ||
| <span className={styles.tabScore}>{workflowRun?.score ?? ''}</span> | ||
| <span className={classNames(styles.tabScore, { | ||
| [styles.selected]: selectedTab === 'scorecard', | ||
| })} | ||
| > | ||
| {workflowRun?.score ?? ''} | ||
| </span> | ||
| <AiWorkflowRunStatus | ||
| run={workflowRun} | ||
| hideLabel | ||
|
|
@@ -52,6 +65,28 @@ const AiReviewViewer: FC = () => { | |
| ].includes(workflowRun.status) | ||
| ), [workflowRun]) | ||
|
|
||
| const back = useCallback(async (e?: React.MouseEvent<HTMLAnchorElement>) => { | ||
| e?.preventDefault() | ||
| try { | ||
| if (challengeInfo?.id) { | ||
| // Ensure the challenge details reflect the latest data (e.g., active phase) | ||
| await mutate(`challengeBaseUrl/challenges/${challengeInfo?.id}`) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| } | ||
| } catch { | ||
| // no-op: navigation should still occur even if revalidation fails | ||
| } | ||
|
|
||
| const pastPrefix = '/past-challenges/' | ||
| // eslint-disable-next-line no-restricted-globals | ||
| const idx = location.pathname.indexOf(pastPrefix) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| const url = idx > -1 | ||
| ? `${rootRoute}/past-challenges/${challengeInfo?.id}/challenge-details` | ||
| : `${rootRoute}/active-challenges/${challengeInfo?.id}/challenge-details` | ||
| navigate(url, { | ||
| fallback: './../../../../challenge-details', | ||
| }) | ||
| }, [challengeInfo?.id, mutate, navigate]) | ||
|
|
||
| return ( | ||
| <div className={styles.wrap}> | ||
|
|
||
|
|
@@ -74,6 +109,7 @@ const AiReviewViewer: FC = () => { | |
| scorecard={scorecard} | ||
| aiFeedback={runItems} | ||
| setActionButtons={setActionButtons} | ||
| navigateBack={back} | ||
| /> | ||
| )} | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[❗❗
correctness]Ensure that the
ltemdmixin is defined and behaves as expected. If it's not defined in this file, verify its definition elsewhere to confirm it applies the intended styles correctly.