Skip to content

Commit

Permalink
WIP investment position table
Browse files Browse the repository at this point in the history
  • Loading branch information
kattylucy committed Jan 9, 2025
1 parent e9f428f commit de85de2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 29 deletions.
2 changes: 2 additions & 0 deletions centrifuge-app/src/components/Portfolio/usePortfolio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ export function usePortfolioTokens(address?: string) {
const pools = usePools()
const portfolioData = usePortfolio(address)

console.log(pools)

const trancheTokenPrices = pools?.reduce(
(tranches, pool) =>
pool.tranches.reduce((tranches, tranche) => {
Expand Down
34 changes: 5 additions & 29 deletions centrifuge-app/src/pages/Prime/Detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import { useParams } from 'react-router'
import { useTheme } from 'styled-components'
import { AssetSummary } from '../../../src/components/AssetSummary'
import { BackButton } from '../../../src/components/BackButton'
import { LayoutSection } from '../../../src/components/LayoutBase/LayoutSection'
import { CardPortfolioValue } from '../../../src/components/Portfolio/CardPortfolioValue'
import { useDailyPortfolioValue } from '../../../src/components/Portfolio/usePortfolio'
import { config } from '../../../src/config'
import { Dec } from '../../../src/utils/Decimal'
import { formatBalance, formatBalanceAbbreviated } from '../../../src/utils/formatting'
import { useTransactionsByAddress } from '../../../src/utils/usePools'
import { useHoldings } from '../../components/Portfolio/Holdings'
import { formatBalance } from '../../../src/utils/formatting'
import { Holdings, useHoldings } from '../../components/Portfolio/Holdings'
import { useDAOConfig } from '../../utils/useDAOConfig'

export default function PrimeDetailPage() {
Expand All @@ -32,29 +31,6 @@ const PrimeDetail = () => {

const tokens = useHoldings(centAddress)
const currentPortfolioValue = tokens.reduce((sum, token) => sum.add(token.position.mul(token.tokenPrice)), Dec(0))
const transactions = useTransactionsByAddress(centAddress)
const dailyPortfolioValue = useDailyPortfolioValue(centAddress ?? '', 90)

const chartData = dailyPortfolioValue?.map((day) => ({
name: day.dateInMilliseconds,
yAxis: day.portfolioValue.toNumber(),
}))

const filters = {
type: 'default',
title: 'Overview',
legend: [
{
label: 'Portfolio value',
color: 'textGold',
value: '1,523.00',
},
],
}

const valueFormatter = (value: any) => {
return { value: formatBalanceAbbreviated(value.yAxis, '', 2), label: 'Portfolio Value' }
}

return !isLoading && dao && centAddress ? (
<Stack mx={1} my={1}>
Expand Down Expand Up @@ -92,10 +68,10 @@ const PrimeDetail = () => {
<CardPortfolioValue address={centAddress} />
</Box>

{/* <LayoutSection title="Holdings" pt={12} pb={12}>
<LayoutSection title="Holdings" pt={12} pb={12}>
<Holdings address={centAddress} showActions={false} />
</LayoutSection>
<LayoutSection title="Transaction history" pt={12} pb={12}>
{/* <LayoutSection title="Transaction history" pt={12} pb={12}>
<Transactions onlyMostRecent address={centAddress} />
</LayoutSection>
<Resolutions dao={dao} /> */}
Expand Down

0 comments on commit de85de2

Please sign in to comment.