Increase Large/XL font sizes, enlarge account switcher, fix relay drop and bookmark persistence

- Large font 16→17px, Extra Large 18→20px
- Account avatar w-8→w-10, name and arrow text larger
- resetNDK preserves outbox-discovered relay URLs instead of dropping to fallback 3
- BookmarkView merges relay results with cache instead of replacing, so cached notes survive timeouts
This commit is contained in:
Jure
2026-04-01 13:49:37 +02:00
parent a65b2d2f95
commit 355f412455
4 changed files with 23 additions and 10 deletions

View File

@@ -91,10 +91,16 @@ export function BookmarkView() {
if (!cancelled) {
const fetched = results.filter((e): e is NDKEvent => e !== null);
// Separate articles (kind 30023) bookmarked via e-tag from notes
const notesOnly = fetched.filter((e) => e.kind !== 30023)
.sort((a, b) => (b.created_at ?? 0) - (a.created_at ?? 0));
const fetchedNotes = fetched.filter((e) => e.kind !== 30023);
const articlesFromETag = fetched.filter((e) => e.kind === 30023);
setNotes(notesOnly);
// Merge with existing (cached) notes — don't replace, so cached notes survive relay timeouts
setNotes((prev) => {
const byId = new Map(prev.map((e) => [e.id, e]));
for (const e of fetchedNotes) byId.set(e.id, e);
return Array.from(byId.values())
.filter((e) => bookmarkedIds.includes(e.id!))
.sort((a, b) => (b.created_at ?? 0) - (a.created_at ?? 0));
});
// Merge any articles found via e-tag into the articles list
if (articlesFromETag.length > 0) {
setArticles((prev) => {

View File

@@ -331,8 +331,8 @@ function ThemeSection() {
const FONT_PRESETS = [
{ label: "Small", size: 12 },
{ label: "Normal", size: 14 },
{ label: "Large", size: 16 },
{ label: "Extra Large", size: 18 },
{ label: "Large", size: 17 },
{ label: "Extra Large", size: 20 },
];
function FontSizeSection() {

View File

@@ -153,12 +153,12 @@ export function AccountSwitcher() {
className="flex items-center gap-2 flex-1 min-w-0 cursor-pointer hover:opacity-80 transition-opacity"
onClick={() => openProfile(pubkey)}
>
<Avatar account={current} size="w-8 h-8" textSize="text-[12px]" />
<span className={`text-[12px] font-medium truncate flex-1 ${loggedIn ? "text-text" : "text-text-muted"}`}>{displayName(current)}</span>
<Avatar account={current} size="w-10 h-10" textSize="text-[14px]" />
<span className={`text-[14px] font-medium truncate flex-1 ${loggedIn ? "text-text" : "text-text-muted"}`}>{displayName(current)}</span>
</div>
<button
onClick={() => setOpen((v) => !v)}
className="text-text-dim hover:text-text text-[10px] transition-colors px-0.5"
className="text-text-dim hover:text-text text-[14px] transition-colors px-1"
title="Switch account"
>
{open ? "▲" : "▼"}

View File

@@ -104,6 +104,13 @@ export async function resetNDK(): Promise<void> {
const oldInstance = ndk;
const oldSigner = oldInstance?.signer ?? null;
// Preserve all relay URLs (stored + outbox-discovered) before resetting
const oldRelayUrls = oldInstance?.pool?.relays
? Array.from(oldInstance.pool.relays.keys()).map(normalizeRelayUrl)
: [];
const storedUrls = getStoredRelayUrls();
const allUrls = [...new Set([...storedUrls, ...oldRelayUrls])];
// Disconnect all relays on old instance
if (oldInstance?.pool?.relays) {
for (const relay of oldInstance.pool.relays.values()) {
@@ -111,9 +118,9 @@ export async function resetNDK(): Promise<void> {
}
}
// Create fresh instance
// Create fresh instance with all known relay URLs
ndk = new NDK({
explicitRelayUrls: getStoredRelayUrls(),
explicitRelayUrls: allUrls,
outboxRelayUrls: OUTBOX_RELAYS,
});
ndkCreatedAt = Date.now();