diff --git a/centrifuge-app/src/components/InvestRedeem/InvestRedeem.tsx b/centrifuge-app/src/components/InvestRedeem/InvestRedeem.tsx
index d08cd07e68..d0c86a1b73 100644
--- a/centrifuge-app/src/components/InvestRedeem/InvestRedeem.tsx
+++ b/centrifuge-app/src/components/InvestRedeem/InvestRedeem.tsx
@@ -187,7 +187,9 @@ function Footer() {
<>
{state.actingAddress && connectedType === 'substrate' && (
- Transaction history
+
+ Transaction history
+
)}
diff --git a/centrifuge-app/src/components/InvestRedeem/InvestRedeemDrawer.tsx b/centrifuge-app/src/components/InvestRedeem/InvestRedeemDrawer.tsx
index a82ce8a813..6711df0f07 100644
--- a/centrifuge-app/src/components/InvestRedeem/InvestRedeemDrawer.tsx
+++ b/centrifuge-app/src/components/InvestRedeem/InvestRedeemDrawer.tsx
@@ -1,10 +1,20 @@
import { Drawer, Stack, Text } from '@centrifuge/fabric'
+import Decimal from 'decimal.js-light'
import * as React from 'react'
import { useDailyPoolStates, usePool } from '../../utils/usePools'
import { FilterOptions, PriceChart } from '../Charts/PriceChart'
import { LoadBoundary } from '../LoadBoundary'
import { InvestRedeem } from './InvestRedeem'
+type TrancheState = {
+ price: Decimal | any
+}
+
+type DailyPoolStateProps = {
+ timestamp: string
+ tranches: { [trancheId: string]: TrancheState }
+}
+
export function InvestRedeemDrawer({
poolId,
trancheId,
@@ -17,33 +27,8 @@ export function InvestRedeemDrawer({
poolId: string
trancheId: string
defaultView?: 'invest' | 'redeem'
-}) {
- return (
-
-
-
-
-
-
-
- Performance
-
-
-
-
-
- )
-}
-
-const TokenPriceChart = React.memo(function TokenPriceChart({
- poolId,
- trancheId,
-}: {
- poolId: string
- trancheId: string
}) {
const [filter, setFilter] = React.useState('30days')
- const pool = usePool(poolId)
const dateFrom = React.useMemo(() => {
if (filter === 'YTD') {
@@ -70,9 +55,49 @@ const TokenPriceChart = React.memo(function TokenPriceChart({
const { poolStates: dailyPoolStates } = useDailyPoolStates(poolId, new Date(dateFrom)) || {}
+ if (!dailyPoolStates?.length) return
+
+ return (
+
+
+
+
+
+
+
+ Performance
+
+
+
+
+
+ )
+}
+
+const TokenPriceChart = React.memo(function TokenPriceChart({
+ poolId,
+ trancheId,
+ dailyPoolStates,
+ filter,
+ setFilter,
+}: {
+ poolId: string
+ trancheId: string
+ dailyPoolStates: DailyPoolStateProps[]
+ filter: FilterOptions | undefined
+ setFilter: any
+}) {
+ const pool = usePool(poolId)
+
const data = React.useMemo(() => {
const tokenData =
- dailyPoolStates?.map((state) => {
+ dailyPoolStates?.map((state: DailyPoolStateProps) => {
return { price: state.tranches[trancheId].price?.toFloat() || 0, day: new Date(state.timestamp) }
}) || []
if (tokenData.length > 0) {
@@ -88,6 +113,8 @@ const TokenPriceChart = React.memo(function TokenPriceChart({
return tokenData
}, [dailyPoolStates, pool?.tranches, trancheId])
+ if (!data.length) return
+
return (
) : (
-
+
No transactions displayed yet