From c29f4917ba753381421984a0e833c40a35f63be1 Mon Sep 17 00:00:00 2001 From: katty barroso Date: Tue, 24 Sep 2024 10:12:38 +0200 Subject: [PATCH] Issuer details and bug fixes --- .../Charts/PoolPerformanceChart.tsx | 10 ++++-- .../src/components/IssuerSection.tsx | 33 ++++++++++++++++--- centrifuge-app/src/components/PoolList.tsx | 21 +++++++----- centrifuge-js/src/modules/pools.ts | 1 - fabric/.storybook/preview.jsx | 4 --- fabric/src/components/TextInput/index.tsx | 2 +- fabric/src/theme/tokens/theme.ts | 2 +- 7 files changed, 49 insertions(+), 24 deletions(-) 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/IssuerSection.tsx b/centrifuge-app/src/components/IssuerSection.tsx index 306555986..d0848fc2e 100644 --- a/centrifuge-app/src/components/IssuerSection.tsx +++ b/centrifuge-app/src/components/IssuerSection.tsx @@ -15,6 +15,7 @@ import { import * as React from 'react' import { useLocation } from 'react-router' import styled from 'styled-components' +import { formatPercentage } from '../utils/formatting' import { ExecutiveSummaryDialog } from './Dialogs/ExecutiveSummaryDialog' import { LabelValueStack } from './LabelValueStack' import { AnchorPillButton, PillButton } from './PillButton' @@ -113,6 +114,12 @@ export function IssuerDetails({ metadata }: IssuerSectionProps) { onClick: () => 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-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],