From f50574ab736df51c200197ac1ada577690389d0e Mon Sep 17 00:00:00 2001 From: Chase Fleming <1666730+chasefleming@users.noreply.github.com> Date: Fri, 8 Sep 2023 10:25:54 -0700 Subject: [PATCH] Add features filtering --- components/Features.tsx | 4 +++- components/ServiceCard.tsx | 4 +++- data/features.json | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 data/features.json diff --git a/components/Features.tsx b/components/Features.tsx index 6de69bdb..99f6da66 100644 --- a/components/Features.tsx +++ b/components/Features.tsx @@ -1,10 +1,12 @@ import { Box, HStack, Tag, Text, IconButton } from '@chakra-ui/react' import { CheckIcon } from '@chakra-ui/icons' import { useFCL } from '../hooks/useFCL' +import FEATURES_LIST from '../data/features.json' export default function Features() { const { clientConfig } = useFCL() - const suggestedFeatures = clientConfig?.discoveryFeaturesSuggested || [] + const featuresListKeys = FEATURES_LIST.map(f => f.name) + const suggestedFeatures = clientConfig?.discoveryFeaturesSuggested?.filter(f => featuresListKeys.includes(f)) || [] return ( diff --git a/components/ServiceCard.tsx b/components/ServiceCard.tsx index 4fcb7da0..cee54065 100644 --- a/components/ServiceCard.tsx +++ b/components/ServiceCard.tsx @@ -24,6 +24,7 @@ import { Service } from '../types' import { getProviderMetadataByAddress } from '../helpers/metadata' import { CheckIcon } from '@chakra-ui/icons' import { useMemo } from 'react' +import FEATURES_LIST from '../data/features.json' type Props = { isEnabled: boolean @@ -54,7 +55,8 @@ export default function ServiceCard({ appVersion, SUPPORTED_VERSIONS.SUGGESTED_FEATURES ) - const suggestedFeatures = clientConfig?.discoveryFeaturesSuggested || [] + const featuresListKeys = FEATURES_LIST.map(f => f.name) + const suggestedFeatures = clientConfig?.discoveryFeaturesSuggested?.filter(f => featuresListKeys.includes(f)) || [] const onSelect = () => { diff --git a/data/features.json b/data/features.json new file mode 100644 index 00000000..a08b78dd --- /dev/null +++ b/data/features.json @@ -0,0 +1,14 @@ +[ + { + "name": "self-custody", + "description": "Users manage their own keys, giving them full control of their crypto assets. Safekeeping responsibility rests with the user." + }, + { + "name": "hardware", + "description": "Keys are stored on a physical device, apart from online devices. This enhances security as keys are exposed online only during transactions." + }, + { + "name": "custodial", + "description": "Keys are held by the wallet. It's convenient but relies on the wallet's trustworthiness, and users don't have full control." + } +] \ No newline at end of file