Skip to content

Commit 12e22a4

Browse files
committed
update rendering for ai reviewers
1 parent f2ab320 commit 12e22a4

File tree

3 files changed

+28
-41
lines changed

3 files changed

+28
-41
lines changed

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,7 @@ export const TableCheckpointSubmissions: FC<Props> = (props: Props) => {
165165
)
166166

167167
const aiReviewsColumn = useMemo<TableColumn<Screening> | undefined>(
168-
() => {
169-
if (!props.aiReviewers?.length) {
170-
return undefined
171-
}
172-
173-
return {
168+
() => ({
174169
columnId: 'ai-reviews-table',
175170
isExpand: true,
176171
label: '',
@@ -187,15 +182,14 @@ export const TableCheckpointSubmissions: FC<Props> = (props: Props) => {
187182
return (
188183
<CollapsibleAiReviewsRow
189184
className={styles.aiReviews}
190-
aiReviewers={props.aiReviewers!}
185+
aiReviewers={props.aiReviewers ?? []}
191186
submission={submissionPayload}
192187
defaultOpen={allRows ? !allRows.indexOf(data) : false}
193188
/>
194189
)
195190
},
196191
type: 'element',
197-
} as TableColumn<Screening>
198-
},
192+
} as TableColumn<Screening>),
199193
[props.aiReviewers],
200194
)
201195

@@ -733,7 +727,7 @@ export const TableCheckpointSubmissions: FC<Props> = (props: Props) => {
733727
const columnsMobile = useMemo<MobileTableColumn<Screening>[][]>(
734728
() => columns.map(
735729
column => [
736-
{
730+
column.label && {
737731
...column,
738732
className: '',
739733
label: `${column.label as string} label`,
@@ -748,9 +742,10 @@ export const TableCheckpointSubmissions: FC<Props> = (props: Props) => {
748742
},
749743
{
750744
...column,
745+
colSpan: column.label ? 1 : 2,
751746
mobileType: 'last-value',
752747
},
753-
] as MobileTableColumn<Screening>[],
748+
].filter(Boolean) as MobileTableColumn<Screening>[],
754749
),
755750
[columns],
756751
)

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

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,24 +1337,20 @@ export const TableIterativeReview: FC<Props> = (props: Props) => {
13371337
baseColumns.push(reviewerColumn)
13381338
}
13391339

1340-
if (props.aiReviewers) {
1341-
baseColumns.push({
1342-
columnId: 'ai-reviews-table',
1343-
isExpand: true,
1344-
label: '',
1345-
renderer: (submission: SubmissionInfo, allRows: SubmissionInfo[]) => (
1346-
props.aiReviewers && (
1347-
<CollapsibleAiReviewsRow
1348-
className={styles.aiReviews}
1349-
aiReviewers={props.aiReviewers}
1350-
submission={submission as any}
1351-
defaultOpen={allRows ? !allRows.indexOf(submission) : false}
1352-
/>
1353-
)
1354-
),
1355-
type: 'element',
1356-
})
1357-
}
1340+
baseColumns.push({
1341+
columnId: 'ai-reviews-table',
1342+
isExpand: true,
1343+
label: '',
1344+
renderer: (submission: SubmissionInfo, allRows: SubmissionInfo[]) => (
1345+
<CollapsibleAiReviewsRow
1346+
className={styles.aiReviews}
1347+
aiReviewers={props.aiReviewers ?? []}
1348+
submission={submission as any}
1349+
defaultOpen={allRows ? !allRows.indexOf(submission) : false}
1350+
/>
1351+
),
1352+
type: 'element',
1353+
})
13581354

13591355
return baseColumns
13601356
}, [
@@ -1375,7 +1371,7 @@ export const TableIterativeReview: FC<Props> = (props: Props) => {
13751371

13761372
const columnsMobile = useMemo<MobileTableColumn<SubmissionInfo>[][]>(() => (
13771373
(actionColumn ? [...columns, actionColumn] : columns).map(column => ([
1378-
{
1374+
column.label && {
13791375
...column,
13801376
className: '',
13811377
label: `${column.label as string} label`,
@@ -1390,9 +1386,10 @@ export const TableIterativeReview: FC<Props> = (props: Props) => {
13901386
},
13911387
{
13921388
...column,
1389+
colSpan: column.label ? 1 : 2,
13931390
mobileType: 'last-value',
13941391
},
1395-
] as MobileTableColumn<SubmissionInfo>[]))
1392+
].filter(Boolean) as MobileTableColumn<SubmissionInfo>[]))
13961393
), [actionColumn, columns])
13971394

13981395
return (

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -789,12 +789,7 @@ export const TableSubmissionScreening: FC<Props> = (props: Props) => {
789789
}, [filteredChallengeSubmissions, props.screenings])
790790

791791
const aiReviewersColumn = useMemo<TableColumn<Screening> | undefined>(
792-
() => {
793-
if (!props.aiReviewers?.length) {
794-
return undefined
795-
}
796-
797-
return {
792+
() => ({
798793
columnId: 'ai-reviews-table',
799794
isExpand: true,
800795
label: '',
@@ -821,8 +816,7 @@ export const TableSubmissionScreening: FC<Props> = (props: Props) => {
821816
)
822817
},
823818
type: 'element',
824-
} as TableColumn<Screening>
825-
},
819+
} as TableColumn<Screening>),
826820
[props.aiReviewers, submissionMetaById],
827821
)
828822

@@ -1191,7 +1185,7 @@ export const TableSubmissionScreening: FC<Props> = (props: Props) => {
11911185
const columnsMobile = useMemo<MobileTableColumn<Screening>[][]>(
11921186
() => columns.map(
11931187
column => [
1194-
{
1188+
column.label && {
11951189
...column,
11961190
className: '',
11971191
label: `${column.label as string} label`,
@@ -1206,9 +1200,10 @@ export const TableSubmissionScreening: FC<Props> = (props: Props) => {
12061200
},
12071201
{
12081202
...column,
1203+
colSpan: column.label ? 1 : 2,
12091204
mobileType: 'last-value',
12101205
},
1211-
] as MobileTableColumn<Screening>[],
1206+
].filter(Boolean) as MobileTableColumn<Screening>[],
12121207
),
12131208
[columns],
12141209
)

0 commit comments

Comments
 (0)