diff --git a/centrifuge-app/src/components/Charts/PoolPerformanceChart.tsx b/centrifuge-app/src/components/Charts/PoolPerformanceChart.tsx
index 5beb7254f..d1702e70e 100644
--- a/centrifuge-app/src/components/Charts/PoolPerformanceChart.tsx
+++ b/centrifuge-app/src/components/Charts/PoolPerformanceChart.tsx
@@ -432,14 +432,12 @@ function CustomLegend({
color: 'textGold',
label: 'Junior APY',
value: formatPercentage(data.juniorAPY ?? 0),
- type: 'singleTrancheTokenPrice',
show: true,
},
{
color: 'textPrimary',
label: 'Senior APY',
value: formatPercentage(data.seniorAPY ?? 0),
- type: 'singleTrancheTokenPrice',
show: !!data.seniorAPY,
},
]
@@ -461,7 +459,13 @@ function CustomLegend({
-
+ {item.type ? (
+
+ ) : (
+
+ {item.label}
+
+ )}
{item.value}
diff --git a/centrifuge-app/src/components/Charts/PriceChart.tsx b/centrifuge-app/src/components/Charts/PriceChart.tsx
index 48dde0ce7..65b1d1051 100644
--- a/centrifuge-app/src/components/Charts/PriceChart.tsx
+++ b/centrifuge-app/src/components/Charts/PriceChart.tsx
@@ -1,4 +1,4 @@
-import { Box, Select, Shelf, Stack, Text } from '@centrifuge/fabric'
+import { Box, Select, Shelf, Stack, StatusChip, Text } from '@centrifuge/fabric'
import React from 'react'
import { Area, AreaChart, CartesianGrid, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts'
import { useTheme } from 'styled-components'
@@ -34,10 +34,12 @@ export const PriceChart = ({ data, currency, filter, setFilter }: PriceChartProp
)}
{priceDifference && (
-
- {' '}
- {priceDifference.gte(0) ? '+' : ''} {priceDifference.mul(100).toFixed(2)}%
-
+
+
+ {' '}
+ {priceDifference.gte(0) ? '+' : ''} {priceDifference.mul(100).toFixed(2)}%
+
+
)}
{filter && setFilter && (
@@ -50,6 +52,7 @@ export const PriceChart = ({ data, currency, filter, setFilter }: PriceChartProp
]}
onChange={(option) => setFilter(option.target.value as FilterOptions)}
defaultValue={filter}
+ hideBorder
/>
)}
@@ -57,9 +60,9 @@ export const PriceChart = ({ data, currency, filter, setFilter }: PriceChartProp
-
-
-
+
+
+
} />
@@ -102,7 +105,7 @@ export const PriceChart = ({ data, currency, filter, setFilter }: PriceChartProp
fill="url(#colorPrice)"
name="Price"
activeDot={{ fill: '#908f8f' }}
- stroke="#908f8f"
+ stroke={theme.colors.textGold}
/>
diff --git a/centrifuge-app/src/components/InvestRedeem/InvestRedeem.tsx b/centrifuge-app/src/components/InvestRedeem/InvestRedeem.tsx
index d08cd07e6..d0c86a1b7 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 1b222a8e5..6711df0f0 100644
--- a/centrifuge-app/src/components/InvestRedeem/InvestRedeemDrawer.tsx
+++ b/centrifuge-app/src/components/InvestRedeem/InvestRedeemDrawer.tsx
@@ -1,10 +1,20 @@
-import { Box, Drawer, Stack, Text } from '@centrifuge/fabric'
+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,35 +27,8 @@ export function InvestRedeemDrawer({
poolId: string
trancheId: string
defaultView?: 'invest' | 'redeem'
-}) {
- return (
-
-
-
-
-
-
-
- Price
-
-
-
-
-
-
-
- )
-}
-
-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') {
@@ -72,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) {
@@ -90,6 +113,8 @@ const TokenPriceChart = React.memo(function TokenPriceChart({
return tokenData
}, [dailyPoolStates, pool?.tranches, trancheId])
+ if (!data.length) return
+
return (
setIsDialogOpen(true),
},
]
+
+ const formatCamelCase = (text: string | undefined) => {
+ if (!text) return
+ return text.replace(/([A-Z])/g, ' $1').replace(/^./, (str) => str.toUpperCase())
+ }
+
return (
@@ -127,11 +134,27 @@ export function IssuerDetails({ metadata }: IssuerSectionProps) {
)}
-
- {metadata?.pool?.name}
-
- {metadata?.pool?.issuer.description}
-
+
+
+ {metadata?.pool?.issuer.name}
+
+ {metadata?.pool?.issuer.description}
+
+
+ {metadata?.pool?.issuer?.categories?.length ? (
+
+ {metadata?.pool?.issuer?.categories.map((category) => (
+
+
+ {formatCamelCase(category.customType) || formatCamelCase(category.type)}
+
+
+ {category.type.includes('Rate') ? formatPercentage(category.value) : category.value}
+
+
+ ))}
+
+ ) : null}
{!metadataIsLoading && archivedPools.length > 0 && (
<>
- setShowArchived((show) => !show)}
- variant="body2"
- >
- {showArchived ? 'Hide archived pools' : 'View archived pools >'}
-
+
+ setShowArchived((show) => !show)}
+ variant="body2"
+ >
+ {showArchived ? 'Hide archived pools' : 'View archived pools'}
+
+ {!showArchived && }
+
{showArchived && }
>
)}
diff --git a/centrifuge-app/src/components/Portfolio/Transactions.tsx b/centrifuge-app/src/components/Portfolio/Transactions.tsx
index 4887b7d43..653012ef0 100644
--- a/centrifuge-app/src/components/Portfolio/Transactions.tsx
+++ b/centrifuge-app/src/components/Portfolio/Transactions.tsx
@@ -13,6 +13,7 @@ import {
usePagination,
} from '@centrifuge/fabric'
import * as React from 'react'
+import { useTheme } from 'styled-components'
import { TransactionTypeChip } from '../../components/Portfolio/TransactionTypeChip'
import { formatDate } from '../../utils/date'
import { getCSVDownloadUrl } from '../../utils/getCSVDownloadUrl'
@@ -43,6 +44,7 @@ type Row = {
export function Transactions({ onlyMostRecent, narrow, txTypes, address, trancheId }: TransactionsProps) {
const explorer = useGetExplorerUrl()
+ const theme = useTheme()
const columns = [
{
align: 'left',
@@ -206,7 +208,7 @@ export function Transactions({ onlyMostRecent, narrow, txTypes, address, tranche
) : (
-
+
No transactions displayed yet
diff --git a/centrifuge-js/src/modules/pools.ts b/centrifuge-js/src/modules/pools.ts
index 7518ef8c2..9dd6e73b5 100644
--- a/centrifuge-js/src/modules/pools.ts
+++ b/centrifuge-js/src/modules/pools.ts
@@ -2693,7 +2693,6 @@ export function getPoolsModule(inst: Centrifuge) {
: new Perquintill(0),
}
})
- console.log('🚀 ~ tranches:', tranches)
return { ...state, poolState, poolValue, tranches }
}) || [],
trancheStates,
diff --git a/fabric/.storybook/preview.jsx b/fabric/.storybook/preview.jsx
index 24da97cb2..3bfd399dd 100644
--- a/fabric/.storybook/preview.jsx
+++ b/fabric/.storybook/preview.jsx
@@ -1,13 +1,9 @@
import * as React from 'react'
import { ThemeProvider } from 'styled-components'
import { Box, GlobalStyle } from '../src'
-import altairDark from '../src/theme/altairDark'
-import altairLight from '../src/theme/altairLight'
import centrifugeTheme from '../src/theme/centrifugeTheme'
const themes = {
- altairDark,
- altairLight,
centrifugeTheme,
}
diff --git a/fabric/src/components/TextInput/index.tsx b/fabric/src/components/TextInput/index.tsx
index b3b95086b..49d98d7ca 100644
--- a/fabric/src/components/TextInput/index.tsx
+++ b/fabric/src/components/TextInput/index.tsx
@@ -54,7 +54,7 @@ export const StyledInputBox = styled(Shelf)<{ hideBorder?: boolean }>`
position: relative;
background: ${({ theme }) => theme.colors.backgroundPage};
border: ${({ hideBorder, theme }) => (hideBorder ? 'none' : `1px solid ${theme.colors.borderPrimary}`)};
- border-radius: ${({ theme }) => theme.radii.input}px;
+ border-radius: ${({ hideBorder, theme }) => (hideBorder ? 'none' : `${theme.radii.input}px`)};
&::before {
content: '';
diff --git a/fabric/src/theme/tokens/theme.ts b/fabric/src/theme/tokens/theme.ts
index 593c03e47..ebb7bf98a 100644
--- a/fabric/src/theme/tokens/theme.ts
+++ b/fabric/src/theme/tokens/theme.ts
@@ -102,7 +102,7 @@ const colors = {
backgroundButtonInvertedHover: grayScale[100],
backgroundButtonInvertedPressed: grayScale[100],
backgroundButtonInvertedDisabled: grayScale[100],
- textButtonInverted: grayScale[600],
+ textButtonInverted: black,
textButtonInvertedFocus: grayScale[600],
textButtonInvertedHover: grayScale[600],
textButtonInvertedPressed: grayScale[600],