From 8e17b32de7830b90788acccd6b48e4d31b3c01a2 Mon Sep 17 00:00:00 2001 From: Jordan Ribbink Date: Fri, 26 Jul 2024 13:21:08 -0700 Subject: [PATCH] Convert frontend to use `/api/wallets` --- components/GetWalletCard.tsx | 23 ++++++------ components/GetWalletList.tsx | 11 ++---- components/ServiceCard.tsx | 53 ++++++---------------------- components/ServiceGroup.tsx | 20 ++++------- components/ServiceList.tsx | 49 +++++++++++++------------ components/views/WalletSelection.tsx | 2 +- hooks/useLastUsedState.tsx | 9 ----- hooks/useWalletHistory.tsx | 26 ++++++++++++++ hooks/useWallets.ts | 7 ++-- 9 files changed, 85 insertions(+), 115 deletions(-) delete mode 100644 hooks/useLastUsedState.tsx create mode 100644 hooks/useWalletHistory.tsx diff --git a/components/GetWalletCard.tsx b/components/GetWalletCard.tsx index 2f97e9c3..0535b74d 100644 --- a/components/GetWalletCard.tsx +++ b/components/GetWalletCard.tsx @@ -7,22 +7,19 @@ import { HStack, Image, Stack, - Tag, Text, - Link, } from '@chakra-ui/react' -import { Service } from '../types' import NextLink from 'next/link' +import { Wallet } from '../data/wallets' type Props = { - icon: string - name: string - service: Service + wallet: Wallet } -export default function GetWalletCard({ icon, name, service }: Props) { - const isExtensionService = isExtension(service) - const isExtensionServiceInstalled = Boolean(service?.provider?.is_installed) +export default function GetWalletCard({ wallet }: Props) { + const extensionService = wallet.services.find(isExtension) + const isExtensionService = !!extensionService + const isExtensionServiceInstalled = extensionService?.provider?.is_installed return ( @@ -31,8 +28,8 @@ export default function GetWalletCard({ icon, name, service }: Props) { {name} - {name} + {wallet.name} {isExtensionService && !isExtensionServiceInstalled ? ( @@ -58,7 +55,7 @@ export default function GetWalletCard({ icon, name, service }: Props) { {/* TODO: Needs to link to install page, will be addressed in future PR */}