From b7366554d78c087f6f20725170420f0d7b8f608c Mon Sep 17 00:00:00 2001 From: Vladan Date: Wed, 13 Dec 2023 14:07:29 +0100 Subject: [PATCH] fix: metamask migration dialog --- .../MetamaskCreateAccount.tsx | 2 +- .../MetamaskMigrationDialog.tsx | 4 +++- src/context/FdpStorageContext.tsx | 21 ++++++++++++------- src/styles/globals.scss | 8 +++---- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/components/Dialogs/MetamaskMigrationDialog/MetamaskCreateAccount.tsx b/src/components/Dialogs/MetamaskMigrationDialog/MetamaskCreateAccount.tsx index 444301d1..5baf0125 100644 --- a/src/components/Dialogs/MetamaskMigrationDialog/MetamaskCreateAccount.tsx +++ b/src/components/Dialogs/MetamaskMigrationDialog/MetamaskCreateAccount.tsx @@ -97,7 +97,7 @@ export default function MetamaskCreateAccount({ await fdpClientRef.current.account.register(request); setWallet(fdpClientRef.current.account.wallet); - setFdpStorageType('native'); + setFdpStorageType('native', undefined, false); setIsLoggedIn(true); setLoginType('username'); setUser(username); diff --git a/src/components/Dialogs/MetamaskMigrationDialog/MetamaskMigrationDialog.tsx b/src/components/Dialogs/MetamaskMigrationDialog/MetamaskMigrationDialog.tsx index 997c187d..b0791063 100644 --- a/src/components/Dialogs/MetamaskMigrationDialog/MetamaskMigrationDialog.tsx +++ b/src/components/Dialogs/MetamaskMigrationDialog/MetamaskMigrationDialog.tsx @@ -55,7 +55,9 @@ const MetamaskMigrationDialog = ({ if (clickOutside) { return; } - setMetamaskMigrationNotification('closed'); + setMetamaskMigrationNotification( + step === Step.COMPLETE ? 'completed' : 'closed' + ); onClose(); }; diff --git a/src/context/FdpStorageContext.tsx b/src/context/FdpStorageContext.tsx index 59d8ab16..db12b716 100644 --- a/src/context/FdpStorageContext.tsx +++ b/src/context/FdpStorageContext.tsx @@ -70,7 +70,8 @@ interface FdpStorageContext { setWallet: (wallet: Wallet) => void; setFdpStorageType: ( type: FDP_STORAGE_TYPE, - config?: FdpContracts.EnsEnvironment + config?: FdpContracts.EnsEnvironment, + create?: boolean ) => void; setFdpStorageConfig: (config: FdpContracts.EnsEnvironment) => void; setUsername: (username: string) => void; @@ -153,15 +154,19 @@ function FdpStorageProvider(props: FdpStorageContextProps) { */ const setFdpStorageType = ( type: FDP_STORAGE_TYPE, - config?: FdpContracts.EnsEnvironment + config?: FdpContracts.EnsEnvironment, + create = true ) => { - if (type === 'native') { - fdpClientRef.current = createFdpStorage(config); - } else if (type === 'blossom') { - fdpClientRef.current = blossom.fdpStorage; - } else { - throw new Error('Unknown FDP storage type'); + if (create) { + if (type === 'native') { + fdpClientRef.current = createFdpStorage(config); + } else if (type === 'blossom') { + fdpClientRef.current = blossom.fdpStorage; + } else { + throw new Error('Unknown FDP storage type'); + } } + setIsLoggedIn(false); setStorageType(type); }; diff --git a/src/styles/globals.scss b/src/styles/globals.scss index 9ec3f679..17330da6 100644 --- a/src/styles/globals.scss +++ b/src/styles/globals.scss @@ -305,11 +305,9 @@ scrollbar-width: none; /* Firefox */ } -.light { - .blurred-text { - color: transparent; - text-shadow: 0 0 5px rgba(0, 0, 0, 0.5); - } +.blurred-text { + color: transparent; + text-shadow: 0 0 5px rgba(0, 0, 0, 0.5); } .dark {