diff --git a/centrifuge-app/src/assets/images/prime_page_image.svg b/centrifuge-app/src/assets/images/prime_page_image.svg new file mode 100644 index 0000000000..a64d1f53e1 --- /dev/null +++ b/centrifuge-app/src/assets/images/prime_page_image.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/centrifuge-app/src/components/AssetSummary.tsx b/centrifuge-app/src/components/AssetSummary.tsx index a3cb456af4..bfaa4f4021 100644 --- a/centrifuge-app/src/components/AssetSummary.tsx +++ b/centrifuge-app/src/components/AssetSummary.tsx @@ -1,4 +1,4 @@ -import { Shelf, Stack, Text } from '@centrifuge/fabric' +import { Box, Shelf, Stack, Text } from '@centrifuge/fabric' import * as React from 'react' import { useTheme } from 'styled-components' @@ -7,6 +7,7 @@ type Props = { label: React.ReactNode value: React.ReactNode heading: boolean + children?: React.ReactNode }[] children?: React.ReactNode } @@ -22,12 +23,17 @@ export function AssetSummary({ data, children }: Props) { mx={[2, 2, 2, 2, 5]} > - {data?.map(({ label, value, heading }, index) => ( + {data?.map(({ label, value, heading, children }, index) => ( {label} - {value} + + + {value} + + {children && children} + ))} {children} diff --git a/centrifuge-app/src/components/BackButton.tsx b/centrifuge-app/src/components/BackButton.tsx new file mode 100644 index 0000000000..e47b636cb0 --- /dev/null +++ b/centrifuge-app/src/components/BackButton.tsx @@ -0,0 +1,54 @@ +import { Box, IconArrowLeft, Text } from '@centrifuge/fabric' +import { ReactNode } from 'react' +import styled from 'styled-components' +import { RouterLinkButton } from './RouterLinkButton' + +const StyledRouterLinkButton = styled(RouterLinkButton)` + margin-left: 14px; + border-radius: 50%; + margin: 0px; + padding: 0px; + width: fit-content; + margin-left: 30px; + border: 4px solid transparent; + width: 30px; + height: 30px; + display: flex; + justify-content: center; + align-items: center; + + > span { + width: 34px; + border: 4px solid transparent; + } + &:hover { + background-color: ${({ theme }) => theme.colors.backgroundSecondary}; + span { + color: ${({ theme }) => theme.colors.textPrimary}; + } + } +` + +export const BackButton = ({ + to, + children, + label, + align, +}: { + to: string + children?: ReactNode + label: string + align?: string +}) => { + return ( + + } variant="tertiary" /> + + + {label} + + {children} + + + ) +} diff --git a/centrifuge-app/src/components/Charts/SimpleLineChart.tsx b/centrifuge-app/src/components/Charts/SimpleLineChart.tsx index 561af846c2..cea919dff6 100644 --- a/centrifuge-app/src/components/Charts/SimpleLineChart.tsx +++ b/centrifuge-app/src/components/Charts/SimpleLineChart.tsx @@ -1,11 +1,19 @@ import { CurrencyBalance, CurrencyMetadata } from '@centrifuge/centrifuge-js' -import { Card, Shelf, Stack, Text } from '@centrifuge/fabric' +import { Box, Card, Select, Shelf, Stack, Text } from '@centrifuge/fabric' +import { useState } from 'react' import { CartesianGrid, Line, LineChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts' import { useTheme } from 'styled-components' import { formatDate } from '../../utils/date' import { formatBalance, formatBalanceAbbreviated } from '../../utils/formatting' import { TooltipContainer, TooltipTitle } from './Tooltip' +const rangeFilters = [ + { value: '30d', label: '30 days' }, + { value: '90d', label: '90 days' }, + { value: 'ytd', label: 'Year to date' }, + { value: 'all', label: 'All' }, +] + type ChartData = { name: string yAxis: Number @@ -14,21 +22,65 @@ type ChartData = { interface Props { data: ChartData[] currency?: CurrencyMetadata + tooltip?: (value: any) => { value: any; label: string } + withFilters?: boolean + filters: { + type: 'default' | { value: string; label: string } + title: string + legend: [ + { + label: string + color: string + value: string + } + ] + } } -export const SimpleLineChart = ({ data, currency }: Props) => { +const Dot = ({ color }: { color: string }) => ( + +) + +// We use the chart for pages: asset, prime, portfolio +export const SimpleLineChart = ({ data, currency, tooltip, filters }: Props) => { const theme = useTheme() const chartColor = theme.colors.accentPrimary + const [range, setRange] = useState<(typeof rangeFilters)[number]>(rangeFilters[0]) + + const toggleRange = (e: React.ChangeEvent) => { + const value = e.target.value + const range = rangeFilters.find((range) => range.value === value) + setRange(range ?? rangeFilters[0]) + } + + console.log(data) + return ( + {filters && {filters.title}} + {filters && ( + + {filters.legend.map((legend) => ( + + + + + {legend.label} + + + {legend.value} + + ))} +