Skip to content

Conversation

@vas3a
Copy link
Collaborator

@vas3a vas3a commented Oct 28, 2025

Related JIRA Ticket:

https://topcoder.atlassian.net/browse/PM-1905

What's in this PR?

image image

Note: reviews details will be fetched only on row expand:
image

}

.workflowName {
max-width: 200px;

Choose a reason for hiding this comment

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

[💡 design]
The .workflowName class uses max-width: 200px with white-space: nowrap, overflow: hidden, and text-overflow: ellipsis. This combination will truncate text that exceeds 200px, which might not be suitable for all content. Consider whether this truncation is acceptable for all cases.

return (
<div className={styles.wrap}>
<table className={styles.reviewsTable}>
<tr>

Choose a reason for hiding this comment

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

[⚠️ readability]
The <tr> elements should be wrapped in a <thead> and <tbody> for better semantic HTML structure and accessibility.

<>
<MinusCircleIcon className='icon icon-xl' />
{' '}
Passed

Choose a reason for hiding this comment

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

[❗❗ correctness]
The text 'Passed' is used in both branches of the conditional rendering. It seems like a mistake since the icon suggests a different result. Consider changing the text in the else branch to 'Failed' or another appropriate term.

if (SUBMISSION_TAB_KEYS.has(selectedTabNormalized)) {
return renderSubmissionTab({
aiReviewers: (
challengeInfo?.reviewers?.filter(r => !!r.aiWorkflowId) as { aiWorkflowId: string }[]

Choose a reason for hiding this comment

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

[💡 maintainability]
The use of filter(r => !!r.aiWorkflowId) assumes that aiWorkflowId is the only property needed from reviewers. If additional properties are required in the future, this filtering logic might need to be updated. Consider whether this assumption is safe for future changes.

},
type: 'element',
},
...(!props.aiReviewers?.length ? [] : [{

Choose a reason for hiding this comment

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

[⚠️ correctness]
The propertyName for the 'Reviewer' column is set to 'submittedDate', which seems incorrect. This could lead to confusion or errors when accessing the column data. Consider using a more appropriate property name that reflects the column's purpose.

propertyName: 'submittedDate',
renderer: (submission: BackendSubmission) => (
<CollapsibleAiReviewsRow
aiReviewers={props.aiReviewers!}

Choose a reason for hiding this comment

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

[❗❗ correctness]
Using the non-null assertion operator ! on props.aiReviewers assumes that it is always defined when this code executes. If props.aiReviewers can be undefined, this could lead to runtime errors. Consider adding a check or default value to ensure safety.

text-align: left;
}

.reviewersDropown {

Choose a reason for hiding this comment

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

[💡 readability]
The class name .reviewersDropown appears to have a typo. It should likely be .reviewersDropdown for clarity and consistency.


.table {
margin-top: $sp-2;
margin-left: -1 * $sp-4;

Choose a reason for hiding this comment

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

[💡 readability]
Using -1 * $sp-4 for margin-left might be less clear than simply using -$sp-4. Consider simplifying the expression for better readability.


return (
<div className={styles.wrap}>
<span className={styles.reviewersDropown} onClick={toggleOpen}>

Choose a reason for hiding this comment

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

[⚠️ accessibility]
Consider adding role='button' and tabIndex='0' to the <span> to improve accessibility for keyboard users and screen readers.

{' '}
AI Reviewer
{aiReviewersCount === 1 ? '' : 's'}
<IconOutline.ChevronDownIcon className='icon-xl' />

Choose a reason for hiding this comment

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

[💡 usability]
Ensure that the ChevronDownIcon rotates when the dropdown is open to provide a visual cue to users.

}
}

.table .aiReviewersTableRow.aiReviewersTableRow {

Choose a reason for hiding this comment

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

[⚠️ maintainability]
The selector .table .aiReviewersTableRow.aiReviewersTableRow seems to have a duplicated class name. This could lead to confusion or unintended styling issues. Consider removing the duplicate class name.

[props.submissions],
)

const [toggledRows, setToggledRows] = useState(new Set<string>())

Choose a reason for hiding this comment

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

[❗❗ correctness]
Using useState with a Set can lead to unexpected behavior because React does not detect changes to the internal state of a Set. Consider using an array or another data structure that React can track changes to more effectively.

<span>-</span>
)}
</td>
{!!props.aiReviewers?.length && (

Choose a reason for hiding this comment

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

[⚠️ design]
The conditional rendering of the AI Reviewer column header is based on the presence of props.aiReviewers. If props.aiReviewers is undefined or an empty array, this column will not be rendered, which might lead to inconsistent table structures. Ensure that the table structure remains consistent regardless of the data.

</td>
</tr>
</tr>
{toggledRows.has(submission.id) && (

Choose a reason for hiding this comment

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

[⚠️ maintainability]
The colSpan value of 4 assumes a fixed number of columns. If the table structure changes, this could lead to layout issues. Consider dynamically calculating colSpan based on the number of columns to ensure future maintainability.

error: fetchError,
isValidating: isLoading,
}: SWRResponse<AiWorkflowRun[], Error> = useSWR<AiWorkflowRun[], Error>(
`${TC_API_BASE_URL}/workflows/${workflowIds.join(',')}/runs?submissionId=${submissionId}`,

Choose a reason for hiding this comment

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

[⚠️ performance]
The useSWR hook is using a custom fetcher function that makes multiple requests using Promise.all. This approach could lead to performance issues if workflowIds is large, as it will send all requests concurrently. Consider implementing a batching mechanism or limiting the number of concurrent requests to improve performance.

}
}

export function useFetchAiWorkflowsRuns(

Choose a reason for hiding this comment

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

[💡 maintainability]
The function name useFetchAiWorkflowsRuns is very similar to useFetchAiWorkflowRuns, which could lead to confusion. Consider renaming one of the functions to more clearly distinguish their purposes.

incrementalPayment: number
type: string
isAIReviewer: boolean
aiWorkflowId?: string;

Choose a reason for hiding this comment

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

[❗❗ correctness]
Changing isAIReviewer from a boolean to aiWorkflowId as an optional string alters the data model significantly. Ensure that all parts of the codebase that rely on this field are updated accordingly to handle the new type and potential undefined value. This change could impact logic that previously depended on a boolean check.

Copy link
Collaborator

@kkartunov kkartunov left a comment

Choose a reason for hiding this comment

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

Looks good

@kkartunov kkartunov merged commit 5060ce1 into feat/ai-workflows Nov 3, 2025
5 checks passed
@vas3a vas3a deleted the PM-1905_review-details-page branch November 4, 2025 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants