-
Notifications
You must be signed in to change notification settings - Fork 21
Add ai reviewers on all tables #1348
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 |
|---|---|---|
|
|
@@ -184,3 +184,23 @@ | |
| color: var(--GrayFontColor); | ||
| font-size: 14px; | ||
| } | ||
|
|
||
| .aiReviews { | ||
| margin: $sp-2 0; | ||
|
|
||
| :global(.trigger) { | ||
| width: fit-content; | ||
| margin-left: auto; | ||
| } | ||
|
|
||
| :global(.reviews-table) { | ||
| margin-left: auto; | ||
| width: 75%; | ||
| margin-bottom: -9px; | ||
|
|
||
| @include ltelg { | ||
| width: auto; | ||
| margin-left: -1*$sp-4; | ||
|
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. [ |
||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ import { UserRole } from '~/libs/core' | |
| import { handleError } from '~/apps/admin/src/lib/utils' | ||
|
|
||
| import { | ||
| BackendSubmission, | ||
| ChallengeDetailContextModel, | ||
| ReviewAppContextModel, | ||
| Screening, | ||
|
|
@@ -33,6 +34,7 @@ import { updateReview } from '../../services' | |
| import { ConfirmModal } from '../ConfirmModal' | ||
| import { useSubmissionDownloadAccess } from '../../hooks' | ||
| import type { UseSubmissionDownloadAccessResult } from '../../hooks/useSubmissionDownloadAccess' | ||
| import { CollapsibleAiReviewsRow } from '../CollapsibleAiReviewsRow' | ||
|
|
||
| import styles from './TableCheckpointSubmissions.module.scss' | ||
|
|
||
|
|
@@ -42,6 +44,7 @@ interface Props { | |
| isDownloading: IsRemovingType | ||
| downloadSubmission: (submissionId: string) => void | ||
| mode?: 'submission' | 'screening' | 'review' | ||
| aiReviewers?: { aiWorkflowId: string }[] | ||
| } | ||
|
|
||
| const isInProgressStatus = (value: string | undefined): boolean => ( | ||
|
|
@@ -161,6 +164,45 @@ export const TableCheckpointSubmissions: FC<Props> = (props: Props) => { | |
| [datas], | ||
| ) | ||
|
|
||
| const aiReviewsColumn = useMemo<TableColumn<Screening> | undefined>( | ||
| () => { | ||
| if (!props.aiReviewers?.length) { | ||
| return undefined | ||
| } | ||
|
|
||
| return { | ||
| columnId: 'ai-reviews-table', | ||
| isExpand: true, | ||
| label: '', | ||
| renderer: (data: Screening, allRows: Screening[]) => { | ||
| const submissionPayload = { | ||
| id: data.submissionId ?? '', | ||
| virusScan: data.virusScan, | ||
| } as Pick<BackendSubmission, 'id'|'virusScan'> | ||
|
|
||
| if (!submissionPayload.id) { | ||
| return <></> | ||
| } | ||
|
|
||
| return ( | ||
| <CollapsibleAiReviewsRow | ||
| className={styles.aiReviews} | ||
| aiReviewers={props.aiReviewers!} | ||
|
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. [ |
||
| submission={submissionPayload} | ||
| defaultOpen={allRows ? !allRows.indexOf(data) : false} | ||
|
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. [ |
||
| /> | ||
| ) | ||
| }, | ||
| type: 'element', | ||
| } as TableColumn<Screening> | ||
| }, | ||
| [props.aiReviewers], | ||
| ) | ||
|
|
||
| const appendAiColumn = (columns: TableColumn<Screening>[]): TableColumn<Screening>[] => ( | ||
| aiReviewsColumn ? [...columns, aiReviewsColumn] : columns | ||
| ) | ||
|
|
||
| const columns = useMemo<TableColumn<Screening>[]>( | ||
| () => { | ||
| const tableMode = mode | ||
|
|
@@ -312,7 +354,7 @@ export const TableCheckpointSubmissions: FC<Props> = (props: Props) => { | |
| } | ||
|
|
||
| if (tableMode === 'submission') { | ||
| return baseColumns | ||
| return appendAiColumn(baseColumns) | ||
| } | ||
|
|
||
| if (tableMode === 'screening') { | ||
|
|
@@ -410,7 +452,7 @@ export const TableCheckpointSubmissions: FC<Props> = (props: Props) => { | |
| const hasAnyMyAssignment = rows.some(row => Boolean(row.myReviewResourceId)) | ||
| const canShowReopenActions = rows.some(row => computeReopenEligibility(row).canReopen) | ||
| if (!hasAnyMyAssignment && !canShowReopenActions) { | ||
| return screeningColumns | ||
| return appendAiColumn(screeningColumns) | ||
| } | ||
|
|
||
| const actionColumn: TableColumn<Screening> = { | ||
|
|
@@ -502,10 +544,10 @@ export const TableCheckpointSubmissions: FC<Props> = (props: Props) => { | |
| type: 'element', | ||
| } | ||
|
|
||
| return [ | ||
| return appendAiColumn([ | ||
| ...screeningColumns, | ||
| actionColumn, | ||
| ] | ||
| ]) | ||
| } | ||
|
|
||
| // mode === 'review' | ||
|
|
@@ -574,7 +616,7 @@ export const TableCheckpointSubmissions: FC<Props> = (props: Props) => { | |
| const hasAnyMyAssignment = rows.some(row => Boolean(row.myReviewResourceId)) | ||
| const canShowReopenActions = rows.some(row => computeReopenEligibility(row).canReopen) | ||
| if (!hasAnyMyAssignment && !canShowReopenActions) { | ||
| return reviewColumns | ||
| return appendAiColumn(reviewColumns) | ||
| } | ||
|
|
||
| const actionColumn: TableColumn<Screening> = { | ||
|
|
@@ -666,10 +708,10 @@ export const TableCheckpointSubmissions: FC<Props> = (props: Props) => { | |
| type: 'element', | ||
| } | ||
|
|
||
| return [ | ||
| return appendAiColumn([ | ||
| ...reviewColumns, | ||
| actionColumn, | ||
| ] | ||
| ]) | ||
| }, | ||
| [ | ||
| challengeInfo, | ||
|
|
@@ -730,6 +772,8 @@ export const TableCheckpointSubmissions: FC<Props> = (props: Props) => { | |
| <Table | ||
| columns={columns} | ||
| data={visibleRows} | ||
| showExpand | ||
| expandMode='always' | ||
| disableSorting | ||
| onToggleSort={_.noop} | ||
| removeDefaultSort | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -240,3 +240,23 @@ | |
| .reviewerList > span { | ||
| display: inline-flex; | ||
| } | ||
|
|
||
| .aiReviews { | ||
| margin: $sp-2 0; | ||
|
|
||
| :global(.trigger) { | ||
| width: fit-content; | ||
| margin-left: auto; | ||
| } | ||
|
|
||
| :global(.reviews-table) { | ||
| margin-left: auto; | ||
| width: 75%; | ||
| margin-bottom: -9px; | ||
|
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. [ |
||
|
|
||
| @include ltelg { | ||
| width: auto; | ||
| margin-left: -1*$sp-4; | ||
|
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. [💡 |
||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,7 @@ import type { SubmissionRow } from '../common/types' | |
| import { resolveSubmissionReviewResult } from '../common/reviewResult' | ||
| import { ProgressBar } from '../ProgressBar' | ||
| import { TableWrapper } from '../TableWrapper' | ||
| import { CollapsibleAiReviewsRow } from '../CollapsibleAiReviewsRow' | ||
|
|
||
| import styles from './TableIterativeReview.module.scss' | ||
|
|
||
|
|
@@ -57,6 +58,7 @@ interface Props { | |
| hideSubmissionColumn?: boolean | ||
| isChallengeCompleted?: boolean | ||
| hasPassedThreshold?: boolean | ||
| aiReviewers?: { aiWorkflowId: string }[] | ||
| } | ||
|
|
||
| interface ScoreMetadata { | ||
|
|
@@ -1335,6 +1337,25 @@ export const TableIterativeReview: FC<Props> = (props: Props) => { | |
| baseColumns.push(reviewerColumn) | ||
| } | ||
|
|
||
| if (props.aiReviewers) { | ||
| baseColumns.push({ | ||
| columnId: 'ai-reviews-table', | ||
| isExpand: true, | ||
| label: '', | ||
| renderer: (submission: SubmissionInfo, allRows: SubmissionInfo[]) => ( | ||
| props.aiReviewers && ( | ||
| <CollapsibleAiReviewsRow | ||
| className={styles.aiReviews} | ||
| aiReviewers={props.aiReviewers} | ||
| submission={submission as any} | ||
| defaultOpen={allRows ? !allRows.indexOf(submission) : false} | ||
|
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. [ |
||
| /> | ||
| ) | ||
| ), | ||
| type: 'element', | ||
| }) | ||
| } | ||
|
|
||
| return baseColumns | ||
| }, [ | ||
| approverColumn, | ||
|
|
@@ -1349,6 +1370,7 @@ export const TableIterativeReview: FC<Props> = (props: Props) => { | |
| reviewDateColumn, | ||
| reviewerColumn, | ||
| submissionColumn, | ||
| props.aiReviewers, | ||
| ]) | ||
|
|
||
| const columnsMobile = useMemo<MobileTableColumn<SubmissionInfo>[][]>(() => ( | ||
|
|
@@ -1387,6 +1409,8 @@ export const TableIterativeReview: FC<Props> = (props: Props) => { | |
| <Table | ||
| columns={actionColumn ? [...columns, actionColumn] : columns} | ||
| data={datas} | ||
| showExpand | ||
| expandMode='always' | ||
|
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. [ |
||
| disableSorting | ||
| onToggleSort={_.noop} | ||
| removeDefaultSort | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -194,3 +194,23 @@ | |
| height: 18px; | ||
| } | ||
| } | ||
|
|
||
| .aiReviews { | ||
| margin: $sp-2 0; | ||
|
|
||
| :global(.trigger) { | ||
| width: fit-content; | ||
| margin-left: auto; | ||
| } | ||
|
|
||
| :global(.reviews-table) { | ||
| margin-left: auto; | ||
| width: 75%; | ||
| margin-bottom: -9px; | ||
|
|
||
| @include ltelg { | ||
| width: auto; | ||
| margin-left: -1*$sp-4; | ||
|
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. [ |
||
| } | ||
| } | ||
| } | ||
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.
[⚠️
maintainability]The negative margin value
-9pxformargin-bottomcould lead to unexpected layout issues, especially if the surrounding elements are not designed to accommodate this. Consider verifying the layout impact or using a more consistent spacing strategy.