blob: 3fc66e91badc6523b6bc82e4c0803431978fbe1d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import { useCallback } from "react";
import { useUserSettings } from "@/lib/userSettings";
import { parseAsBoolean, useQueryState } from "nuqs";
export function useShowArchived() {
const userSettings = useUserSettings();
const [showArchived, setShowArchived] = useQueryState(
"includeArchived",
parseAsBoolean
.withOptions({
shallow: false,
})
.withDefault(userSettings.archiveDisplayBehaviour === "show"),
);
const onClickShowArchived = useCallback(() => {
setShowArchived((prev) => !prev);
}, [setShowArchived]);
return {
showArchived,
onClickShowArchived,
};
}
|