diff --git a/src/apps/review/src/lib/components/TableCheckpointSubmissions/TableCheckpointSubmissions.tsx b/src/apps/review/src/lib/components/TableCheckpointSubmissions/TableCheckpointSubmissions.tsx index ffcd4dfed..4af5d7198 100644 --- a/src/apps/review/src/lib/components/TableCheckpointSubmissions/TableCheckpointSubmissions.tsx +++ b/src/apps/review/src/lib/components/TableCheckpointSubmissions/TableCheckpointSubmissions.tsx @@ -165,37 +165,31 @@ export const TableCheckpointSubmissions: FC = (props: Props) => { ) const aiReviewsColumn = useMemo | 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 - - if (!submissionPayload.id) { - return <> - } + () => ({ + columnId: 'ai-reviews-table', + isExpand: true, + label: '', + renderer: (data: Screening, allRows: Screening[]) => { + const submissionPayload = { + id: data.submissionId ?? '', + virusScan: data.virusScan, + } as Pick + + if (!submissionPayload.id) { + return <> + } - return ( - - ) - }, - type: 'element', - } as TableColumn - }, + return ( + + ) + }, + type: 'element', + } as TableColumn), [props.aiReviewers], ) @@ -733,7 +727,7 @@ export const TableCheckpointSubmissions: FC = (props: Props) => { const columnsMobile = useMemo[][]>( () => columns.map( column => [ - { + column.label && { ...column, className: '', label: `${column.label as string} label`, @@ -748,9 +742,10 @@ export const TableCheckpointSubmissions: FC = (props: Props) => { }, { ...column, + colSpan: column.label ? 1 : 2, mobileType: 'last-value', }, - ] as MobileTableColumn[], + ].filter(Boolean) as MobileTableColumn[], ), [columns], ) diff --git a/src/apps/review/src/lib/components/TableIterativeReview/TableIterativeReview.tsx b/src/apps/review/src/lib/components/TableIterativeReview/TableIterativeReview.tsx index 4dfb6e92a..68e4a9ce8 100644 --- a/src/apps/review/src/lib/components/TableIterativeReview/TableIterativeReview.tsx +++ b/src/apps/review/src/lib/components/TableIterativeReview/TableIterativeReview.tsx @@ -1337,24 +1337,20 @@ export const TableIterativeReview: FC = (props: Props) => { baseColumns.push(reviewerColumn) } - if (props.aiReviewers) { - baseColumns.push({ - columnId: 'ai-reviews-table', - isExpand: true, - label: '', - renderer: (submission: SubmissionInfo, allRows: SubmissionInfo[]) => ( - props.aiReviewers && ( - - ) - ), - type: 'element', - }) - } + baseColumns.push({ + columnId: 'ai-reviews-table', + isExpand: true, + label: '', + renderer: (submission: SubmissionInfo, allRows: SubmissionInfo[]) => ( + + ), + type: 'element', + }) return baseColumns }, [ @@ -1375,7 +1371,7 @@ export const TableIterativeReview: FC = (props: Props) => { const columnsMobile = useMemo[][]>(() => ( (actionColumn ? [...columns, actionColumn] : columns).map(column => ([ - { + column.label && { ...column, className: '', label: `${column.label as string} label`, @@ -1390,9 +1386,10 @@ export const TableIterativeReview: FC = (props: Props) => { }, { ...column, + colSpan: column.label ? 1 : 2, mobileType: 'last-value', }, - ] as MobileTableColumn[])) + ].filter(Boolean) as MobileTableColumn[])) ), [actionColumn, columns]) return ( diff --git a/src/apps/review/src/lib/components/TableSubmissionScreening/TableSubmissionScreening.tsx b/src/apps/review/src/lib/components/TableSubmissionScreening/TableSubmissionScreening.tsx index 2d951f685..f09cc304b 100644 --- a/src/apps/review/src/lib/components/TableSubmissionScreening/TableSubmissionScreening.tsx +++ b/src/apps/review/src/lib/components/TableSubmissionScreening/TableSubmissionScreening.tsx @@ -789,40 +789,34 @@ export const TableSubmissionScreening: FC = (props: Props) => { }, [filteredChallengeSubmissions, props.screenings]) const aiReviewersColumn = useMemo | undefined>( - () => { - if (!props.aiReviewers?.length) { - return undefined - } - - return { - columnId: 'ai-reviews-table', - isExpand: true, - label: '', - renderer: ( - data: Screening, - allRows: Screening[], - ) => { - const submissionPayload = submissionMetaById.get(data.submissionId) ?? { - id: data.submissionId ?? '', - virusScan: data.virusScan, - } + () => ({ + columnId: 'ai-reviews-table', + isExpand: true, + label: '', + renderer: ( + data: Screening, + allRows: Screening[], + ) => { + const submissionPayload = submissionMetaById.get(data.submissionId) ?? { + id: data.submissionId ?? '', + virusScan: data.virusScan, + } - if (!submissionPayload?.id) { - return <> - } + if (!submissionPayload?.id) { + return <> + } - return ( - } - defaultOpen={allRows ? !allRows.indexOf(data) : false} - /> - ) - }, - type: 'element', - } as TableColumn - }, + return ( + } + defaultOpen={allRows ? !allRows.indexOf(data) : false} + /> + ) + }, + type: 'element', + } as TableColumn), [props.aiReviewers, submissionMetaById], ) @@ -1191,7 +1185,7 @@ export const TableSubmissionScreening: FC = (props: Props) => { const columnsMobile = useMemo[][]>( () => columns.map( column => [ - { + column.label && { ...column, className: '', label: `${column.label as string} label`, @@ -1206,9 +1200,10 @@ export const TableSubmissionScreening: FC = (props: Props) => { }, { ...column, + colSpan: column.label ? 1 : 2, mobileType: 'last-value', }, - ] as MobileTableColumn[], + ].filter(Boolean) as MobileTableColumn[], ), [columns], )