Skip to content

Commit

Permalink
move headers and columns outside of component
Browse files Browse the repository at this point in the history
  • Loading branch information
Hornebom committed Aug 21, 2023
1 parent 1cf06e0 commit 270ed4c
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions centrifuge-app/src/components/Report/AssetList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,29 @@ import type { TableDataRow } from './index'
import { ReportContext } from './ReportContext'
import { UserFeedback } from './UserFeedback'

const headers = [
'ID',
'Status',
'Collateral value',
'Outstanding',
'Total financed',
'Total repaid',
'Financing date',
'Maturity date',
'Financing fee',
'Advance rate',
'PD',
'LGD',
'Discount rate',
]

const columns = headers.map((col, index) => ({
align: 'left',
header: col,
cell: (row: TableDataRow) => <Text variant="body2">{(row.value as any)[index]}</Text>,
flex: index === 0 ? '0 0 50px' : '0 0 120px',
}))

export function AssetList({ pool }: { pool: Pool }) {
const loans = useLoans(pool.id) as Loan[]
const { setCsvData, startDate, endDate } = React.useContext(ReportContext)
Expand Down Expand Up @@ -53,29 +76,6 @@ export function AssetList({ pool }: { pool: Pool }) {
}))
}, [loans, pool.currency.symbol])

const headers = [
'ID',
'Status',
'Collateral value',
'Outstanding',
'Total financed',
'Total repaid',
'Financing date',
'Maturity date',
'Financing fee',
'Advance rate',
'PD',
'LGD',
'Discount rate',
]

const columns = headers.map((col, index) => ({
align: 'left',
header: col,
cell: (row: TableDataRow) => <Text variant="body2">{(row.value as any)[index]}</Text>,
flex: index === 0 ? '0 0 50px' : '0 0 120px',
}))

const dataUrl = React.useMemo(() => {
if (!data.length) {
return
Expand Down

0 comments on commit 270ed4c

Please sign in to comment.