import { atom } from 'jotai';

const stored = typeof window !== 'undefined' ? localStorage.getItem('helix_sidebar_collapsed') : null;

export const sidebarCollapsedAtom = atom(
    stored === 'true',
    (_get, set, value: boolean) => {
        set(sidebarCollapsedAtom, value);
        localStorage.setItem('helix_sidebar_collapsed', String(value));
    },
);
