bar graph fix

This commit is contained in:
Jack Mechem 2026-05-22 15:10:54 -07:00
parent 43318fb8cd
commit 8c3d749197
15 changed files with 973 additions and 401 deletions

32
stores/helpModeStore.ts Normal file
View file

@ -0,0 +1,32 @@
"use client";
import { useSyncExternalStore } from "react";
function read(): boolean {
if (typeof localStorage === "undefined") return false;
return localStorage.getItem("helpMode") === "true";
}
let helpMode = read();
const listeners = new Set<() => void>();
function subscribe(cb: () => void) {
listeners.add(cb);
return () => listeners.delete(cb);
}
function notify() {
listeners.forEach((cb) => cb());
}
export function useHelpMode(): boolean {
return useSyncExternalStore(subscribe, () => helpMode, () => false);
}
export function useToggleHelpMode() {
return function toggle() {
helpMode = !helpMode;
try { localStorage.setItem("helpMode", String(helpMode)); } catch {}
notify();
};
}