From 4500ca4129ca848c02ec524ccd33ccbe02efc2db Mon Sep 17 00:00:00 2001 From: Thebora Kompanioni Date: Thu, 16 Apr 2026 22:14:14 +0200 Subject: [PATCH] chore: remove switch wallet page (#1207) --- src/App.tsx | 4 - src/components/SwitchWalletPage.tsx | 216 ----------------------- src/components/settings/SettingsPage.tsx | 3 - src/constants/routes.ts | 1 - src/i18n/locales/en/translation.json | 3 - 5 files changed, 227 deletions(-) delete mode 100644 src/components/SwitchWalletPage.tsx diff --git a/src/App.tsx b/src/App.tsx index e6f15c76..dc77432a 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -19,7 +19,6 @@ import { toast } from 'sonner' import { useStore } from 'zustand' import { LogsPage } from '@/components/LogsPage' import MainWalletPage from '@/components/MainWalletPage' -import SwitchWalletPage from '@/components/SwitchWalletPage' import CreateWalletPage from '@/components/create/CreateWalletPage' import { EarnPage } from '@/components/earn/EarnPage' import ErrorPage from '@/components/error/ErrorPage' @@ -203,9 +202,6 @@ function App() { } > - }> - } /> - { - return ( - <> -
- -
-
- - -
-
- - -
- -
-
-
 
-
 
- - ) -} - -interface SwitchWalletPageProps { - walletFileName: WalletFileName -} - -const SwitchWalletPage = ({ walletFileName }: SwitchWalletPageProps) => { - const { t } = useTranslation() - const navigate = useNavigate() - const client = useApiClient() - const [currentWalletLocked, setCurrentWalletLocked] = useState(false) - - const { - data: listWalletsData, - error: listWalletsError, - isLoading: listWalletsLoading, - isFetching: listWalletsFetching, - refetch: listWalletsRefetch, - } = useQuery({ - ...listwalletsOptions({ client }), - retry: false, - }) - - const lockCurrentWallet = useQuery({ - ...lockwalletOptions({ - client, - path: { walletname: walletFileName }, - }), - enabled: false, - staleTime: 1, - gcTime: 1, - retry: false, - }) - - const wallets = sortWallets((listWalletsData?.wallets || []) as WalletFileName[], walletFileName) - - const handleLockCurrentWallet = async () => { - try { - await lockCurrentWallet.refetch({ throwOnError: true }) - authStore.getState().clear() - queryClient.clear() - setCurrentWalletLocked(true) - toast.success( - t('wallets.wallet_preview.alert_wallet_locked_successfully', { walletName: walletDisplayName(walletFileName) }), - ) - } catch (error: unknown) { - const reason = getErrorReason(error, t('global.errors.reason_unknown')) - toast.error(t('settings.error_lock_wallet_failed', { reason })) - console.error('Failed to lock wallet:', error) - } - } - - return ( - - - -
- {listWalletsFetching ? ( - - ) : ( - void listWalletsRefetch()} /> - )} -
- {t('settings.button_switch_wallet')} - - {currentWalletLocked - ? t('settings.switch_wallet_current_wallet_locked_select_other') - : t('wallets.alert_wallet_open', { - currentWalletName: walletDisplayName(walletFileName), - })} - -
- - {listWalletsLoading ? ( - - - - ) : ( - <> - {listWalletsError ? ( - - - - - ) : ( - -
-
- {t('wallets.title')} -
- - {wallets.length === 0 ? ( -
-

{t('wallets.subtitle_no_wallets')}

-
- ) : ( -
- {wallets.map((wallet) => ( -
-
-
- - - {shortenStringMiddle(walletDisplayName(wallet) ?? '...', 63)} - -
- {wallet === walletFileName && ( - - {currentWalletLocked - ? t('wallets.wallet_preview.wallet_locked') - : t('wallets.wallet_preview.wallet_active')} - - )} -
- - {wallet === walletFileName && ( -
- - -
- )} -
- ))} -
- )} -
-
- )} - - )} -
-
- ) -} - -export default SwitchWalletPage diff --git a/src/components/settings/SettingsPage.tsx b/src/components/settings/SettingsPage.tsx index 19d22b05..115c3ddd 100644 --- a/src/components/settings/SettingsPage.tsx +++ b/src/components/settings/SettingsPage.tsx @@ -11,7 +11,6 @@ import { BookIcon, TerminalIcon, PackageSearchIcon, - ArrowLeftRightIcon, LockKeyholeIcon, BookKeyIcon, FoldHorizontalIcon, @@ -164,8 +163,6 @@ export const SettingsPage = ({ walletFileName, onLockWallet }: SettingPageProps) disabled={lockWalletMutation.isPending} /> - -