Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -10,6 +10,13 @@
width: 100%;
border-collapse: collapse;

&.reviewsTable {
Copy link

Choose a reason for hiding this comment

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

[💡 maintainability]
The nested &.reviewsTable selector is redundant since it is already within the .reviewsTable block. Consider removing the nested selector to simplify the code.

tr:last-child {
td {
border-bottom: none;
}
}
}

&.reviewsTable thead tr th {
border-top: 1px solid #A8A8A8;
Expand All @@ -25,7 +32,7 @@
}

.scoreCol {
text-align: right;
text-align: left;
Copy link

Choose a reason for hiding this comment

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

[⚠️ readability]
Changing the text alignment of .scoreCol from right to left could impact the layout or readability of the table, especially if the column contains numerical data. Verify that this change aligns with the intended design and does not negatively affect the user interface.

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
}

.aiReviewerRow {
padding-bottom: 0;
@include ltelg {
tr:has(&) {
td:first-child {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ const AiFeedback: FC<AiFeedbackProps> = props => {
await createFeedbackComment(workflowId as string, workflowRun?.id as string, feedback?.id, {
content,
})
await mutate(`
${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items?[${workflowRun?.status}]
`)
// eslint-disable-next-line max-len
await mutate(`${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items?[${workflowRun?.status}]`)
setShowReply(false)
}, [workflowId, workflowRun?.id, feedback?.id])
}, [workflowId, workflowRun?.id, workflowRun?.status, feedback?.id])
Copy link

Choose a reason for hiding this comment

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

[⚠️ performance]
The dependency array for useCallback now includes workflowRun?.status. Ensure that this change is intentional and that onSubmitReply should indeed be re-created when workflowRun?.status changes. If not, this could lead to unnecessary re-renders.


if (!aiFeedbackItems?.length || !feedback) {
return <></>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,17 @@ export const AiFeedbackComment: FC<AiFeedbackCommentProps> = props => {
content,
parentId: comment.id,
})
await mutate(`
${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items?[${workflowRun?.status}]
`)
// eslint-disable-next-line max-len
await mutate(`${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items?[${workflowRun?.status}]`)
Copy link

Choose a reason for hiding this comment

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

[⚠️ correctness]
The mutate function is called with a URL that includes a query parameter with a potentially undefined value (workflowRun?.status). Consider adding a check to ensure workflowRun?.status is defined before constructing the URL to avoid potential issues with malformed URLs.

setShowReply(false)
}, [workflowId, workflowRun?.id, props.feedback?.id])

const onEditReply = useCallback(async (content: string, comment: AiFeedbackCommentType) => {
await updateRunItemComment(workflowId as string, workflowRun?.id as string, props.feedback?.id, comment.id, {
content,
})
await mutate(`
${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items?[${workflowRun?.status}]
`)
// eslint-disable-next-line max-len
await mutate(`${EnvironmentConfig.API.V6}/workflows/${workflowId}/runs/${workflowRun?.id}/items?[${workflowRun?.status}]`)
Copy link

Choose a reason for hiding this comment

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

[⚠️ correctness]
Similar to line 40, ensure that workflowRun?.status is defined before using it in the URL to prevent potential issues with malformed URLs.

setEditMode(false)
}, [workflowId, workflowRun?.id, props.feedback?.id])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,32 +41,30 @@ export const useReviewForm = ({
}, [isDirty, onFormChange])

