diff --git a/src/components/Bookmarks.tsx b/src/components/Bookmarks.tsx index 84dd4f13..66a852ed 100644 --- a/src/components/Bookmarks.tsx +++ b/src/components/Bookmarks.tsx @@ -12,7 +12,7 @@ import ContentPanel from './ContentPanel' import { HighlightsPanel } from './HighlightsPanel' import { fetchReadableContent, ReadableContent } from '../services/readerService' import Settings from './Settings' -import { UserSettings, loadSettings, saveSettings } from '../services/settingsService' +import { UserSettings, loadSettings, saveSettings, watchSettings } from '../services/settingsService' import { loadFont, getFontFamily } from '../utils/fontLoader' export type ViewMode = 'compact' | 'cards' | 'large' @@ -53,6 +53,21 @@ const Bookmarks: React.FC = ({ relayPool, onLogout }) => { } }, [relayPool, activeAccount?.pubkey]) + // Watch for settings changes from Nostr + useEffect(() => { + if (!activeAccount || !eventStore) return + + const subscription = watchSettings(eventStore, activeAccount.pubkey, (loadedSettings) => { + if (loadedSettings) { + setSettings(loadedSettings) + } + }) + + return () => { + subscription.unsubscribe() + } + }, [activeAccount?.pubkey, eventStore]) + useEffect(() => { const root = document.documentElement.style if (settings.defaultViewMode) setViewMode(settings.defaultViewMode)