import { toRefs } from "@vueuse/core"; export type Settings = { search: boolean; size: "small" | "medium" | "large"; compact: boolean; menuWidth: number; smallerScrollbars: boolean; showTimestamp: boolean; showStd: boolean; showAllContainers: boolean; lightTheme: "auto" | "dark" | "light"; hourStyle: "auto" | "24" | "12"; dateLocale: "auto" | "en-US" | "en-GB" | "de-DE" | "en-CA"; softWrap: boolean; collapseNav: boolean; automaticRedirect: "instant" | "delayed" | "none"; locale: string; }; export const DEFAULT_SETTINGS: Settings = { search: true, compact: false, size: "medium", menuWidth: 15, smallerScrollbars: false, showTimestamp: true, showStd: false, showAllContainers: false, lightTheme: "auto", hourStyle: "auto", dateLocale: "auto", softWrap: true, collapseNav: false, automaticRedirect: "delayed", locale: "", }; export const settings = useProfileStorage("settings", DEFAULT_SETTINGS); // @ts-ignore: automaticRedirect is now a string enum, but might be a boolean in older data if (settings.value.automaticRedirect === true) { settings.value.automaticRedirect = "delayed"; // @ts-ignore: automaticRedirect is now a string enum, but might be a boolean in older data } else if (settings.value.automaticRedirect === false) { settings.value.automaticRedirect = "none"; } export const { collapseNav, compact, softWrap, hourStyle, dateLocale, lightTheme, showAllContainers, showTimestamp, showStd, smallerScrollbars, menuWidth, size, search, locale, automaticRedirect, } = toRefs(settings);