Skip to content

Commit 38e15cd

Browse files
committed
lint fixes
1 parent 83019ed commit 38e15cd

File tree

15 files changed

+167
-109
lines changed

15 files changed

+167
-109
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ interface AiReviewsTableProps {
2222
reviewers: { aiWorkflowId: string }[]
2323
}
2424

25-
2625
const AiReviewsTable: FC<AiReviewsTableProps> = props => {
2726
const aiWorkflowIds = useMemo(() => props.reviewers.map(r => r.aiWorkflowId), [props.reviewers])
2827
const { runs, isLoading }: AiWorkflowRunsResponse = useFetchAiWorkflowsRuns(props.submission.id, aiWorkflowIds)

src/apps/review/src/lib/components/AiReviewsTable/AiWorkflowRunStatus.tsx

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { FC, ReactNode, useCallback, useMemo } from 'react'
2-
import classNames from 'classnames'
1+
import { FC, useMemo } from 'react'
32

43
import { IconOutline } from '~/libs/ui'
54

6-
import { aiRunFailed, aiRunInProgress, AiWorkflowRun, AiWorkflowRunStatusEnum } from '../../hooks'
5+
import { aiRunFailed, aiRunInProgress, AiWorkflowRun } from '../../hooks'
76

87
import StatusLabel from './StatusLabel'
98

@@ -16,28 +15,52 @@ interface AiWorkflowRunStatusProps {
1615
export const AiWorkflowRunStatus: FC<AiWorkflowRunStatusProps> = props => {
1716
const isInProgress = useMemo(() => aiRunInProgress(props.run), [props.run.status])
1817
const isFailed = useMemo(() => aiRunFailed(props.run), [props.run.status])
19-
const isPassing = props.run.status === 'SUCCESS' && props.run.score >= (props.run.workflow.scorecard?.minimumPassingScore ?? 0)
18+
const isPassing = (
19+
props.run.status === 'SUCCESS'
20+
&& props.run.score >= (props.run.workflow.scorecard?.minimumPassingScore ?? 0)
21+
)
2022
const status = isInProgress ? 'pending' : isFailed ? 'failed' : (
2123
isPassing ? 'passed' : 'failed-score'
22-
);
24+
)
2325

24-
const score = props.showScore ? props.run.score : undefined;
26+
const score = props.showScore ? props.run.score : undefined
2527

2628
return (
2729
<>
2830
{props.run.status === 'SUCCESS' && isPassing && (
29-
<StatusLabel icon={<IconOutline.CheckIcon className='icon-xl' />} hideLabel={props.hideLabel} label='Passed' status={status} score={score} />
31+
<StatusLabel
32+
icon={<IconOutline.CheckIcon className='icon-xl' />}
33+
hideLabel={props.hideLabel}
34+
label='Passed'
35+
status={status}
36+
score={score}
37+
/>
3038
)}
3139
{props.run.status === 'SUCCESS' && !isPassing && (
32-
<StatusLabel icon={<IconOutline.MinusCircleIcon className='icon-xl' />} hideLabel={props.hideLabel} label='Failed' status={status} score={score} />
40+
<StatusLabel
41+
icon={<IconOutline.MinusCircleIcon className='icon-xl' />}
42+
hideLabel={props.hideLabel}
43+
label='Failed'
44+
status={status}
45+
score={score}
46+
/>
3347
)}
3448
{isInProgress && (
35-
<StatusLabel icon={<IconOutline.MinusIcon className='icon-md' />} hideLabel={props.hideLabel} label='To be filled' status={status} score={score} />
49+
<StatusLabel
50+
icon={<IconOutline.MinusIcon className='icon-md' />}
51+
hideLabel={props.hideLabel}
52+
label='To be filled'
53+
status={status}
54+
score={score}
55+
/>
3656
)}
3757
{isFailed && (
38-
<StatusLabel icon={<IconOutline.XCircleIcon className='icon-xl' />} status={status} score={score} />
58+
<StatusLabel
59+
icon={<IconOutline.XCircleIcon className='icon-xl' />}
60+
status={status}
61+
score={score}
62+
/>
3963
)}
4064
</>
4165
)
4266
}
43-
Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { FC, ReactNode } from 'react'
2+
import classNames from 'classnames'
23

34
import styles from './StatusLabel.module.scss'
4-
import classNames from 'classnames'
55

66
interface StatusLabelProps {
77
icon: ReactNode
@@ -11,21 +11,18 @@ interface StatusLabelProps {
1111
status: 'pending' | 'failed' | 'passed' | 'failed-score'
1212
}
1313

14-
const StatusLabel: FC<StatusLabelProps> = props => {
15-
16-
return (
17-
<div className={styles.wrap}>
18-
{props.score && (
19-
<span className={classNames(styles[props.status], styles.score)}>{props.score}</span>
20-
)}
21-
{props.icon && (
22-
<span className={classNames(styles.icon, styles[props.status])}>
23-
{props.icon}
24-
</span>
25-
)}
26-
{!props.hideLabel && props.label}
27-
</div>
28-
)
29-
}
14+
const StatusLabel: FC<StatusLabelProps> = props => (
15+
<div className={styles.wrap}>
16+
{props.score && (
17+
<span className={classNames(styles[props.status], styles.score)}>{props.score}</span>
18+
)}
19+
{props.icon && (
20+
<span className={classNames(styles.icon, styles[props.status])}>
21+
{props.icon}
22+
</span>
23+
)}
24+
{!props.hideLabel && props.label}
25+
</div>
26+
)
3027

3128
export default StatusLabel

src/apps/review/src/lib/hooks/useFetchAiWorkflowRuns.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import { EnvironmentConfig } from '~/config'
55
import { xhrGetAsync } from '~/libs/core'
66
import { handleError } from '~/libs/shared/lib/utils/handle-error'
77

8-
import { useRolePermissions, UseRolePermissionsResult } from './useRolePermissions'
98
import { Scorecard } from '../models'
109

10+
import { useRolePermissions, UseRolePermissionsResult } from './useRolePermissions'
11+
1112
export enum AiWorkflowRunStatusEnum {
1213
INIT = 'INIT',
1314
QUEUED = 'QUEUED',

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { getRoutesContainer, lazyLoad, LazyLoadedComponent } from '~/libs/core';
1+
import { getRoutesContainer, lazyLoad, LazyLoadedComponent } from '~/libs/core'
22

3-
import { activeReviewAssignmentsRouteId, challengeDetailRouteId } from '../../config/routes.config';
3+
import { activeReviewAssignmentsRouteId } from '../../config/routes.config'
44

5-
import { challengeDetailsRoutes } from './challenge-details.routes';
5+
import { challengeDetailsRoutes } from './challenge-details.routes'
66

77
const ActiveReviewsPage: LazyLoadedComponent = lazyLoad(
88
() => import('./ActiveReviewsPage'),
@@ -17,13 +17,13 @@ export const activeReviewChildRoutes = [
1717
route: '',
1818
},
1919
...challengeDetailsRoutes,
20-
];
20+
]
2121

2222
export const activeReviewRoutes = [
2323
{
24-
children: [ ...activeReviewChildRoutes ],
24+
children: [...activeReviewChildRoutes],
2525
element: getRoutesContainer(activeReviewChildRoutes),
2626
id: activeReviewAssignmentsRouteId,
2727
route: activeReviewAssignmentsRouteId,
28-
}
28+
},
2929
]

src/apps/review/src/pages/active-review-assignements/challenge-details.routes.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { getRoutesContainer, lazyLoad, LazyLoadedComponent } from '~/libs/core';
1+
import { getRoutesContainer, lazyLoad, LazyLoadedComponent } from '~/libs/core'
22

3-
import { challengeDetailRouteId } from '../../config/routes.config';
4-
import { aiScorecardRoutes } from '../ai-scorecards';
3+
import { challengeDetailRouteId } from '../../config/routes.config'
4+
import { aiScorecardRoutes } from '../ai-scorecards'
55

66
const ChallengeDetailContextProvider: LazyLoadedComponent = lazyLoad(
77
() => import('../../lib/contexts/ChallengeDetailContextProvider'),
8-
'ChallengeDetailContextProvider'
8+
'ChallengeDetailContextProvider',
99
)
1010
const ScorecardDetailsPage: LazyLoadedComponent = lazyLoad(
1111
() => import('./ScorecardDetailsPage'),
@@ -38,5 +38,5 @@ export const challengeDetailsRoutes = [
3838
element: getRoutesContainer(challengeDetailsChildRoutes, ChallengeDetailContextProvider),
3939
id: challengeDetailRouteId,
4040
route: challengeDetailRouteId,
41-
}
41+
},
4242
]

