From 5017c1b7ff12cff991878eec014028615d5dae71 Mon Sep 17 00:00:00 2001 From: "shakespeare.diy" Date: Thu, 3 Sep 2026 20:09:01 +0700 Subject: [PATCH] Fix mobile bugs: DM/crew-chat crash, notification popover clipping, multi-account switch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #2 (crash): useDirectMessages called getEventHash() without importing it — `getEventHash is not defined` broke crew chat and any NIP-17 DM send. Added the missing import from nostr-tools. #3 (bell not loading on phone): the notifications popover had a fixed-height scroll area and no collision handling, so on small screens it rendered clipped against the top edge with the tab content cut off. The popover now constrains to the Radix available-height, uses a flex column, and the tab list/scroll area flex correctly — all tabs (incl. Crews/News) are reachable on mobile. #4 (multi-account on phone): the mobile header user menu had only Set Status + Log Out. Added an Accounts section that lists other logged-in npubs to switch between, plus "Add another account" which opens the login dialog. Desktop already had this via AccountSwitcher; mobile now reaches parity. Note: #1/#5/#6 (stuck on publish/vouch/delete) were reported against the shipped 1.2.2 APK, which also contained the #2 crash. Rebuild 1.2.3 and re-test — the sign/publish paths in current source are correct (Amber round-trip has a 90s timeout + surfaced errors). Co-authored-by: shakespeare.diy --- src/components/Layout.tsx | 45 +++++++++++++++++++++++++++++ src/components/NotificationBell.tsx | 15 ++++++---- src/hooks/useDirectMessages.ts | 2 +- 3 files changed, 56 insertions(+), 6 deletions(-) diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index f09fd80..4c97a61 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -15,6 +15,7 @@ import { DropdownMenuSeparator, } from '@/components/ui/dropdown-menu'; import { LoginArea } from '@/components/auth/LoginArea'; +import { LoginDialog } from '@/components/auth/LoginDialog'; import { SasquatchGuide } from '@/components/SasquatchGuide'; import { useSasquatchGuide } from '@/hooks/useSasquatchGuide'; import { BackupReminder } from '@/components/BackupReminder'; @@ -124,16 +125,21 @@ function MobileHeaderUserMenu({ pubkey, onLogout, onSetStatus, + onAddAccount, }: { pubkey: string; onLogout: () => void; onSetStatus: () => void; + onAddAccount: () => void; }) { const author = useAuthor(pubkey); const metadata = author.data?.metadata; const displayName = metadata?.name ?? genUserName(pubkey); const avatar = metadata?.picture; + // Multi-account: list other logins so the user can switch on mobile. + const { otherUsers, setLogin } = useLoggedInAccounts(); + return ( @@ -225,6 +231,36 @@ function MobileHeaderUserMenu({ Wallet + + {/* ── Accounts: switch between logged-in npubs + add another ── */} + +
+ Accounts +
+ {otherUsers.map((account) => { + const name = account.metadata?.name ?? genUserName(account.pubkey); + return ( + setLogin(account.id)} + className="flex items-center gap-2 cursor-pointer" + > + + + {name.slice(0, 2).toUpperCase()} + + {name} + + ); + })} + + + Add another account + + removeLogin(currentAccount?.id || '')} onSetStatus={() => setShowStatusDialog(true)} + onAddAccount={() => setShowAddAccount(true)} /> ) : ( @@ -986,6 +1024,13 @@ export function Layout({ children, noPadding }: LayoutProps) { onOpenChange={setShowStatusDialog} /> + {/* Add-another-account (multi-account switch on mobile) */} + setShowAddAccount(false)} + onLogin={() => setShowAddAccount(false)} + /> + {/* Newsletter: floating pill + Monday admin reminder */} diff --git a/src/components/NotificationBell.tsx b/src/components/NotificationBell.tsx index 1941528..8e0af54 100644 --- a/src/components/NotificationBell.tsx +++ b/src/components/NotificationBell.tsx @@ -264,8 +264,13 @@ export function NotificationBell({ className }: { className?: string }) { )} - -
+ +

Notifications

@@ -278,8 +283,8 @@ export function NotificationBell({ className }: { className?: string }) {
- - + + - + {/* ─── ALL ─────────────────────────────────────────────────── */} {isLoading && badgeTotal === 0 && ( diff --git a/src/hooks/useDirectMessages.ts b/src/hooks/useDirectMessages.ts index 579d86b..844b722 100644 --- a/src/hooks/useDirectMessages.ts +++ b/src/hooks/useDirectMessages.ts @@ -1,7 +1,7 @@ import { useCallback, useMemo } from 'react'; import { useNostr } from '@nostrify/react'; import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'; -import { nip44, nip19, generateSecretKey, getPublicKey, finalizeEvent } from 'nostr-tools'; +import { nip44, nip19, generateSecretKey, getPublicKey, finalizeEvent, getEventHash } from 'nostr-tools'; import type { NostrEvent } from '@nostrify/nostrify'; import { useNostrLogin } from '@nostrify/react/login';