import { useEffect } from 'react'; import { useActiveSeed } from './ActiveSeed.js'; import { useBackendConfig } from './backend-config.js'; import { BackendMatrix } from './BackendMatrix.js'; // A real Settings modal — replaces the previous "gear toggles the // classic tab bar" behaviour. Structured into sections the way // Trust/MetaMask do: Wallet, Backends, Display, Advanced. export function SettingsModal({ onClose, onOpenAdvanced, }: { onClose: () => void; onOpenAdvanced: () => void; }): JSX.Element { const { active, setActive } = useActiveSeed(); const { config, toggle: toggleBackend, reset: resetBackend } = useBackendConfig(); useEffect(() => { const onKey = (e: KeyboardEvent) => { if (e.key === 'Escape') onClose(); }; window.addEventListener('keydown', onKey); return () => window.removeEventListener('keydown', onKey); }, [onClose]); return (
e.stopPropagation()}>

Settings

{active ? ( { setActive(null); onClose(); }} /> ) : ( { onOpenAdvanced(); onClose(); }} /> )} { onOpenAdvanced(); onClose(); }} /> { onOpenAdvanced(); onClose(); }} />
); } function SettingsSection({ title, hint, children, }: { title: string; hint?: string; children: React.ReactNode }): JSX.Element { return (

{title}

{hint &&

{hint}

}
{children}
); } function SettingsRow({ label, hint, actionLabel, actionKind, onAction, disabled, }: { label: string; hint?: string; actionLabel?: string; actionKind?: 'danger'; onAction?: () => void; disabled?: boolean; }): JSX.Element { return (
{label}
{hint &&
{hint}
}
{actionLabel && ( )}
); }