refactor(prefs): move Settings auto-save machinery into PrefsProvider

Lift the four editable Settings prefs (theme/perf/hints/notifications), their
live-apply effects, the debounced auto-save + baseline echo-guard, and the
server-adopt-on-login into PrefsProvider, exposing the PrefsController via
usePrefs(). SettingsPanel and GlassTuner read it from the hook instead of props;
App's big adopt effect keeps only the shell prefs (panel layouts, rail collapse,
language). App.tsx 655->489 lines. E2E 17/17 incl. settings auto-save. (Platform S6b.3)
This commit is contained in:
2026-07-19 01:09:20 +02:00
parent 36e4419c98
commit fd1742e783
5 changed files with 192 additions and 153 deletions
+4 -1
View File
@@ -1,5 +1,6 @@
import { useEffect, useMemo, useState } from "react";
import Overlay from "./Overlay";
import { usePrefs } from "./PrefsProvider";
/**
* A floating live appearance tuner. Mounted at the app root so it's reachable on every page; it
@@ -91,7 +92,9 @@ function loadSaved(): Saved {
}
}
export default function GlassTuner({ enabled }: { enabled: boolean }) {
export default function GlassTuner() {
// Opt-in via Settings → Appearance (theme.showTuner, off by default); the flag lives in PrefsProvider.
const enabled = usePrefs().theme.showTuner;
const initial = useMemo(loadSaved, []);
const [vars, setVars] = useState<Record<string, number>>(() => {
const base: Record<string, number> = {};