From 8bff1e6d24d75ee87eee04e7ab69e75efca7d797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nandy=20B=C3=A2?= Date: Sun, 15 Dec 2024 21:06:17 +0100 Subject: [PATCH 1/6] feat: add product type filter --- .../filters/AssetsViewFilterModal.tsx | 7 ++ .../filters/AssetsViewFilterType.tsx | 77 +++++++++++++++++++ .../assetsView/filters/useFilters.ts | 4 + .../assetsView/types/assetProduct.type.ts | 6 ++ src/components/assetsView/types/index.ts | 1 + src/states/index.ts | 3 + 6 files changed, 98 insertions(+) create mode 100644 src/components/assetsView/filters/AssetsViewFilterType.tsx create mode 100644 src/components/assetsView/types/assetProduct.type.ts diff --git a/src/components/assetsView/filters/AssetsViewFilterModal.tsx b/src/components/assetsView/filters/AssetsViewFilterModal.tsx index 8125e21e..06380a7c 100644 --- a/src/components/assetsView/filters/AssetsViewFilterModal.tsx +++ b/src/components/assetsView/filters/AssetsViewFilterModal.tsx @@ -12,6 +12,7 @@ import { assetsViewFilterAtom, } from 'src/states' +import { AssetsViewProductTypeFilter } from './AssetsViewFilterType' import { AssetsViewRentStatusFilter } from './AssetsViewRentStatusFilter' import { AssetsViewRmmStatusFilter } from './AssetsViewRmmStatusFilter' import { AssetsViewSort } from './AssetsViewSort' @@ -76,6 +77,12 @@ export const AssetsViewFilterModal: FC = ({ setFilterModel({ ...filterModel, ...value }) }} /> + { + setFilterModel({ ...filterModel, ...value }) + }} + /> { diff --git a/src/components/assetsView/filters/AssetsViewFilterType.tsx b/src/components/assetsView/filters/AssetsViewFilterType.tsx new file mode 100644 index 00000000..01b6a4fc --- /dev/null +++ b/src/components/assetsView/filters/AssetsViewFilterType.tsx @@ -0,0 +1,77 @@ +import { FC } from 'react' +import { useTranslation } from 'react-i18next' + +import { Select } from '@mantine/core' + +import { + RWARealtoken, + UserRealtoken, +} from 'src/store/features/wallets/walletsSelector' + +import { useInputStyles } from '../../inputs/useInputStyles' +import { AssetProductType } from '../types' + +interface AssetsViewFilterType { + productType: AssetProductType +} + +interface AssetsViewProductTypeFilterProps { + filter: AssetsViewFilterType + onChange: (value: AssetsViewFilterType) => void +} +export const AssetsViewProductTypeFilter: FC< + AssetsViewProductTypeFilterProps +> = ({ filter, onChange }) => { + const { t } = useTranslation('common', { keyPrefix: 'assetProduct' }) + const { classes: inputClasses } = useInputStyles() + + const viewOptions = [ + { + value: AssetProductType.ALL, + label: t('options.all'), + }, + { + value: AssetProductType.REAL_EASTATE_RENTAL, + label: t('options.realEstateRental'), + }, + { + value: AssetProductType.LOAN_INCOME, + label: t('options.loanIncome'), + }, + { + value: AssetProductType.EQUITY_TOKEN, + label: t('options.equityToken'), + }, + ] + + return ( +