Debian Codegraph @

frontend/src/stores/journal.ts

raw
1 import { localStorageSyncedStore } from "../lib/store";
2 import { array, constants, string, tuple } from "../lib/validation";
3
4 const defaultValue = [
5 "balance",
6 "budget",
7 "cleared",
8 "custom",
9 "discovered",
10 "document",
11 "note",
12 "pending",
13 "query",
14 "statement",
15 "transaction",
16 ];
17
18 /** The types of entries to show in the journal. */
19 export const journalShow = localStorageSyncedStore(
20 "journal-show",
21 array(string),
22 () => defaultValue,
23 );
24
25 const defaultSortOrder: [string, "asc" | "desc"] = ["date", "desc"];
26
27 /** The column and order that the journal should be sorted in. */
28 export const journalSortOrder = localStorageSyncedStore(
29 "journal-sort-order",
30 tuple(string, constants("asc", "desc")),
31 () => defaultSortOrder,
32 );