import { translationAtom } from "@/atoms/translations-atom"; import { savedOutputPathAtom, rememberOutputFolderAtom, } from "@/atoms/user-settings-atom"; import { useAtom, useAtomValue } from "jotai"; export function SaveOutputFolderToggle() { const [outputPath, setOutputPath] = useAtom(savedOutputPathAtom); const [rememberOutputFolder, setRememberOutputFolder] = useAtom( rememberOutputFolderAtom, ); const t = useAtomValue(translationAtom); return (
{t("SETTINGS.SAVE_OUTPUT_FOLDER.TITLE")}
{t("SETTINGS.SAVE_OUTPUT_FOLDER.DESCRIPTION")}
{outputPath}
{ setRememberOutputFolder((oldValue) => { if (oldValue === true) { setOutputPath(""); } return !oldValue; }); localStorage.setItem( "rememberOutputFolder", JSON.stringify(!rememberOutputFolder), ); }} />