Skip to content

Commit

Permalink
Use new Centrifuge SDK in cashflow report (#2549)
Browse files Browse the repository at this point in the history
* Use Centrifuge SDK in cashflow report

* Remove unused cashflow chart files

* Fix asset purchases/asset financings

* Use first offical alpha release of sdk

* add new sdk to current app (#2579)

* Upgrade SDK

* Add hook

* Add formatting and utils

* Add to reports

* wip[

* Fix bugs based on new sdk release

* Add reports to query

* Remove console

* Fix formatting options

* Fix imports

* Fix formatting

* Fix percentage function

* Feedback changes

Move filter to sdk and specify the sdk version

* fix bug on report type

---------

Co-authored-by: Guillermo Perez <[email protected]>
Co-authored-by: Katty Barroso <[email protected]>
  • Loading branch information
3 people authored Feb 12, 2025
1 parent c862468 commit 3ff9903
Show file tree
Hide file tree
Showing 21 changed files with 5,231 additions and 4,963 deletions.
2 changes: 2 additions & 0 deletions centrifuge-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@centrifuge/centrifuge-js": "workspace:*",
"@centrifuge/centrifuge-react": "workspace:*",
"@centrifuge/fabric": "workspace:*",
"@centrifuge/sdk": "0.0.0-alpha.12",
"@makerdao/multicall": "^0.12.0",
"@polkadot/react-identicon": "~3.1.4",
"@styled-system/css": "^5.1.5",
Expand All @@ -48,6 +49,7 @@
"styled-components": "^5.3.5",
"styled-system": "^5.1.5",
"typescript": "~5.3.3",
"viem": "^2.21.53",
"vitest": "^1.2.1",
"ws": "^8.18.0"
},
Expand Down
226 changes: 0 additions & 226 deletions centrifuge-app/src/components/Charts/CashflowsChart.tsx

This file was deleted.

23 changes: 12 additions & 11 deletions centrifuge-app/src/components/Charts/SimpleBarChart.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { CurrencyBalance, CurrencyMetadata } from '@centrifuge/centrifuge-js'
import { Shelf, Text } from '@centrifuge/fabric'
import { CurrencyMetadata } from '@centrifuge/centrifuge-js'
import { Box, Shelf, Text } from '@centrifuge/fabric'
import { Bar, BarChart, CartesianGrid, ReferenceLine, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts'
import { useTheme } from 'styled-components'
import { formatDate } from '../../../src/utils/date'
import { formatBalance, formatBalanceAbbreviated } from '../../../src/utils/formatting'
import { formatBalance, formatBalanceAbbreviated } from '../../../src/utils/formatting-sdk'
import { LoadBoundary } from '../LoadBoundary'
import { CustomTick } from './PoolPerformanceChart'
import { TooltipContainer, TooltipTitle } from './Tooltip'
Expand Down Expand Up @@ -62,10 +62,7 @@ export const SimpleBarChart = ({ currency, data, groupBy }: SimpleBarChartProps)
angle={45}
/>
<YAxis
tickFormatter={(tick: number) => {
const balance = new CurrencyBalance(tick, currency?.decimals || 0)
return formatBalanceAbbreviated(balance, '', 0)
}}
tickFormatter={(tick: any) => formatBalanceAbbreviated(tick, 0)}
tick={{ fontSize: 10, color: theme.colors.textPrimary }}
tickLine={false}
axisLine={false}
Expand All @@ -79,10 +76,14 @@ export const SimpleBarChart = ({ currency, data, groupBy }: SimpleBarChartProps)
if (payload && payload?.length > 0) {
return (
<TooltipContainer>
<TooltipTitle>{formatDate(payload[0].payload.name)}</TooltipTitle>
{payload.map((item) => (
<Text variant="body3">{formatBalance(item.value as number, currency)}</Text>
))}
{payload.map((item) => {
return (
<Box>
<TooltipTitle>{formatDate(item.payload.name)}</TooltipTitle>
<Text variant="body3">{formatBalance(item.value ?? 0, 2, currency?.displayName)}</Text>
</Box>
)
})}
</TooltipContainer>
)
}
Expand Down
96 changes: 0 additions & 96 deletions centrifuge-app/src/components/PoolOverview/Cashflows.tsx

This file was deleted.

Loading

0 comments on commit 3ff9903

Please sign in to comment.