mirror of
https://github.com/hoornet/vega.git
synced 2026-05-12 19:58:36 -07:00
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:
@@ -91,10 +91,16 @@ export function BookmarkView() {
|
|||||||
if (!cancelled) {
|
if (!cancelled) {
|
||||||
const fetched = results.filter((e): e is NDKEvent => e !== null);
|
const fetched = results.filter((e): e is NDKEvent => e !== null);
|
||||||
// Separate articles (kind 30023) bookmarked via e-tag from notes
|
// Separate articles (kind 30023) bookmarked via e-tag from notes
|
||||||
const notesOnly = fetched.filter((e) => e.kind !== 30023)
|
const fetchedNotes = fetched.filter((e) => e.kind !== 30023);
|
||||||
.sort((a, b) => (b.created_at ?? 0) - (a.created_at ?? 0));
|
|
||||||
const articlesFromETag = 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
|
// Merge any articles found via e-tag into the articles list
|
||||||
if (articlesFromETag.length > 0) {
|
if (articlesFromETag.length > 0) {
|
||||||
setArticles((prev) => {
|
setArticles((prev) => {
|
||||||
|
|||||||
@@ -331,8 +331,8 @@ function ThemeSection() {
|
|||||||
const FONT_PRESETS = [
|
const FONT_PRESETS = [
|
||||||
{ label: "Small", size: 12 },
|
{ label: "Small", size: 12 },
|
||||||
{ label: "Normal", size: 14 },
|
{ label: "Normal", size: 14 },
|
||||||
{ label: "Large", size: 16 },
|
{ label: "Large", size: 17 },
|
||||||
{ label: "Extra Large", size: 18 },
|
{ label: "Extra Large", size: 20 },
|
||||||
];
|
];
|
||||||
|
|
||||||
function FontSizeSection() {
|
function FontSizeSection() {
|
||||||
|
|||||||
@@ -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"
|
className="flex items-center gap-2 flex-1 min-w-0 cursor-pointer hover:opacity-80 transition-opacity"
|
||||||
onClick={() => openProfile(pubkey)}
|
onClick={() => openProfile(pubkey)}
|
||||||
>
|
>
|
||||||
<Avatar account={current} size="w-8 h-8" textSize="text-[12px]" />
|
<Avatar account={current} size="w-10 h-10" textSize="text-[14px]" />
|
||||||
<span className={`text-[12px] font-medium truncate flex-1 ${loggedIn ? "text-text" : "text-text-muted"}`}>{displayName(current)}</span>
|
<span className={`text-[14px] font-medium truncate flex-1 ${loggedIn ? "text-text" : "text-text-muted"}`}>{displayName(current)}</span>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
onClick={() => setOpen((v) => !v)}
|
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"
|
title="Switch account"
|
||||||
>
|
>
|
||||||
{open ? "▲" : "▼"}
|
{open ? "▲" : "▼"}
|
||||||
|
|||||||
@@ -104,6 +104,13 @@ export async function resetNDK(): Promise<void> {
|
|||||||
const oldInstance = ndk;
|
const oldInstance = ndk;
|
||||||
const oldSigner = oldInstance?.signer ?? null;
|
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
|
// Disconnect all relays on old instance
|
||||||
if (oldInstance?.pool?.relays) {
|
if (oldInstance?.pool?.relays) {
|
||||||
for (const relay of oldInstance.pool.relays.values()) {
|
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({
|
ndk = new NDK({
|
||||||
explicitRelayUrls: getStoredRelayUrls(),
|
explicitRelayUrls: allUrls,
|
||||||
outboxRelayUrls: OUTBOX_RELAYS,
|
outboxRelayUrls: OUTBOX_RELAYS,
|
||||||
});
|
});
|
||||||
ndkCreatedAt = Date.now();
|
ndkCreatedAt = Date.now();
|
||||||
|
|||||||
Reference in New Issue
Block a user