Something went wrong. Try again.
softfork of @juliet.paris parfait forked from juliet.paris/parfait
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829import { createSignal } from "solid-js";
/** * How a thread's replies are laid out: a line, each reply with the conversation it started one * post after another; or a tree, every reply under the one it answers. Kept in this browser. */type ThreadLayout = "linear" | "tree";
const KEY = "parfait:thread-layout";
const read = (): ThreadLayout => { try { return localStorage.getItem(KEY) === "tree" ? "tree" : "linear"; } catch { return "linear"; }};
const [layout, setLayout] = createSignal<ThreadLayout>(read());export const threadLayout = layout;
export const setThreadLayout = (next: ThreadLayout) => { try { if (next === "tree") localStorage.setItem(KEY, next); else localStorage.removeItem(KEY); } catch {} setLayout(next);};