mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 14:20:42 +08:00
30 lines
671 B
TypeScript
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 = [];
|
|
},
|
|
};
|