useEffect(() => {
if (reviewItems?.length) {
const newFormData = {
reviews: reviewItems.map(
(reviewItem, reviewItemIndex) => ({
comments: 'reviewItemComments' in reviewItem ? reviewItem.reviewItemComments?.map(
(commentItem, commentIndex) => ({
content: commentItem.content ?? '',
id: commentItem.id,
index: commentIndex,
type: commentItem.type ?? '',
}),
) : [],
id: reviewItem.id,
index: reviewItemIndex,
initialAnswer: (
('finalAnswer' in reviewItem && reviewItem.finalAnswer)
|| ('initialAnswer' in reviewItem && reviewItem.initialAnswer)
|| ('questionScore' in reviewItem && reviewItem.questionScore)
|| undefined
) as string,
scorecardQuestionId: reviewItem.scorecardQuestionId,
}),
),
}
reset(newFormData)
const newFormData = {
Copy link

Choose a reason for hiding this comment

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

[⚠️ performance]
The removal of the check if (reviewItems?.length) before processing reviewItems could lead to unnecessary processing when reviewItems is an empty array. Consider re-adding the check to avoid unnecessary operations.

reviews: (reviewItems ?? []).map(
(reviewItem, reviewItemIndex) => ({
comments: 'reviewItemComments' in reviewItem ? reviewItem.reviewItemComments?.map(
(commentItem, commentIndex) => ({
content: commentItem.content ?? '',
id: commentItem.id,
index: commentIndex,
type: commentItem.type ?? '',
}),
) : [],
id: reviewItem.id,
index: reviewItemIndex,
initialAnswer: (
('finalAnswer' in reviewItem && reviewItem.finalAnswer)
|| ('initialAnswer' in reviewItem && reviewItem.initialAnswer)
|| ('questionScore' in reviewItem && reviewItem.questionScore)
|| undefined
) as string,
scorecardQuestionId: reviewItem.scorecardQuestionId,
}),
),
}
reset(newFormData)
}, [reviewItems, reset])

const touchedAllFields = useCallback(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

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

@include ltelg {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

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

@include ltelg {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@

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

@include ltelg {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@

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

@include ltelg {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@

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

@include ltelg {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@

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

@include ltelg {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@

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

@include ltelg {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@

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

@include ltelg {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ const AiReviewViewer: FC = () => {
challengeInfo,
}: ChallengeDetailContextModel = useChallengeDetailsContext()
const navigate = useAppNavigate()
const workflowRunIsFailed = [
Copy link

Choose a reason for hiding this comment

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

[💡 performance]
The use of includes with an array containing a single element is unnecessary. Consider using a direct comparison: workflowRun?.status === AiWorkflowRunStatusEnum.FAILURE.

AiWorkflowRunStatusEnum.FAILURE,
].includes(workflowRun?.status as AiWorkflowRunStatusEnum)

const tabItems: SelectOption[] = [
{
Expand All @@ -56,7 +59,7 @@ const AiReviewViewer: FC = () => {
label: 'Scorecard',
value: 'scorecard',
},
{ label: `Attachments (${totalCount ?? 0})`, value: 'attachments' },
{ label: `Attachments${workflowRunIsFailed ? '' : ` (${totalCount ?? 0})`}`, value: 'attachments' },
]
const isFailedRun = useMemo(() => (
workflowRun && [
Expand Down
14 changes: 2 additions & 12 deletions src/apps/wallet-admin/src/home/tabs/payments/PaymentsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ const ListView: FC<ListViewProps> = (props: ListViewProps) => {
if (updateObj.paymentStatus !== undefined) {
if (updateObj.paymentStatus === 'Owed') {
paymentStatus = 'OWED'
} else if (updateObj.paymentStatus === 'On Hold') {
} else if (updateObj.paymentStatus === 'On Hold (Admin)') {
paymentStatus = 'ON_HOLD_ADMIN'
} else if (updateObj.paymentStatus === 'Cancel') {
paymentStatus = 'CANCELLED'
Expand Down Expand Up @@ -267,24 +267,14 @@ const ListView: FC<ListViewProps> = (props: ListViewProps) => {
}, [fetchWinnings])

const onPaymentEditCallback = useCallback((payment: Winning) => {
let status = payment.status
if (status === 'On Hold (Admin)') {
status = 'On Hold'
} else if (['On Hold (Member)', 'On Hold (Tax Form)', 'On Hold (Payment Provider)'].indexOf(status) !== -1) {
status = 'Owed'
}

setConfirmFlow({
Copy link

Choose a reason for hiding this comment

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

[⚠️ correctness]
The removal of the status normalization logic might lead to inconsistencies in how payment statuses are handled. Ensure that the PaymentEditForm component correctly handles all possible status values without this normalization.

action: 'Save',
callback: async () => {
updatePayment(payment.id)
},
content: (
<PaymentEditForm
payment={{
...payment,
status,
}}
payment={payment}
canSave={setIsConfirmFormValid}
onValueUpdated={handleValueUpdated}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,16 @@ const PaymentEdit: React.FC<PaymentEditFormProps> = (props: PaymentEditFormProps

const options = useCallback(() => {
if (props.payment.status.toUpperCase() !== 'PAID') {
const isMemberHold = [
'On Hold (Member)',
'On Hold (Tax Form)',
'On Hold (Payment Provider)',
].includes(props.payment.status)

return [
Copy link

Choose a reason for hiding this comment

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

[⚠️ maintainability]
The use of props.payment.status directly in the options array could lead to inconsistencies if the status string changes elsewhere in the code. Consider using a constant or an enumeration for payment statuses to ensure consistency and reduce the risk of typos.

...(isMemberHold ? [{ label: props.payment.status, value: props.payment.status }] : []),
{ label: 'Owed', value: 'Owed' },
{ label: 'On Hold', value: 'On Hold' },
{ label: 'On Hold (Admin)', value: 'On Hold (Admin)' },
{ label: 'Cancel', value: 'Cancel' },
]
}
Expand Down
Loading