From b1fc5fb4bcf2bed634a90697d57d04eb66e62448 Mon Sep 17 00:00:00 2001 From: katty barroso Date: Mon, 21 Oct 2024 12:27:47 +0200 Subject: [PATCH 1/4] Adjust filters with new design --- .../src/components/Report/DataFilter.tsx | 348 ++++++++---------- 1 file changed, 163 insertions(+), 185 deletions(-) diff --git a/centrifuge-app/src/components/Report/DataFilter.tsx b/centrifuge-app/src/components/Report/DataFilter.tsx index 6b146626b..98eea2fa7 100644 --- a/centrifuge-app/src/components/Report/DataFilter.tsx +++ b/centrifuge-app/src/components/Report/DataFilter.tsx @@ -1,6 +1,6 @@ import { Loan, Pool } from '@centrifuge/centrifuge-js' import { useGetNetworkName } from '@centrifuge/centrifuge-react' -import { AnchorButton, Box, DateInput, IconDownload, SearchInput, Select, Shelf } from '@centrifuge/fabric' +import { DateInput, Grid, SearchInput, Select } from '@centrifuge/fabric' import * as React from 'react' import { useNavigate } from 'react-router' import { useIsAboveBreakpoint } from '../../../src/utils/useIsAboveBreakpoint' @@ -64,7 +64,7 @@ export function DataFilter({ poolId }: ReportFilterProps) { ] return ( - - - - - ) => { + const { value } = event.target + if (value) { + navigate(`${basePath}/${pool.id}/data/${value}`) + } + }} + /> - {['pool-balance', 'token-price'].includes(report) && ( - - setLoanStatus(event.target.value)} - /> - - )} - - {(report === 'investor-list' || report === 'investor-tx') && ( - - setLoan(event.target.value)} - value={loan} - options={[ - { label: 'All', value: 'all' }, - ...(loans?.map((l) => ({ - value: l.id, - label: , - })) ?? []), - ]} - /> - - )} + {['pool-balance', 'token-price'].includes(report) && ( + { - if (event.target.value) { - setTxType(event.target.value) - } - }} - /> - - )} + {report === 'asset-list' && ( + ({ - label: getNetworkName(domain.chainId), - value: String(domain.chainId), - })), - ]} - value={network} - onChange={(e) => { - const { value } = e.target - if (value) { - setNetwork(isNaN(Number(value)) ? value : Number(value)) - } - }} - /> - - - )} - + {(report === 'investor-list' || report === 'investor-tx') && ( + setLoan(event.target.value)} + value={loan} + options={[ + { label: 'All', value: 'all' }, + ...(loans?.map((l) => ({ + value: l.id, + label: , + })) ?? []), + ]} + /> + )} - } - small - variant="inverted" - style={{ marginLeft: '12px', marginTop: '22px' }} - > - Download - - - + {['investor-tx', 'asset-tx', 'fee-tx'].includes(report) && ( + ({ + label: getNetworkName(domain.chainId), + value: String(domain.chainId), + })), + ]} + value={network} + onChange={(e) => { + const { value } = e.target + if (value) { + setNetwork(isNaN(Number(value)) ? value : Number(value)) + } + }} + /> )} - + {['investor-tx', 'investor-list'].includes(report) && ( + setAddress(e.target.value)} + /> + )} + + setStartDate(e.target.value)} /> + setEndDate(e.target.value)} /> + ) } @@ -278,3 +242,17 @@ function LoanOption({ loan }: { loan: Loan }) { ) } + +{ + /* } +small +variant="inverted" +style={{ marginLeft: '12px', marginTop: '22px' }} +> +Download + */ +} From 314ea69fce90a2bb2d3248156b82f8141c2bd65d Mon Sep 17 00:00:00 2001 From: katty barroso Date: Mon, 21 Oct 2024 13:03:02 +0200 Subject: [PATCH 2/4] Add formatted date --- .../src/components/Report/DataFilter.tsx | 352 +++++++++--------- 1 file changed, 180 insertions(+), 172 deletions(-) diff --git a/centrifuge-app/src/components/Report/DataFilter.tsx b/centrifuge-app/src/components/Report/DataFilter.tsx index 98eea2fa7..e85fdf5d4 100644 --- a/centrifuge-app/src/components/Report/DataFilter.tsx +++ b/centrifuge-app/src/components/Report/DataFilter.tsx @@ -1,9 +1,9 @@ import { Loan, Pool } from '@centrifuge/centrifuge-js' import { useGetNetworkName } from '@centrifuge/centrifuge-react' -import { DateInput, Grid, SearchInput, Select } from '@centrifuge/fabric' +import { AnchorButton, Box, DateInput, Grid, IconDownload, SearchInput, Select, Stack, Text } from '@centrifuge/fabric' import * as React from 'react' import { useNavigate } from 'react-router' -import { useIsAboveBreakpoint } from '../../../src/utils/useIsAboveBreakpoint' +import { formatDate } from '../../../src/utils/date' import { usePool } from '../../../src/utils/usePools' import { nftMetadataSchema } from '../../schemas' import { useBasePath } from '../../utils/useBasePath' @@ -45,7 +45,6 @@ export function DataFilter({ poolId }: ReportFilterProps) { const navigate = useNavigate() const basePath = useBasePath() const pool = usePool(poolId) as Pool - const isMedium = useIsAboveBreakpoint('M') const { data: domains } = useActiveDomains(pool.id) const getNetworkName = useGetNetworkName() @@ -64,172 +63,195 @@ export function DataFilter({ poolId }: ReportFilterProps) { ] return ( - - { - if (event.target.value) { - setGroupBy(event.target.value as GroupBy) + name="data" + label="Data" + options={reportOptions} + value={report} + onChange={(event: React.ChangeEvent) => { + const { value } = event.target + if (value) { + navigate(`${basePath}/${pool.id}/data/${value}`) } }} /> - )} - {report === 'asset-list' && ( - { + if (event.target.value) { + setGroupBy(event.target.value as GroupBy) + } + }} + /> + )} - {(report === 'investor-list' || report === 'investor-tx') && ( - setLoanStatus(event.target.value)} + /> + )} - {report === 'asset-tx' && ( - ({ + label: token.currency.name, + value: token.id, + })), + ]} + value={activeTranche} + onChange={(event) => { + if (event.target.value) { + setActiveTranche(event.target.value) + } + }} + /> + )} - {['investor-tx', 'asset-tx', 'fee-tx'].includes(report) && ( - setLoan(event.target.value)} + value={loan} + options={[ + { label: 'All', value: 'all' }, + ...(loans?.map((l) => ({ + value: l.id, + label: , + })) ?? []), + ]} + /> + )} - {['investor-tx', 'investor-list'].includes(report) && ( - - )} - {['investor-tx', 'investor-list'].includes(report) && ( - setAddress(e.target.value)} - /> - )} + value={txType} + onChange={(event) => { + if (event.target.value) { + setTxType(event.target.value) + } + }} + /> + )} + + {['investor-tx', 'investor-list'].includes(report) && ( +