diff --git a/frontend/src/components/ConfigPanel.tsx b/frontend/src/components/ConfigPanel.tsx index 70f2b3c..680586a 100644 --- a/frontend/src/components/ConfigPanel.tsx +++ b/frontend/src/components/ConfigPanel.tsx @@ -7,7 +7,8 @@ import { notify } from "../lib/notifications"; import Tooltip from "./Tooltip"; import Tabs, { usePersistedTab } from "./Tabs"; import { Switch } from "./ui/form"; -import { DraftSaveBar } from "./ui/DraftSaveBar"; +import { DraftSaveBar, type SaveState } from "./ui/DraftSaveBar"; +import { LS } from "../lib/storage"; // Admin Configuration page: edit DB-overridable operational settings (registry-driven from the // backend — adding a key there makes it appear here automatically). Edits are drafted and @@ -15,7 +16,6 @@ import { DraftSaveBar } from "./ui/DraftSaveBar"; // the server until Save. Group order is fixed where known so logically related settings (e.g. // Email/SMTP) stay together. const GROUP_ORDER = ["access", "email", "youtube", "google", "quota", "backfill", "shorts", "batch", "downloads", "plex"]; -type SaveState = "idle" | "saving" | "saved" | "error"; export default function ConfigPanel() { const { t } = useTranslation(); @@ -40,7 +40,7 @@ export default function ConfigPanel() { const [saveState, setSaveState] = useState("idle"); // One tab per config group (persisted). Called before the loading guard so hook order is // stable; the active id is clamped to a real group at render time once data has loaded. - const [tab, setTab] = usePersistedTab("siftlode.configTab"); + const [tab, setTab] = usePersistedTab(LS.configTab); // Re-seed the draft whenever the server data changes (initial load + after a save/reset). useEffect(() => { @@ -110,9 +110,14 @@ export default function ConfigPanel() { }); const plexLibs = (draft["plex_libraries"] ?? "").split(",").map((s) => s.trim()).filter(Boolean); const togglePlexLib = (key: string) => { - const next = plexLibs.includes(key) - ? plexLibs.filter((k) => k !== key) - : [...plexLibs, key]; + // An empty list means "all libraries" — every box renders checked. Unchecking one from that + // state must select all-except-this, so expand "all" to the explicit section set first; + // otherwise the toggle would ADD the key and leave it as the ONLY selected library. + const allKeys = plexResult?.sections?.map((s) => s.key) ?? []; + const current = plexLibs.length === 0 ? allKeys : plexLibs; + const next = current.includes(key) + ? current.filter((k) => k !== key) + : [...current, key]; setDraft((d) => ({ ...d, plex_libraries: next.join(",") })); }; diff --git a/frontend/src/components/Scheduler.tsx b/frontend/src/components/Scheduler.tsx index f57eddf..e399ccd 100644 --- a/frontend/src/components/Scheduler.tsx +++ b/frontend/src/components/Scheduler.tsx @@ -18,6 +18,7 @@ import { } from "lucide-react"; import { api, type SchedulerJob, type SchedulerStatus } from "../lib/api"; import { useLiveQuery } from "../lib/useLiveQuery"; +import { useConfirm } from "./ConfirmProvider"; import { relativeTime } from "../lib/format"; import { notify } from "../lib/notifications"; import Tooltip from "./Tooltip"; @@ -309,6 +310,7 @@ function Stat({ export default function Scheduler() { const { t } = useTranslation(); const qc = useQueryClient(); + const confirm = useConfirm(); // Poll faster while any job is running so live progress is smooth, then ease back when // idle. Derived from the freshest data by react-query itself (see useLiveQuery). const q = useLiveQuery(["scheduler"], api.schedulerStatus, { @@ -411,7 +413,15 @@ export default function Scheduler() {