Files
radicle-explorer/src/lib/hints.ts
T
2026-08-10 08:35:44 +02:00

30 lines
671 B
TypeScript

import { z } from "zod";
import useLocalStorage from "@app/lib/useLocalStorage.svelte";
// One-off tips that can be dismissed permanently. Kept in a single list so
// settings can offer to bring all of them back.
export type HintId = "markdown";
const storage = useLocalStorage("dismissedHints", z.array(z.string()), []);
export const hints = {
get dismissedCount(): number {
return storage.value.length;
},
isDismissed(id: HintId): boolean {
return storage.value.includes(id);
},
dismiss(id: HintId) {
if (!storage.value.includes(id)) {
storage.value = [...storage.value, id];
}
},
resetAll() {
storage.value = [];
},
};