Skip to content

Commit da0cd51

Browse files
committed
fix: button sort
1 parent 9f3e91d commit da0cd51

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

pages/payments/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,8 @@ export default function Payments ({ user, userId }: PaybuttonsProps): React.Reac
146146
Header: () => (<div style={{ textAlign: 'right' }}>Amount</div>),
147147
accessor: 'amount',
148148
sortType: compareNumericString,
149-
Cell: ({ cell }) => {
150-
const original = cell.value
151-
const { networkId, amount } = original
149+
Cell: (cellProps) => {
150+
const { networkId, amount } = cellProps.cell.row.original.amount
152151
const networkTicker = NETWORK_TICKERS_FROM_ID[networkId]
153152
const formattedAmount = Number(amount).toLocaleString(undefined, {
154153
minimumFractionDigits: DECIMALS[networkTicker],

services/transactionService.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,10 @@ export async function fetchTransactionsByAddressListWithPagination (
151151
pageSize: number,
152152
orderBy?: string,
153153
orderDesc = true,
154-
networkIdsListFilter?: number[],
154+
networkIdsListFilter?: number[]
155155
): Promise<TransactionsWithPaybuttonsAndPrices[]> {
156-
157156
const orderDescString: Prisma.SortOrder = orderDesc ? 'desc' : 'asc'
158-
157+
159158
// Get query for orderBy that works with nested properties (e.g. `address.networkId`)
160159
let orderByQuery
161160
if (orderBy !== undefined && orderBy !== '') {
@@ -192,7 +191,7 @@ export async function fetchTransactionsByAddressListWithPagination (
192191
include: includePaybuttonsAndPrices,
193192
orderBy: orderByQuery,
194193
skip: page * pageSize,
195-
take: pageSize,
194+
take: pageSize
196195
})
197196
}
198197

@@ -578,7 +577,7 @@ export async function fetchTransactionsByPaybuttonIdWithPagination (
578577
pageSize,
579578
orderBy,
580579
orderDesc,
581-
networkIds);
580+
networkIds)
582581

583582
if (transactions.length === 0) {
584583
throw new Error(RESPONSE_MESSAGES.NO_TRANSACTION_FOUND_404.message)
@@ -705,6 +704,10 @@ export async function getPaymentsByUserIdOrderedByButtonName (
705704
})
706705
if (tx.amount > 0) {
707706
payments.push({
707+
amount: {
708+
amount: tx.amount,
709+
networkId: tx.networkId
710+
},
708711
timestamp: tx.timestamp,
709712
values: {
710713
values: ret,

0 commit comments

Comments
 (0)