From bb3c85dfe1acceb53dd3bc11c0cb29c1160ab7b7 Mon Sep 17 00:00:00 2001 From: zzggo Date: Thu, 19 Dec 2024 17:06:19 +1100 Subject: [PATCH] fixed: remove duplicate component, fixed text --- src/ui/FRWComponent/LandingPages/AllSet.tsx | 19 +- .../Welcome/AccountImport/GoogleBackup.tsx | 170 ------------------ .../Welcome/AccountImport/index.tsx | 2 +- .../Welcome/Register/GoogleBackup.tsx | 170 ------------------ .../LandingPages/Welcome/Register/index.tsx | 2 +- 5 files changed, 5 insertions(+), 358 deletions(-) delete mode 100644 src/ui/views/LandingPages/Welcome/AccountImport/GoogleBackup.tsx delete mode 100644 src/ui/views/LandingPages/Welcome/Register/GoogleBackup.tsx diff --git a/src/ui/FRWComponent/LandingPages/AllSet.tsx b/src/ui/FRWComponent/LandingPages/AllSet.tsx index 65e79495..9fd30c2b 100644 --- a/src/ui/FRWComponent/LandingPages/AllSet.tsx +++ b/src/ui/FRWComponent/LandingPages/AllSet.tsx @@ -36,19 +36,6 @@ const AllSet = ({ handleSwitchTab, variant = 'register' }: AllSetProps) => { } }, [variant, loadScript, usewallet]); - const getMessage = () => { - if (variant === 'recover') { - return { - title: chrome.i18n.getMessage('You__are') + ' ' + chrome.i18n.getMessage('all__set'), - subtitle: chrome.i18n.getMessage('Start__exploring__with__Lilico__now'), - }; - } - return { - title: chrome.i18n.getMessage('You__are') + chrome.i18n.getMessage('Allset'), - subtitle: chrome.i18n.getMessage('You_can_start_experiencing_Lilico_now'), - }; - }; - return ( <> @@ -57,13 +44,13 @@ const AllSet = ({ handleSwitchTab, variant = 'register' }: AllSetProps) => { image={AllSetIcon} /> - {getMessage().title.split(' ')[0]} + {chrome.i18n.getMessage('You__are')} - {getMessage().title.split(' ')[1]} + {' ' + chrome.i18n.getMessage('all__set')} - {getMessage().subtitle} + {chrome.i18n.getMessage('You_can_start_experiencing_Lilico_now')} diff --git a/src/ui/views/LandingPages/Welcome/AccountImport/GoogleBackup.tsx b/src/ui/views/LandingPages/Welcome/AccountImport/GoogleBackup.tsx deleted file mode 100644 index e29d08cc..00000000 --- a/src/ui/views/LandingPages/Welcome/AccountImport/GoogleBackup.tsx +++ /dev/null @@ -1,170 +0,0 @@ -import InfoIcon from '@mui/icons-material/Info'; -import { Button, Typography } from '@mui/material'; -import { Box } from '@mui/system'; -import React, { useState } from 'react'; - -import SlideRelative from '@/ui/FRWComponent/SlideRelative'; -import { LLSpinner } from 'ui/FRWComponent'; -import { useWallet } from 'ui/utils'; - -import IconGoogleDrive from '../../../../../components/iconfont/IconGoogleDrive'; - -const GoogleBackup = ({ handleSwitchTab, mnemonic, username, password }) => { - const wallets = useWallet(); - const [loading, setLoading] = useState(false); - const [backupErr, setBackupErr] = useState(false); - - const handleBackup = () => { - try { - setLoading(true); - setBackupErr(false); - wallets - .uploadMnemonicToGoogleDrive(mnemonic, username, password) - .then(() => { - setLoading(false); - handleSwitchTab(); - }) - .catch(() => { - setLoading(false); - setBackupErr(true); - }); - } catch (e) { - console.error(e); - setLoading(false); - } - }; - return ( - <> - - - {chrome.i18n.getMessage('Create')} - - {chrome.i18n.getMessage('Back_up')} - - - - {chrome.i18n.getMessage('Back_up_your_wallet_to_Google_Drive_for_easy_access')} - - - - - {chrome.i18n.getMessage('Recommend')} - - - - - {chrome.i18n.getMessage('Connect__To')} - - {chrome.i18n.getMessage('Google__Drive')} - - {chrome.i18n.getMessage('to_back_up_your_wallet')} - - - - - - - - {/* */} - - - {chrome.i18n.getMessage( - 'Backup_failed_you_may_still_conduct_backup_inside_extension' - )} - - - - - - - - - ); -}; - -export default GoogleBackup; diff --git a/src/ui/views/LandingPages/Welcome/AccountImport/index.tsx b/src/ui/views/LandingPages/Welcome/AccountImport/index.tsx index 5d407b9b..40b79d10 100644 --- a/src/ui/views/LandingPages/Welcome/AccountImport/index.tsx +++ b/src/ui/views/LandingPages/Welcome/AccountImport/index.tsx @@ -4,6 +4,7 @@ import { useHistory } from 'react-router-dom'; import { getHashAlgo, getSignAlgo } from '@/shared/utils/algo'; import AllSet from '@/ui/FRWComponent/LandingPages/AllSet'; +import GoogleBackup from '@/ui/FRWComponent/LandingPages/GoogleBackup'; import LandingComponents from '@/ui/FRWComponent/LandingPages/LandingComponents'; import PickUsername from '@/ui/FRWComponent/LandingPages/PickUsername'; import SetPassword from '@/ui/FRWComponent/LandingPages/SetPassword'; @@ -11,7 +12,6 @@ import { useNavigation } from '@/ui/utils/landingPage'; import { storage } from 'background/webapi'; import { useWallet } from 'ui/utils'; -import GoogleBackup from './GoogleBackup'; import ImportTabs from './ImportTabs'; import RecoverPassword from './RecoverPassword'; diff --git a/src/ui/views/LandingPages/Welcome/Register/GoogleBackup.tsx b/src/ui/views/LandingPages/Welcome/Register/GoogleBackup.tsx deleted file mode 100644 index e29d08cc..00000000 --- a/src/ui/views/LandingPages/Welcome/Register/GoogleBackup.tsx +++ /dev/null @@ -1,170 +0,0 @@ -import InfoIcon from '@mui/icons-material/Info'; -import { Button, Typography } from '@mui/material'; -import { Box } from '@mui/system'; -import React, { useState } from 'react'; - -import SlideRelative from '@/ui/FRWComponent/SlideRelative'; -import { LLSpinner } from 'ui/FRWComponent'; -import { useWallet } from 'ui/utils'; - -import IconGoogleDrive from '../../../../../components/iconfont/IconGoogleDrive'; - -const GoogleBackup = ({ handleSwitchTab, mnemonic, username, password }) => { - const wallets = useWallet(); - const [loading, setLoading] = useState(false); - const [backupErr, setBackupErr] = useState(false); - - const handleBackup = () => { - try { - setLoading(true); - setBackupErr(false); - wallets - .uploadMnemonicToGoogleDrive(mnemonic, username, password) - .then(() => { - setLoading(false); - handleSwitchTab(); - }) - .catch(() => { - setLoading(false); - setBackupErr(true); - }); - } catch (e) { - console.error(e); - setLoading(false); - } - }; - return ( - <> - - - {chrome.i18n.getMessage('Create')} - - {chrome.i18n.getMessage('Back_up')} - - - - {chrome.i18n.getMessage('Back_up_your_wallet_to_Google_Drive_for_easy_access')} - - - - - {chrome.i18n.getMessage('Recommend')} - - - - - {chrome.i18n.getMessage('Connect__To')} - - {chrome.i18n.getMessage('Google__Drive')} - - {chrome.i18n.getMessage('to_back_up_your_wallet')} - - - - - - - - {/* */} - - - {chrome.i18n.getMessage( - 'Backup_failed_you_may_still_conduct_backup_inside_extension' - )} - - - - - - - - - ); -}; - -export default GoogleBackup; diff --git a/src/ui/views/LandingPages/Welcome/Register/index.tsx b/src/ui/views/LandingPages/Welcome/Register/index.tsx index ab4d659d..9169961a 100644 --- a/src/ui/views/LandingPages/Welcome/Register/index.tsx +++ b/src/ui/views/LandingPages/Welcome/Register/index.tsx @@ -5,6 +5,7 @@ import { useHistory } from 'react-router-dom'; import { getAccountKey } from '@/shared/utils/address'; import AllSet from '@/ui/FRWComponent/LandingPages/AllSet'; +import GoogleBackup from '@/ui/FRWComponent/LandingPages/GoogleBackup'; import LandingComponents from '@/ui/FRWComponent/LandingPages/LandingComponents'; import PickUsername from '@/ui/FRWComponent/LandingPages/PickUsername'; import RepeatPhrase from '@/ui/FRWComponent/LandingPages/RepeatPhrase'; @@ -12,7 +13,6 @@ import SetPassword from '@/ui/FRWComponent/LandingPages/SetPassword'; import { storage } from 'background/webapi'; import { useWallet } from 'ui/utils'; -import GoogleBackup from './GoogleBackup'; import RecoveryPhrase from './RecoveryPhrase'; const STEPS = {