Skip to content

Commit

Permalink
Fix table sorting & download icon
Browse files Browse the repository at this point in the history
  • Loading branch information
kattylucy committed Nov 6, 2024
1 parent 14ded4b commit 1a21778
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
30 changes: 15 additions & 15 deletions centrifuge-app/src/components/LoanList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ export function LoanList({ loans }: Props) {
const { data: templateMetadata } = useMetadata<LoanTemplate>(templateId)

const additionalColumns: Column[] =
templateMetadata?.keyAttributes?.map((key) => {
templateMetadata?.keyAttributes?.map((key, index) => {
const attr = templateMetadata.attributes![key]
return {
align: 'left',
header: <SortableTableHeader label={attr.label} />,
cell: (l: Row) => <AssetMetadataField name={key} attribute={attr} loan={l} />,
sortKey: attr.label,
sortKey: attr.label.toLowerCase(),
}
}) || []

Expand Down Expand Up @@ -141,10 +141,10 @@ export function LoanList({ loans }: Props) {
align: 'left',
header: <SortableTableHeader label={isTinlakePool ? 'NFT ID' : 'Asset'} />,
cell: (l: Row) => <AssetName loan={l} />,
sortKey: 'idSortKey',
sortKey: 'id',
},
...(additionalColumns?.length
? additionalColumns.filter((attr) => attr.header !== 'Term')
? additionalColumns.filter((attr) => attr.sortKey !== 'term')
: [
{
align: 'left',
Expand All @@ -157,7 +157,7 @@ export function LoanList({ loans }: Props) {
? formatDate(l.originationDate)
: '-'
},
sortKey: 'originationDateSortKey',
sortKey: 'originationDate',
},
]),
...(hasMaturityDate
Expand All @@ -184,7 +184,7 @@ export function LoanList({ loans }: Props) {
align: 'left',
header: <SortableTableHeader label="Quantity" />,
cell: (l: Row) => <Amount loan={l} />,
sortKey: 'outstandingDebtSortKey',
sortKey: 'outstandingDebt',
},
]),
...(isTinlakePool
Expand All @@ -193,8 +193,8 @@ export function LoanList({ loans }: Props) {
{
align: 'left',
header: <SortableTableHeader label="Market price" />,
cell: (l: Row) => formatBalance(l.marketPrice ?? '', pool.currency, 2, 0),
sortKey: 'marketPriceSortKey',
cell: (l: Row) => formatBalance(l.marketPrice ?? 0, pool.currency, 2, 0),
sortKey: 'marketPrice',
},
]),
...(isTinlakePool
Expand All @@ -204,7 +204,7 @@ export function LoanList({ loans }: Props) {
align: 'left',
header: <SortableTableHeader label="Market value" />,
cell: (l: Row) => formatBalance(l.marketValue ?? 0, pool.currency, 2, 0),
sortKey: 'marketValueSortKey',
sortKey: 'marketValue',
},
]),
...(isTinlakePool
Expand All @@ -213,8 +213,8 @@ export function LoanList({ loans }: Props) {
{
align: 'left',
header: <SortableTableHeader label="Unrealized P&L" />,
cell: (l: Row) => formatBalance(l.unrealizedPL ?? '', pool.currency, 2, 0),
sortKey: 'unrealizedPLSortKey',
cell: (l: Row) => formatBalance(l.unrealizedPL ?? 0, pool.currency, 2, 0),
sortKey: 'unrealizedPL',
width: '140px',
},
]),
Expand All @@ -224,8 +224,8 @@ export function LoanList({ loans }: Props) {
{
align: 'left',
header: <SortableTableHeader label="Realized P&L" />,
cell: (l: Row) => formatBalance(l.realizedPL ?? '', pool.currency, 2, 0),
sortKey: 'realizedPLSortKey',
cell: (l: Row) => formatBalance(l.realizedPL ?? 0, pool.currency, 2, 0),
sortKey: 'realizedPL',
width: '140px',
},
]),
Expand All @@ -236,7 +236,7 @@ export function LoanList({ loans }: Props) {
align: 'left',
header: <SortableTableHeader label="Portfolio %" />,
cell: (l: Row) => formatPercentage(l.portfolioPercentage ?? 0, true, undefined, 1),
sortKey: 'portfolioSortKey',
sortKey: 'portfolioPercentage',
},
]),
].filter(Boolean) as Column[]
Expand All @@ -260,7 +260,7 @@ export function LoanList({ loans }: Props) {
'Portfolio %': loan.portfolioPercentage ? loan.portfolioPercentage : '-',
}
})
}, [rows])
}, [rows, pool])

const csvUrl = React.useMemo(() => csvData && getCSVDownloadUrl(csvData as any), [csvData])

Expand Down
2 changes: 1 addition & 1 deletion centrifuge-app/src/components/Tooltips.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ export const tooltipText = {
label: 'Expense ratio',
body: 'The operating expenses of the fund as a percentage of the total NAV',
},
totalNavMinus: {
totalNavMinusFees: {
label: 'Total NAV',
body: 'Total nav minus accrued fees',
},
Expand Down
6 changes: 2 additions & 4 deletions fabric/src/icon-svg/icon-download.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1a21778

Please sign in to comment.