Skip to content
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,49 +30,56 @@ export const TableRowDetails: <T extends { [propertyName: string]: any }>(
{props.columns.map((itemColumns, indexColumns) => (
<tr key={getKey([indexColumns])} className={classNames({})}>
{itemColumns.map(
(itemItemColumns, indexItemColumns) => (
<TableCell
{...itemItemColumns}
data={props.data}
index={0}
key={getKey([
indexColumns,
indexItemColumns,
])}
className={classNames(
itemItemColumns.className,
{
[styles.right]:
indexItemColumns
=== itemColumns.length - 1,
[styles.top]: indexColumns === 0,
[styles.topLeft]:
indexColumns === 0
&& indexItemColumns === 0,
[styles.topRight]:
indexColumns === 0
&& indexItemColumns
=== itemColumns.length - 1,
[styles.bottom]:
indexColumns
=== props.columns.length - 1,
[styles.bottomLeft]:
indexColumns
=== props.columns.length - 1
(itemItemColumns, indexItemColumns) => {
const { rowSpan: rowSpanOrFn, ...cellColumnProps } = itemItemColumns
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ performance]
The use of rowSpanOrFn as a function to determine rowSpan is flexible, but ensure that the function is performant and doesn't introduce unnecessary complexity or performance overhead, especially if props.data is large or complex.

const rowSpan = typeof rowSpanOrFn === 'function'
? rowSpanOrFn(props.data, 0, [props.data])
: rowSpanOrFn
return (
<TableCell
{...cellColumnProps}
rowSpan={rowSpan}
data={props.data}
index={0}
key={getKey([
indexColumns,
indexItemColumns,
])}
className={classNames(
itemItemColumns.className,
{
[styles.right]:
indexItemColumns
=== itemColumns.length - 1,
[styles.top]: indexColumns === 0,
[styles.topLeft]:
indexColumns === 0
&& indexItemColumns === 0,
[styles.bottomRight]:
indexColumns
=== props.columns.length - 1
[styles.topRight]:
indexColumns === 0
&& indexItemColumns
=== itemColumns.length - 1,
[styles.blockCellLabel]:
itemItemColumns.detailType
=== 'label',
},
styles.blockCell,
)}
/>
),
=== itemColumns.length - 1,
[styles.bottom]:
indexColumns
=== props.columns.length - 1,
[styles.bottomLeft]:
indexColumns
=== props.columns.length - 1
&& indexItemColumns === 0,
[styles.bottomRight]:
indexColumns
=== props.columns.length - 1
&& indexItemColumns
=== itemColumns.length - 1,
[styles.blockCellLabel]:
itemItemColumns.detailType
=== 'label',
},
styles.blockCell,
)}
/>
)
},
)}
</tr>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ const AiReviewsTable: FC<AiReviewsTableProps> = props => {
<table className={styles.reviewsTable}>
<thead>
<tr>
<th>AI Reviewer</th>
<th>Reviewer</th>
<th>Review Date</th>
<th>Min Score</th>
<th className={styles.scoreCol}>Score</th>
<th>Result</th>
</tr>
Expand All @@ -126,7 +127,7 @@ const AiReviewsTable: FC<AiReviewsTableProps> = props => {
<tbody>
{!runs.length && isLoading && (
<tr>
<td colSpan={4}>Loading...</td>
<td colSpan={5}>Loading...</td>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ maintainability]
The colSpan value was updated from 4 to 5 to accommodate the new 'Min Score' column. Ensure that this change is consistent with all other parts of the code where the table structure is used, especially in different responsive layouts, to avoid layout issues.

</tr>
)}

Expand All @@ -151,6 +152,9 @@ const AiReviewsTable: FC<AiReviewsTableProps> = props => {
.format(TABLE_DATE_FORMAT)
)}
</td>
<td>
{run.workflow?.scorecard?.minimumPassingScore ?? '-'}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ correctness]
The use of optional chaining (?.) with run.workflow?.scorecard?.minimumPassingScore is a good practice to prevent runtime errors if any of these properties are undefined. However, ensure that the default value '-' is appropriate for all contexts where this value might be displayed, as it might affect the user interface or data interpretation.

</td>
<td className={styles.scoreCol}>
{run.status === 'SUCCESS' ? (
run.workflow.id ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
width: 20px;
height: 20px;
border-radius: 10px;
border: 1px solid #e9ecef;
background: #fff;
align-items: center;
justify-content: center;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable complexity */
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ maintainability]
Disabling ESLint's complexity rule might hide potential maintainability issues. Consider refactoring the component to reduce complexity instead of disabling the rule.

/**
* Content of review tab.
*/
Expand Down Expand Up @@ -169,6 +170,10 @@ export const TabContentReview: FC<Props> = (props: Props) => {
() => !props.isActiveChallenge && normalizedSelectedTab === 'review',
[normalizedSelectedTab, props.isActiveChallenge],
)
const isCombinedReviewAppeals = useMemo(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[💡 performance]
The useMemo hook is used correctly here to memoize the isCombinedReviewAppeals value. However, ensure that the normalizedSelectedTab value is not expected to change frequently, as excessive use of useMemo can lead to unnecessary complexity.

() => normalizedSelectedTab === 'reviewappeals',
[normalizedSelectedTab],
)
const {
challengeInfo,
challengeSubmissions: backendChallengeSubmissions,
Expand Down Expand Up @@ -685,7 +690,7 @@ export const TabContentReview: FC<Props> = (props: Props) => {
return <TableLoading />
}

if (selectedTab === 'Appeals Response') {
if (!isCombinedReviewAppeals && selectedTab === 'Appeals Response') {
return (
<TableAppealsResponse
datas={resolvedReviewsWithSubmitter}
Expand All @@ -703,7 +708,7 @@ export const TabContentReview: FC<Props> = (props: Props) => {
return <TableNoRecord message='No reviews yet' />
}

if (selectedTab === 'Appeals') {
if (!isCombinedReviewAppeals && selectedTab === 'Appeals') {
return isSubmitterView ? (
<TableAppealsForSubmitter
datas={filteredSubmitterReviews}
Expand Down Expand Up @@ -741,6 +746,7 @@ export const TabContentReview: FC<Props> = (props: Props) => {
downloadSubmission={props.downloadSubmission}
mappingReviewAppeal={props.mappingReviewAppeal}
hideHandleColumn={hideHandleColumn}
mode={isCombinedReviewAppeals ? 'combined-review-appeals' : 'default'}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ correctness]
Passing the mode prop with a dynamic value is a good approach. Ensure that the TableReview component handles both 'combined-review-appeals' and 'default' modes correctly, especially if there are significant differences in behavior.

/>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
display: flex;
flex-direction: column;

&:global(.enhanced-table) table tbody tr:global(.row-before-expand) td[data-col-index='0'],
&:global(.enhanced-table) table tbody tr:global(.row-before-expand) td[data-col-index='1'] {
border-bottom: none !important;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ maintainability]
Using !important can make future maintenance difficult as it overrides other styles. Consider if !important is necessary here or if the specificity of the selector can be increased instead.

}

&:global(.enhanced-table) table tbody tr:not(:global(.expand-row)) td {
border-top: none !important;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ maintainability]
Using !important can make future maintenance difficult as it overrides other styles. Consider if !important is necessary here or if the specificity of the selector can be increased instead.

}

@include ltemd {
&:global(.enhanced-table) {
table {
Expand All @@ -17,6 +26,10 @@
}
}
}

&:global(.enhanced-table) table tbody tr:global(.expand-row):has(.aiReviews) td {
border-bottom: var(--TableBorderColor) solid 1px !important;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ maintainability]
Using !important can make future maintenance difficult as it overrides other styles. Consider if !important is necessary here or if the specificity of the selector can be increased instead.

}
}

.textBlue {
Expand Down Expand Up @@ -214,13 +227,11 @@
.aiReviews {
margin: $sp-2 0;
:global(.trigger) {
width: fit-content;
margin-left: auto;
margin-left: 16px;
}

:global(.reviews-table) {
margin-left: auto;
width: 60%;
margin-bottom: -9px;

@include ltelg {
Expand Down
Loading
Loading