Skip to content

Commit 1e8138b

Browse files
committed
fix(wallet-admin): disable editing cancelled challenges
Signed-off-by: Rakib Ansary <rakibansary@topcoder.com>
1 parent 835cbed commit 1e8138b

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/apps/wallet-admin/src/home/tabs/payments/PaymentsTab.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function formatStatus(status: string): string {
3232
case 'PAID':
3333
return 'Paid'
3434
case 'CANCELLED':
35-
return 'Cancelled'
35+
return 'Cancel'
3636
default:
3737
return status.replaceAll('_', ' ')
3838
}
@@ -116,6 +116,11 @@ const ListView: FC<ListViewProps> = (props: ListViewProps) => {
116116
formattedReleaseDate = formatIOSDateString(payment.releaseDate)
117117
}
118118

119+
let status = formatStatus(payment.details[0].status)
120+
if (status === 'Cancel') {
121+
status = 'Cancelled'
122+
}
123+
119124
return {
120125
createDate: formatIOSDateString(payment.createdAt),
121126
currency: payment.details[0].currency,
@@ -129,7 +134,7 @@ const ListView: FC<ListViewProps> = (props: ListViewProps) => {
129134
netPaymentNumber: parseFloat(payment.details[0].totalAmount),
130135
releaseDate: formattedReleaseDate,
131136
releaseDateObj: releaseDate,
132-
status: formatStatus(payment.details[0].status),
137+
status,
133138
type: payment.category.replaceAll('_', ' ')
134139
.toLowerCase(),
135140
}

src/apps/wallet-admin/src/lib/components/payments-table/PaymentTable.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable max-len */
12
/* eslint-disable react/jsx-no-bind */
23
/* eslint-disable @typescript-eslint/explicit-function-return-type */
34
import React, { useEffect, useState } from 'react'
@@ -59,7 +60,7 @@ const PaymentsTable: React.FC<PaymentTableProps> = (props: PaymentTableProps) =>
5960
<td>{payment.releaseDate}</td>
6061
<td>{payment.datePaid}</td>
6162
<td className={styles.actionButtons}>
62-
{props.canEdit && payment.status.toUpperCase() !== 'PAID' && (
63+
{props.canEdit && payment.status.toUpperCase() !== 'PAID' && payment.status.toUpperCase() !== 'CANCELLED' && (
6364
<Button
6465
icon={IconOutline.PencilIcon}
6566
size='sm'

0 commit comments

Comments
 (0)