mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 14:20:42 +08:00
Co-authored-by: Brandon Oxendine <brandon.oxendine@gmail.com>
35 lines
805 B
TypeScript
35 lines
805 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"
|
|
| "guide"
|
|
| "profile.permanence"
|
|
// One for each profile and number of its controllers.
|
|
| `profile.controllers:${string}`;
|
|
|
|
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 = [];
|
|
},
|
|
};
|