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