-
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 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 |
|---|---|---|
|
|
@@ -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,40 +789,34 @@ export const TableSubmissionScreening: FC<Props> = (props: Props) => { | |
| }, [filteredChallengeSubmissions, props.screenings]) | ||
|
|
||
| const aiReviewersColumn = 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 = submissionMetaById.get(data.submissionId) ?? { | ||
| id: data.submissionId ?? '', | ||
| virusScan: data.virusScan, | ||
| } | ||
| () => ({ | ||
|
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: '', | ||
| 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 ( | ||
| <CollapsibleAiReviewsRow | ||
| className={styles.aiReviews} | ||
| aiReviewers={props.aiReviewers!} | ||
| submission={submissionPayload as Pick<BackendSubmission, 'id'|'virusScan'>} | ||
| defaultOpen={allRows ? !allRows.indexOf(data) : false} | ||
| /> | ||
| ) | ||
| }, | ||
| type: 'element', | ||
| } as TableColumn<Screening> | ||
| }, | ||
| 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 as Pick<BackendSubmission, 'id'|'virusScan'>} | ||
| 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, 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.
[💡
maintainability]The conditional check
column.label && { ... }can lead to a potential issue whereundefinedis included in the array, which is then filtered out. Consider restructuring this logic to avoid addingundefinedin the first place, which can improve readability and maintainability.