From 48cffb200831269e4ec94e8b9dee725f06bca611 Mon Sep 17 00:00:00 2001 From: Silberengel Date: Mon, 6 Apr 2026 15:15:55 +0200 Subject: [PATCH] bug-fixes --- src/components/AccountList/index.tsx | 16 +++- src/components/AccountManager/index.tsx | 2 +- src/components/LogoutDialog/index.tsx | 21 +++-- src/hooks/useProfileAccordionData.tsx | 30 +++++-- src/i18n/locales/en.ts | 3 +- src/providers/NostrProvider/index.tsx | 102 +++++++++--------------- 6 files changed, 87 insertions(+), 87 deletions(-) diff --git a/src/components/AccountList/index.tsx b/src/components/AccountList/index.tsx index 2a243dbc..7433e5cd 100644 --- a/src/components/AccountList/index.tsx +++ b/src/components/AccountList/index.tsx @@ -13,10 +13,15 @@ import { SimpleUsername } from '../Username' export default function AccountList({ className, - afterSwitch + afterSwitch, + closeDialog }: { className?: string afterSwitch: () => void + /** Called before switching to an ncryptsec account so the parent dialog can + * close before the password prompt opens (avoids two simultaneous Radix + * dialogs fighting over focus trapping). */ + closeDialog?: () => void }) { const { accounts, account, switchAccount, removeAccount } = useNostr() const [switchingAccount, setSwitchingAccount] = useState(null) @@ -28,13 +33,18 @@ export default function AccountList({ key={`${act.pubkey}-${act.signerType}`} className={cn( 'relative rounded-lg', - isSameAccount(act, account) ? 'border border-primary' : 'clickable' + act.pubkey === account?.pubkey ? 'border border-primary' : 'clickable' )} onClick={() => { if (isSameAccount(act, account)) return setSwitchingAccount(act) + if (act.signerType === 'ncryptsec') { + closeDialog?.() + } switchAccount(act) - .then(() => afterSwitch()) + .then(() => { + if (act.signerType !== 'ncryptsec') afterSwitch() + }) .finally(() => setSwitchingAccount(null)) }} > diff --git a/src/components/AccountManager/index.tsx b/src/components/AccountManager/index.tsx index ce10c765..155d0fd3 100644 --- a/src/components/AccountManager/index.tsx +++ b/src/components/AccountManager/index.tsx @@ -113,7 +113,7 @@ function AccountManagerNav({
{t('Logged in Accounts')}
- close?.()} /> + close?.()} closeDialog={() => close?.()} /> )} diff --git a/src/components/LogoutDialog/index.tsx b/src/components/LogoutDialog/index.tsx index b4b84f60..00c9536b 100644 --- a/src/components/LogoutDialog/index.tsx +++ b/src/components/LogoutDialog/index.tsx @@ -30,7 +30,12 @@ export default function LogoutDialog({ }) { const { t } = useTranslation() const { isSmallScreen } = useScreenSize() - const { account, removeAccount } = useNostr() + const { account, switchAccount } = useNostr() + + const handleLogout = () => { + setOpen(false) + void switchAccount(null) + } if (isSmallScreen) { return ( @@ -46,12 +51,8 @@ export default function LogoutDialog({