From cdec1d246a255f3196bba8d17435befb57c187fc Mon Sep 17 00:00:00 2001 From: Leo Unoki Date: Thu, 28 Sep 2023 19:23:11 +0900 Subject: [PATCH] Remove useDeriveAccountModal --- src/views/home/AccountsList.tsx | 44 +++++---------------------------- 1 file changed, 6 insertions(+), 38 deletions(-) diff --git a/src/views/home/AccountsList.tsx b/src/views/home/AccountsList.tsx index e5934e945c..2a5abbf12f 100644 --- a/src/views/home/AccountsList.tsx +++ b/src/views/home/AccountsList.tsx @@ -1,16 +1,6 @@ -import { - Box, - Button, - Flex, - Heading, - Modal, - ModalContent, - Text, - useDisclosure, - useToast, -} from "@chakra-ui/react"; +import { Box, Button, Flex, Heading, Text, useToast } from "@chakra-ui/react"; import { compact, groupBy } from "lodash"; -import { useContext, useRef } from "react"; +import { useContext } from "react"; import { BsWindowPlus } from "react-icons/bs"; import KeyIcon from "../../assets/icons/Key"; import { DynamicModalContext } from "../../components/DynamicModal"; @@ -54,7 +44,6 @@ const AccountGroup: React.FC<{ const first = accounts[0]; const isMultisig = first.type === AccountType.MULTISIG; const isMnemonic = first.type === AccountType.MNEMONIC; - const { element: deriveAccountModal, onOpen: openDeriveAccountModal } = useDeriveAccountModal(); const { openWith, onClose } = useContext(DynamicModalContext); const removeMnemonic = useRemoveMnemonic(); const removeNonMnemonic = useRemoveNonMnemonic(); @@ -79,12 +68,14 @@ const AccountGroup: React.FC<{ /> ); }; + const onDerive = () => { if (!isMnemonic) { throw new Error(`Can't derive a non mnemonic account!`); } - openDeriveAccountModal({ fingerprint: first.seedFingerPrint }); + openWith(); }; + return ( @@ -92,7 +83,7 @@ const AccountGroup: React.FC<{ {groupLabel} - {isMultisig ? null : ( + {!isMultisig && ( )} @@ -108,7 +99,6 @@ const AccountGroup: React.FC<{ /> ); })} - {deriveAccountModal} ); }; @@ -212,25 +202,3 @@ const DeriveAccount = (props: { onDone: () => void; fingerprint: string }) => { /> ); }; - -export const useDeriveAccountModal = () => { - const { isOpen, onOpen, onClose } = useDisclosure(); - - const paramsRef = useRef<{ fingerprint: string }>(); - - return { - element: ( - - - {paramsRef.current?.fingerprint && ( - - )} - - - ), - onOpen: (params: { fingerprint: string }) => { - paramsRef.current = params; - onOpen(); - }, - }; -};