src/apps/review/src/pages/ai-scorecards/AiScorecardContext/AiScorecardContextProvider.tsx

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { useParams } from 'react-router-dom'
66

77
import { ChallengeDetailContext } from '../../../lib'
88
import { AiScorecardContextModel, ChallengeDetailContextModel } from '../../../lib/models'
9-
109
import { AiWorkflowRunsResponse, useFetchAiWorkflowsRuns } from '../../../lib/hooks'
1110

1211
export const AiScorecardContext: Context<AiScorecardContextModel>
@@ -22,42 +21,48 @@ export const AiScorecardContextProvider: FC<PropsWithChildren> = props => {
2221
}>()
2322

2423
const challengeDetailsCtx = useContext(ChallengeDetailContext)
25-
const { challengeInfo }: ChallengeDetailContextModel = challengeDetailsCtx;
26-
const aiReviewers = useMemo(() => (challengeInfo?.reviewers ?? []).filter(r => !!r.aiWorkflowId), [challengeInfo?.reviewers])
24+
const { challengeInfo }: ChallengeDetailContextModel = challengeDetailsCtx
25+
const aiReviewers = useMemo(() => (
26+
(challengeInfo?.reviewers ?? []).filter(r => !!r.aiWorkflowId)
27+
), [challengeInfo?.reviewers])
2728
const aiWorkflowIds = useMemo(() => aiReviewers?.map(r => r.aiWorkflowId as string), [aiReviewers])
2829

