diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index 148fa43f..eb10e1cf 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -17,6 +17,26 @@ import { useTheme } from 'theme-o-rama'; import { useLocalStorage } from 'usehooks-ts'; import { BottomNav, TopNav } from './Nav'; +function WalletTransitionWrapper({ children }: PropsWithChildren) { + const { isSwitching, wallet } = useWallet(); + + // Only show content if we have a wallet or we're not switching + // This prevents old wallet data from showing during transition + const shouldShow = wallet !== null || !isSwitching; + + return ( +
+ {shouldShow ? children : null} +
+ ); +} + const SIDEBAR_COLLAPSED_STORAGE_KEY = 'sage-wallet-sidebar-collapsed'; type LayoutProps = PropsWithChildren & { @@ -117,7 +137,9 @@ export function FullLayout(props: LayoutProps) { onClick={() => setIsCollapsed(!isCollapsed)} className='text-2xl hover:scale-110 transition-transform cursor-pointer' aria-label={t`Expand sidebar - ${wallet.name}`} - aria-expanded={!isCollapsed} + {...(isCollapsed + ? { 'aria-expanded': false } + : { 'aria-expanded': true })} > {wallet.emoji} @@ -140,7 +162,9 @@ export function FullLayout(props: LayoutProps) { aria-label={ isCollapsed ? t`Expand sidebar` : t`Collapse sidebar` } - aria-expanded={!isCollapsed} + {...(isCollapsed + ? { 'aria-expanded': false } + : { 'aria-expanded': true })} > {isCollapsed ? (