-
Notifications
You must be signed in to change notification settings - Fork 21
update rendering for ai reviewers #1350
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 1 commit
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 |
|---|---|---|
|
|
@@ -165,12 +165,7 @@ export const TableCheckpointSubmissions: FC<Props> = (props: Props) => { | |
| ) | ||
|
|
||
| const aiReviewsColumn = useMemo<TableColumn<Screening> | undefined>( | ||
| () => { | ||
| if (!props.aiReviewers?.length) { | ||
| return undefined | ||
| } | ||
|
|
||
| return { | ||
| () => ({ | ||
| columnId: 'ai-reviews-table', | ||
| isExpand: true, | ||
| label: '', | ||
|
|
@@ -187,15 +182,14 @@ export const TableCheckpointSubmissions: FC<Props> = (props: Props) => { | |
| return ( | ||
| <CollapsibleAiReviewsRow | ||
| className={styles.aiReviews} | ||
| aiReviewers={props.aiReviewers!} | ||
| aiReviewers={props.aiReviewers ?? []} | ||
| submission={submissionPayload} | ||
| defaultOpen={allRows ? !allRows.indexOf(data) : false} | ||
| /> | ||
| ) | ||
| }, | ||
| type: 'element', | ||
| } as TableColumn<Screening> | ||
| }, | ||
| } as TableColumn<Screening>), | ||
| [props.aiReviewers], | ||
| ) | ||
|
|
||
|
|
@@ -733,7 +727,7 @@ export const TableCheckpointSubmissions: FC<Props> = (props: Props) => { | |
| const columnsMobile = useMemo<MobileTableColumn<Screening>[][]>( | ||
| () => columns.map( | ||
| column => [ | ||
| { | ||
| column.label && { | ||
|
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. [💡 |
||
| ...column, | ||
| className: '', | ||
| label: `${column.label as string} label`, | ||
|
|
@@ -748,9 +742,10 @@ export const TableCheckpointSubmissions: FC<Props> = (props: Props) => { | |
| }, | ||
| { | ||
| ...column, | ||
| colSpan: column.label ? 1 : 2, | ||
| mobileType: 'last-value', | ||
| }, | ||
| ] as MobileTableColumn<Screening>[], | ||
| ].filter(Boolean) as MobileTableColumn<Screening>[], | ||
| ), | ||
| [columns], | ||
| ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1337,24 +1337,20 @@ 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} | ||
| /> | ||
| ) | ||
| ), | ||
| type: 'element', | ||
| }) | ||
| } | ||
| baseColumns.push({ | ||
| columnId: 'ai-reviews-table', | ||
| isExpand: true, | ||
| label: '', | ||
| renderer: (submission: SubmissionInfo, allRows: SubmissionInfo[]) => ( | ||
| <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={submission as any} | ||
| defaultOpen={allRows ? !allRows.indexOf(submission) : false} | ||
| /> | ||
| ), | ||
| type: 'element', | ||
| }) | ||
|
|
||
| return baseColumns | ||
| }, [ | ||
|
|
@@ -1375,7 +1371,7 @@ export const TableIterativeReview: FC<Props> = (props: Props) => { | |
|
|
||
| const columnsMobile = useMemo<MobileTableColumn<SubmissionInfo>[][]>(() => ( | ||
| (actionColumn ? [...columns, actionColumn] : columns).map(column => ([ | ||
| { | ||
| column.label && { | ||
|
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. [ |
||
| ...column, | ||
| className: '', | ||
| label: `${column.label as string} label`, | ||
|
|
@@ -1390,9 +1386,10 @@ export const TableIterativeReview: FC<Props> = (props: Props) => { | |
| }, | ||
| { | ||
| ...column, | ||
| colSpan: column.label ? 1 : 2, | ||
| mobileType: 'last-value', | ||
| }, | ||
| ] as MobileTableColumn<SubmissionInfo>[])) | ||
| ].filter(Boolean) as MobileTableColumn<SubmissionInfo>[])) | ||
| ), [actionColumn, columns]) | ||
|
|
||
| return ( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -789,12 +789,7 @@ export const TableSubmissionScreening: FC<Props> = (props: Props) => { | |
| }, [filteredChallengeSubmissions, props.screenings]) | ||
|
|
||
| const aiReviewersColumn = useMemo<TableColumn<Screening> | undefined>( | ||
| () => { | ||
| if (!props.aiReviewers?.length) { | ||
| return undefined | ||
| } | ||
|
|
||
| return { | ||
| () => ({ | ||
|
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. [ |
||
| columnId: 'ai-reviews-table', | ||
| isExpand: true, | ||
| label: '', | ||
|
|
@@ -821,8 +816,7 @@ export const TableSubmissionScreening: FC<Props> = (props: Props) => { | |
| ) | ||
| }, | ||
| type: 'element', | ||
| } as TableColumn<Screening> | ||
| }, | ||
| } as TableColumn<Screening>), | ||
| [props.aiReviewers, submissionMetaById], | ||
| ) | ||
|
|
||
|
|
@@ -1191,7 +1185,7 @@ export const TableSubmissionScreening: FC<Props> = (props: Props) => { | |
| const columnsMobile = useMemo<MobileTableColumn<Screening>[][]>( | ||
| () => columns.map( | ||
| column => [ | ||
| { | ||
| column.label && { | ||
|
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. [💡 |
||
| ...column, | ||
| className: '', | ||
| label: `${column.label as string} label`, | ||
|
|
@@ -1206,9 +1200,10 @@ export const TableSubmissionScreening: FC<Props> = (props: Props) => { | |
| }, | ||
| { | ||
| ...column, | ||
| colSpan: column.label ? 1 : 2, | ||
| mobileType: 'last-value', | ||
| }, | ||
| ] as MobileTableColumn<Screening>[], | ||
| ].filter(Boolean) as MobileTableColumn<Screening>[], | ||
| ), | ||
| [columns], | ||
| ) | ||
|
|
||
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]Using the nullish coalescing operator (
??) to defaultaiReviewersto an empty array is a good practice. However, ensure that the rest of the codebase correctly handles an empty array foraiReviewersto avoid unintended behavior.