diff --git a/renderer/components/LeftPaneImageSteps.tsx b/renderer/components/LeftPaneImageSteps.tsx index c0a3a88..0fed493 100644 --- a/renderer/components/LeftPaneImageSteps.tsx +++ b/renderer/components/LeftPaneImageSteps.tsx @@ -84,7 +84,7 @@ function LeftPaneImageSteps({ } else { const currentlySavedModel = JSON.parse( localStorage.getItem("model") - ) as typeof modelOptions[0]; + ) as (typeof modelOptions)[0]; setCurrentModel(currentlySavedModel); setModel(currentlySavedModel.value); } @@ -176,7 +176,7 @@ function LeftPaneImageSteps({ type="checkbox" className="toggle" defaultChecked={batchMode} - onClick={handleBatchMode}> + onClick={() => setBatchMode((oldValue) => !oldValue)}>
diff --git a/renderer/components/SettingsTab.tsx b/renderer/components/SettingsTab.tsx index 3c224d1..095ccda 100644 --- a/renderer/components/SettingsTab.tsx +++ b/renderer/components/SettingsTab.tsx @@ -2,7 +2,11 @@ import React, { useEffect, useState } from "react"; import { themeChange } from "theme-change"; import commands from "../../electron/commands"; import { useAtom } from "jotai"; -import { customModelsPathAtom, scaleAtom } from "../atoms/userSettingsAtom"; +import { + customModelsPathAtom, + rememberOutputFolderAtom, + scaleAtom, +} from "../atoms/userSettingsAtom"; import { modelsListAtom } from "../atoms/modelsListAtom"; interface IProps { @@ -22,8 +26,6 @@ interface IProps { function SettingsTab({ batchMode, setBatchMode, - rememberOutputFolder, - setRememberOutputFolder, imagePath, setModel, gpuId, @@ -48,6 +50,10 @@ function SettingsTab({ const [scale, setScale] = useAtom(scaleAtom); + const [rememberOutputFolder, setRememberOutputFolder] = useAtom( + rememberOutputFolderAtom + ); + useEffect(() => { themeChange(false); @@ -88,10 +94,6 @@ function SettingsTab({ localStorage.setItem("saveImageAs", format); }; - const handleRememberOutputFolder = () => { - setRememberOutputFolder((oldValue) => !oldValue); - }; - const handleGpuIdChange = (e) => { setGpuId(e.target.value); localStorage.setItem("gpuId", e.target.value); @@ -160,7 +162,9 @@ function SettingsTab({ type="checkbox" className="toggle-primary toggle" defaultChecked={rememberOutputFolder} - onChange={handleRememberOutputFolder} + onClick={() => { + setRememberOutputFolder((oldValue) => !oldValue); + }} /> @@ -191,8 +195,7 @@ function SettingsTab({ setCustomModelsPath(customModelPath); window.electron.send(commands.GET_MODELS_LIST, customModelPath); } - }} - > + }}> Select Folder @@ -217,8 +220,7 @@ function SettingsTab({ className={`btn-primary btn ${ saveImageAs === "png" && "btn-accent" }`} - onClick={() => setExportType("png")} - > + onClick={() => setExportType("png")}> PNG {/* JPG */} @@ -226,8 +228,7 @@ function SettingsTab({ className={`btn-primary btn ${ saveImageAs === "jpg" && "btn-accent" }`} - onClick={() => setExportType("jpg")} - > + onClick={() => setExportType("jpg")}> JPG {/* WEBP */} @@ -235,8 +236,7 @@ function SettingsTab({ className={`btn-primary btn ${ saveImageAs === "webp" && "btn-accent" }`} - onClick={() => setExportType("webp")} - > + onClick={() => setExportType("webp")}> WEBP @@ -272,8 +272,7 @@ function SettingsTab({
LOGS