diff --git a/src/background/controller/provider/controller.ts b/src/background/controller/provider/controller.ts index 19cd96ad3..a2fa840a9 100644 --- a/src/background/controller/provider/controller.ts +++ b/src/background/controller/provider/controller.ts @@ -235,17 +235,20 @@ class ProviderController extends BaseController { } const currentWallet = await Wallet.getParentAddress(); - let evmAddress; + let evmAddress: string; if (!currentWallet) { throw new Error('Current wallet not found'); } try { // Attempt to query the EVM address - evmAddress = await userWalletService.getEvmAccountOfParent(currentWallet); - if (!isValidEthereumAddress(evmAddress)) { + + const evmAccount = await userWalletService.getEvmAccountOfParent(currentWallet); + + if (!evmAccount || !isValidEthereumAddress(evmAccount.address)) { throw new Error('Invalid EVM address'); } + evmAddress = evmAccount.address; } catch (error) { // If an error occurs, request approval consoleError('ethRequestAccounts - Error querying EVM address:', error); @@ -257,10 +260,12 @@ class ProviderController extends BaseController { }, { height: 599 } ); - evmAddress = await userWalletService.getEvmAccountOfParent(currentWallet); - if (!isValidEthereumAddress(evmAddress)) { + const evmAccount = await userWalletService.getEvmAccountOfParent(currentWallet); + + if (!evmAccount || !isValidEthereumAddress(evmAccount.address)) { throw new Error('Invalid EVM address'); } + evmAddress = evmAccount.address; } const account = evmAddress ? [ensureEvmAddressPrefix(evmAddress)] : []; diff --git a/src/ui/components/PrivateRoute.tsx b/src/ui/components/PrivateRoute.tsx index e64b5be3b..6dd5acee8 100644 --- a/src/ui/components/PrivateRoute.tsx +++ b/src/ui/components/PrivateRoute.tsx @@ -1,13 +1,14 @@ import React, { useEffect, useState } from 'react'; import { Navigate } from 'react-router'; -import { useWallet } from '@/ui/hooks/use-wallet'; +import { useWallet, useWalletLoaded } from '@/ui/hooks/use-wallet'; import { getUiType } from '../utils'; import { openInternalPageInTab } from '../utils/webapi'; const PrivateRoute = ({ children }) => { const wallet = useWallet(); + const walletLoaded = useWalletLoaded(); const [booted, setBooted] = useState(false); const [unlocked, setUnlocked] = useState(false); @@ -28,20 +29,21 @@ const PrivateRoute = ({ children }) => { return { booted, unlocked }; } }; - - // Initial check - fetchLockState().then(({ booted, unlocked }) => { - if (mounted) { - setBooted(booted); - setUnlocked(unlocked); - setLoading(false); - } - }); + if (walletLoaded) { + // Initial check + fetchLockState().then(({ booted, unlocked }) => { + if (mounted) { + setBooted(booted); + setUnlocked(unlocked); + setLoading(false); + } + }); + } return () => { mounted = false; }; - }, [wallet]); + }, [wallet, walletLoaded]); if (loading) { // If we haven't loaded, we can't make a decision on whether to render the children diff --git a/src/ui/components/password/PasswordTextarea.tsx b/src/ui/components/password/PasswordTextarea.tsx index 24fcfeecb..8f575885a 100644 --- a/src/ui/components/password/PasswordTextarea.tsx +++ b/src/ui/components/password/PasswordTextarea.tsx @@ -61,11 +61,13 @@ const PasswordTextarea = ({ // The actual textarea styling '& .MuiInputBase-input': { padding: '20px', + paddingRight: '40px', resize: 'none', fontSize: '16px', fontFamily: 'Inter', fontWeight: 400, color: '#fff', + WebkitTextSecurity: showPassword ? 'none' : 'disc', '&::placeholder': { color: '#767676', diff --git a/src/ui/views/Linked/LinkedNftDetail.tsx b/src/ui/views/Linked/LinkedNftDetail.tsx index 209adad0a..51f942f12 100644 --- a/src/ui/views/Linked/LinkedNftDetail.tsx +++ b/src/ui/views/Linked/LinkedNftDetail.tsx @@ -8,7 +8,6 @@ import React, { useCallback, useEffect, useState } from 'react'; import { useLocation, useNavigate } from 'react-router'; import fallback from '@/ui/assets/image/errorImage.png'; -import DetailMove from '@/ui/assets/svg/detailMove.svg'; import SendIcon from '@/ui/assets/svg/detailSend.svg'; import { useWallet } from '@/ui/hooks/use-wallet'; import { useProfiles } from '@/ui/hooks/useProfileHook'; @@ -481,7 +480,8 @@ const LinkedNftDetail = () => { {chrome.i18n.getMessage('Send')} )} - + {/* TODO: TB July 2025. This is not working as the script doesn't exist. Turning off for now */} + {/* {nftDetail?.collectionID && ( )} + */} {moveOpen && ( diff --git a/src/ui/views/NFT/Detail.tsx b/src/ui/views/NFT/Detail.tsx index 2ff9ffe29..8fb23ae57 100644 --- a/src/ui/views/NFT/Detail.tsx +++ b/src/ui/views/NFT/Detail.tsx @@ -49,17 +49,22 @@ const Detail = () => { const [contactOne, setContactOne] = useState(emptyContact); const [contactTwo, setContactTwo] = useState(emptyContact); const [isAccessibleNft, setisAccessibleNft] = useState(false); - const [canMoveChild, setCanMoveChild] = useState(true); + // TB July 2025. This always fails as the script doesn't exist. Turning off for now + // const [canMoveChild, setCanMoveChild] = useState(false); + + const canMoveChild = activeAccountType !== 'child' && currentWallet.address; + /* useEffect(() => { const checkPermission = async () => { + // TODO: TB July 2025. This always fails as the script doesn't exist. Turning off for now const result = await usewallet.checkCanMoveChild(currentWallet.address); setCanMoveChild(result); }; checkPermission(); }, [usewallet, currentWallet.address]); - + */ useEffect(() => { const savedState = localStorage.getItem('nftDetailState'); if (savedState) { diff --git a/src/ui/views/SortHat.tsx b/src/ui/views/SortHat.tsx index f1241c2aa..3916f4f6c 100644 --- a/src/ui/views/SortHat.tsx +++ b/src/ui/views/SortHat.tsx @@ -3,12 +3,13 @@ import { Navigate } from 'react-router'; import Spin from '@/ui/components/Spin'; import { useApproval } from '@/ui/hooks/use-approval'; -import { useWallet } from '@/ui/hooks/use-wallet'; +import { useWallet, useWalletLoaded } from '@/ui/hooks/use-wallet'; import { getUiType } from '@/ui/utils'; import { openInternalPageInTab } from '@/ui/utils/webapi'; const SortHat = () => { const wallet = useWallet(); + const walletLoaded = useWalletLoaded(); const [to, setTo] = useState(''); // eslint-disable-next-line prefer-const let [getApproval, , rejectApproval] = useApproval(); @@ -68,8 +69,10 @@ const SortHat = () => { }, [getApproval, rejectApproval, wallet]); useEffect(() => { - loadView(); - }, [loadView]); + if (walletLoaded) { + loadView(); + } + }, [loadView, walletLoaded]); return ( // diff --git a/src/ui/views/Welcome/Register/index.tsx b/src/ui/views/Welcome/Register/index.tsx index 3573898f9..949db1e09 100644 --- a/src/ui/views/Welcome/Register/index.tsx +++ b/src/ui/views/Welcome/Register/index.tsx @@ -1,7 +1,7 @@ import { Box } from '@mui/material'; import * as bip39 from 'bip39'; import React, { useCallback, useEffect, useReducer } from 'react'; -import { useNavigate } from 'react-router'; +import { useLocation, useNavigate } from 'react-router'; import { INITIAL_REGISTER_STATE, @@ -28,6 +28,8 @@ export const initRegisterState = (initialState: RegisterState): RegisterState => const Register = () => { const navigate = useNavigate(); + const location = useLocation(); + const usewallet = useWallet(); const [state, dispatch] = useReducer(registerReducer, INITIAL_REGISTER_STATE, initRegisterState); @@ -66,11 +68,15 @@ const Register = () => { } }; + // Only show the back button if there is a page to go back to + const showBackButton = + activeTab !== STEPS.ALL_SET && (activeTab !== STEPS.USERNAME || location.key !== 'default'); + return ( { const navigate = useNavigate(); + const location = useLocation(); const usewallet = useWallet(); const [state, dispatch] = useReducer(importProfileReducer, INITIAL_IMPORT_STATE); @@ -107,8 +108,14 @@ const ImportProfile = () => { }; const goBack = () => { - if (activeTab === IMPORT_STEPS.GOOGLE_BACKUP || activeTab === IMPORT_STEPS.ALL_SET) { - navigate(-1); + if ( + activeTab === IMPORT_STEPS.GOOGLE_BACKUP || + activeTab === IMPORT_STEPS.ALL_SET || + activeTab === IMPORT_STEPS.IMPORT + ) { + if (location.key !== 'default') { + navigate(-1); + } return; } dispatch({ type: 'GO_BACK' }); @@ -131,11 +138,15 @@ const ImportProfile = () => { /> ); } + + const showBackButton = + activeTab !== IMPORT_STEPS.ALL_SET && + (activeTab !== IMPORT_STEPS.IMPORT || location.key !== 'default'); return (