From 097ba994f9fc2cd3685dc7227f0b522a29e29eba Mon Sep 17 00:00:00 2001 From: katty barroso Date: Wed, 18 Dec 2024 12:04:53 +0100 Subject: [PATCH 1/3] Fix quantity --- centrifuge-app/src/components/LoanList.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/centrifuge-app/src/components/LoanList.tsx b/centrifuge-app/src/components/LoanList.tsx index cb204e25b..4d10ac78a 100644 --- a/centrifuge-app/src/components/LoanList.tsx +++ b/centrifuge-app/src/components/LoanList.tsx @@ -293,7 +293,7 @@ export function LoanList({ loans, snapshots, isLoading }: Props) { View asset transactions ) } + export function getAmount(l: Row, pool: Pool | TinlakePool, format?: boolean) { switch (l.status) { case 'Closed': return format ? formatBalance(l.totalRepaid) : l.totalRepaid case 'Active': - if ('presentValue' in l) { - return format ? formatBalance(l.presentValue) : l.presentValue + if ('outstandingQuantity' in l.pricing) { + return format ? formatBalance(l.pricing.outstandingQuantity) : l.pricing.outstandingQuantity } if (l.outstandingDebt.isZero()) { From bbacc15a5c59dab804108f7b9430182e66c19314 Mon Sep 17 00:00:00 2001 From: katty barroso Date: Wed, 18 Dec 2024 12:11:09 +0100 Subject: [PATCH 2/3] Fix pagination --- centrifuge-app/src/components/LoanList.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/centrifuge-app/src/components/LoanList.tsx b/centrifuge-app/src/components/LoanList.tsx index 4d10ac78a..4a3d82169 100644 --- a/centrifuge-app/src/components/LoanList.tsx +++ b/centrifuge-app/src/components/LoanList.tsx @@ -244,8 +244,6 @@ export function LoanList({ loans, snapshots, isLoading }: Props) { ]), ].filter(Boolean) as Column[] - const pagination = usePagination({ data: rows, pageSize: 20 }) - const csvData = React.useMemo(() => { if (!rows.length) return undefined @@ -266,6 +264,8 @@ export function LoanList({ loans, snapshots, isLoading }: Props) { }, [rows, pool]) const csvUrl = React.useMemo(() => csvData && getCSVDownloadUrl(csvData as any), [csvData]) + const filteredData = isLoading ? [] : showRepaid ? rows : rows.filter((row) => !row.marketValue?.isZero()) + const pagination = usePagination({ data: filteredData, pageSize: 20 }) if (isLoading) return @@ -309,7 +309,7 @@ export function LoanList({ loans, snapshots, isLoading }: Props) { !row?.marketValue?.isZero())} + data={filteredData} columns={columns} onRowClicked={(row) => `${basePath}/${poolId}/assets/${row.id}`} pageSize={20} From 6fe9f0659548a0628c02d4cdeb1d32e5281cce27 Mon Sep 17 00:00:00 2001 From: katty barroso Date: Wed, 18 Dec 2024 14:56:34 +0100 Subject: [PATCH 3/3] Fix bug --- centrifuge-app/src/components/LoanList.tsx | 8 ++++++-- centrifuge-app/src/pages/Pool/Assets/index.tsx | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/centrifuge-app/src/components/LoanList.tsx b/centrifuge-app/src/components/LoanList.tsx index 4a3d82169..ae0ac1228 100644 --- a/centrifuge-app/src/components/LoanList.tsx +++ b/centrifuge-app/src/components/LoanList.tsx @@ -384,16 +384,20 @@ export function AssetName({ loan }: { loan: Pick { const amount = hasValuationMethod(loan.pricing) && loan.pricing.valuationMethod !== 'cash' - ? new CurrencyBalance(getAmount(loan as any, pool), pool.currency.decimals).toDecimal() + ? new CurrencyBalance(getAmount(loan as any, pool, false, true), pool.currency.decimals).toDecimal() : 0 return sum.add(amount)