2026-03-27 01:39:15 -07:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
import { atom } from "jotai";
|
|
|
|
|
import { atomWithStorage } from "jotai/utils";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set of folder IDs that are currently expanded in the tree, keyed by search space ID.
|
|
|
|
|
* Persisted to localStorage so expand/collapse state survives page refreshes.
|
|
|
|
|
*/
|
|
|
|
|
export const expandedFolderIdsAtom = atomWithStorage<Record<number, number[]>>(
|
|
|
|
|
"surfsense:expandedFolderIds",
|
2026-03-27 03:17:05 -07:00
|
|
|
{}
|
2026-03-27 01:39:15 -07:00
|
|
|
);
|
|
|
|
|
|
2026-04-28 01:12:15 +05:30
|
|
|
/**
|
|
|
|
|
* Expanded folder keys for Local filesystem tree, keyed by search space ID.
|
|
|
|
|
* Persisted so local tree expansion survives remounts/reloads.
|
|
|
|
|
*/
|
|
|
|
|
export const localExpandedFolderKeysAtom = atomWithStorage<Record<number, string[]>>(
|
|
|
|
|
"surfsense:localExpandedFolderKeys",
|
|
|
|
|
{}
|
|
|
|
|
);
|
|
|
|
|
|
2026-03-27 01:39:15 -07:00
|
|
|
/**
|
|
|
|
|
* Folder currently being renamed (inline edit mode).
|
|
|
|
|
* null means no folder is being renamed.
|
|
|
|
|
*/
|
|
|
|
|
export const renamingFolderIdAtom = atom<number | null>(null);
|