29-
const { runs: workflowRuns, isLoading: aiWorkflowRunsLoading }: AiWorkflowRunsResponse = useFetchAiWorkflowsRuns(submissionId, aiWorkflowIds)
30+
const { runs: workflowRuns, isLoading: aiWorkflowRunsLoading }: AiWorkflowRunsResponse
31+
= useFetchAiWorkflowsRuns(submissionId, aiWorkflowIds)
3032

31-
const isLoadingCtxData =
32-
challengeDetailsCtx.isLoadingChallengeInfo &&
33-
challengeDetailsCtx.isLoadingChallengeResources &&
34-
challengeDetailsCtx.isLoadingChallengeSubmissions &&
35-
aiWorkflowRunsLoading
33+
const isLoadingCtxData
34+
= challengeDetailsCtx.isLoadingChallengeInfo
35+
&& challengeDetailsCtx.isLoadingChallengeResources
36+
&& challengeDetailsCtx.isLoadingChallengeSubmissions
37+
&& aiWorkflowRunsLoading
3638

37-
const workflowRun = useMemo(() => workflowRuns.find(w => w.workflow.id === workflowId), [workflowRuns, workflowId])
39+
const workflowRun = useMemo(
40+
() => workflowRuns.find(w => w.workflow.id === workflowId),
41+
[workflowRuns, workflowId],
42+
)
3843
const workflow = useMemo(() => workflowRun?.workflow, [workflowRuns, workflowId])
3944
const scorecard = useMemo(() => workflow?.scorecard, [workflow])
4045

4146
const value = useMemo<AiScorecardContextModel>(
4247
() => ({
4348
...challengeDetailsCtx,
49+
isLoading: isLoadingCtxData,
50+
scorecard,
4451
submissionId,
52+
workflow,
4553
workflowId,
46-
workflowRuns,
4754
workflowRun,
48-
workflow,
49-
scorecard,
50-
isLoading: isLoadingCtxData,
55+
workflowRuns,
5156
}),
5257
[
5358
challengeDetailsCtx,
59+
isLoadingCtxData,
60+
scorecard,
5461
submissionId,
62+
workflow,
5563
workflowId,
56-
workflowRuns,
5764
workflowRun,
58-
isLoadingCtxData,
59-
workflow,
60-
scorecard,
65+
workflowRuns,
6166
],
6267
)
6368

