21 lines
699 B
TypeScript
21 lines
699 B
TypeScript
import { create } from "zustand";
|
|
|
|
const STORAGE_KEY = "healer-man.include-beta-companion-specs.v1";
|
|
|
|
function loadPreference(): boolean {
|
|
try { return window.localStorage.getItem(STORAGE_KEY) === "true"; } catch { return false; }
|
|
}
|
|
|
|
interface CompanionPartyPreferencesState {
|
|
includeBetaSpecs: boolean;
|
|
setIncludeBetaSpecs: (include: boolean) => void;
|
|
}
|
|
|
|
export const useCompanionPartyPreferences = create<CompanionPartyPreferencesState>((set) => ({
|
|
includeBetaSpecs: loadPreference(),
|
|
setIncludeBetaSpecs: (includeBetaSpecs) => {
|
|
try { window.localStorage.setItem(STORAGE_KEY, String(includeBetaSpecs)); } catch { /* optional preference */ }
|
|
set({ includeBetaSpecs });
|
|
},
|
|
}));
|