Files
grimoire/src/hooks/useSettings.ts
Alejandro a75dd2b3fb Remove compact mode settings and simplify settings architecture (#232)
* refactor: remove unused compactModeKinds from app state

The compactModeKinds feature was partially implemented but never used:
- Settings dialog allowed configuration but the value was never consumed
- REQ viewer uses --view flag for compact mode, not this state value

Removed:
- compactModeKinds from GrimoireState type and initial state
- setCompactModeKinds logic function and state hook callback
- Compact Events section from SettingsDialog (now shows placeholder)
- compactModeKinds from AppearanceSettings in settings service
- Migration now strips compactModeKinds if present instead of adding it

https://claude.ai/code/session_01DiWUxiS5BAzU9mrKvCUuMW

* chore: delete unused SettingsDialog component

The SettingsDialog was imported but never used - the Settings menu
item opens a window via addWindow("settings", ...) instead.

https://claude.ai/code/session_01DiWUxiS5BAzU9mrKvCUuMW

* refactor: simplify settings service to only used settings

Removed unused settings that were defined but never consumed:
- RelaySettings (fallbackRelays, discoveryRelays, outbox*, etc.)
- PrivacySettings (shareReadReceipts, blurWalletBalances, etc.)
- DatabaseSettings (maxEventsCached, autoCleanupDays, etc.)
- NotificationSettings (enabled, notifyOnMention, etc.)
- DeveloperSettings (debugMode, showEventIds, logLevel, etc.)
- Most of AppearanceSettings (theme, fontSizeMultiplier, etc.)
- Most of PostSettings (defaultRelayMode, customPostRelays)

Only kept settings that are actually used:
- post.includeClientTag
- appearance.showClientTags

Also simplified useSettings hook to match.

https://claude.ai/code/session_01DiWUxiS5BAzU9mrKvCUuMW

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-30 14:23:30 +01:00

36 lines
745 B
TypeScript

/**
* React hook for accessing and updating global app settings
*/
import { useCallback } from "react";
import { use$ } from "applesauce-react/hooks";
import { settingsManager, type AppSettings } from "@/services/settings";
export function useSettings() {
const settings = use$(settingsManager.stream$);
const updateSetting = useCallback(
<
S extends keyof Omit<AppSettings, "__version">,
K extends keyof AppSettings[S],
>(
section: S,
key: K,
value: AppSettings[S][K],
) => {
settingsManager.updateSetting(section, key, value);
},
[],
);
const reset = useCallback(() => {
settingsManager.reset();
}, []);
return {
settings,
updateSetting,
reset,
};
}