@@ -68,4 +73,4 @@ export const AiScorecardContextProvider: FC<PropsWithChildren> = props => {
6873
)
6974
}
7075

71-
export const useAiScorecardContext = () => useContext(AiScorecardContext)
76+
export const useAiScorecardContext = (): AiScorecardContextModel => useContext(AiScorecardContext)

src/apps/review/src/pages/ai-scorecards/AiScorecardViewer/AiScorecardViewer.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
import { FC, useEffect, useMemo } from 'react'
22

3-
import styles from './AiScorecardViewer.module.scss'
4-
import { ScorecardHeader } from '../components/ScorecardHeader'
53
import { NotificationContextType, useNotification } from '~/libs/shared'
4+
5+
import { ScorecardHeader } from '../components/ScorecardHeader'
66
import { IconAiReview } from '../../../lib/assets/icons'
77
import { PageWrapper } from '../../../lib'
88
import { useAiScorecardContext } from '../AiScorecardContext'
99
import { AiScorecardContextModel } from '../../../lib/models'
1010
import { AiWorkflowsSidebar } from '../components/AiWorkflowsSidebar'
1111

12-
interface AiScorecardViewerProps {
13-
}
14-
15-
const AiScorecardViewer: FC<AiScorecardViewerProps> = props => {
12+
import styles from './AiScorecardViewer.module.scss'
1613

14+
const AiScorecardViewer: FC = () => {
1715
const { showBannerNotification, removeNotification }: NotificationContextType = useNotification()
18-
const { challengeInfo, workflowRuns }: AiScorecardContextModel = useAiScorecardContext()
16+
const { challengeInfo }: AiScorecardContextModel = useAiScorecardContext()
1917

2018
const breadCrumb = useMemo(
2119
() => [{ index: 1, label: 'My Active Challenges' }],
Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1-
import { getRoutesContainer, lazyLoad, LazyLoadedComponent, PlatformRoute, UserRole } from '~/libs/core'
1+
import { getRoutesContainer, lazyLoad, LazyLoadedComponent, PlatformRoute } from '~/libs/core'
22

33
import { aiScorecardRouteId } from '../../config/routes.config'
44

5-
const AiScorecardViewer: LazyLoadedComponent = lazyLoad(() => import('./AiScorecardViewer'), 'AiScorecardViewer')
6-
const AiScorecardContextProvider: LazyLoadedComponent = lazyLoad(() => import('./AiScorecardContext'), 'AiScorecardContextProvider')
5+
const AiScorecardViewer: LazyLoadedComponent = lazyLoad(
6+
() => import('./AiScorecardViewer'),
7+
'AiScorecardViewer',
8+
)
9+
10+
const AiScorecardContextProvider: LazyLoadedComponent = lazyLoad(
11+
() => import('./AiScorecardContext'),
12+
'AiScorecardContextProvider',
13+
)
714

815
export const aiScorecardChildRoutes: ReadonlyArray<PlatformRoute> = [
916
{
@@ -14,16 +21,14 @@ export const aiScorecardChildRoutes: ReadonlyArray<PlatformRoute> = [
1421
},
1522
]
1623

17-
// const AiScorecardsContainer = getRoutesContainer(aiScorecardChildRoutes);
18-
1924
export const aiScorecardRoutes: ReadonlyArray<PlatformRoute> = [
2025
{
21-
children: [ ...aiScorecardChildRoutes ],
26+
children: [...aiScorecardChildRoutes],
2227
element: getRoutesContainer(aiScorecardChildRoutes, AiScorecardContextProvider),
2328
id: aiScorecardRouteId,
2429
rolesRequired: [
2530
// UserRole.administrator,
2631
],
2732
route: `${aiScorecardRouteId}/:submissionId/:workflowId`,
28-
}
33+
},
2934
]

0 commit comments

Comments
 (0)