mirror of
https://github.com/upscayl/upscayl.git
synced 2024-11-27 17:00:52 +01:00
Added model default value
This commit is contained in:
parent
fb86047a84
commit
e9d66e65ad
@ -53,13 +53,29 @@ function LeftPaneImageSteps({
|
||||
setSaveImageAs,
|
||||
dimensions,
|
||||
}: IProps) {
|
||||
const [currentModel, setCurrentModel] = useState<{
|
||||
label: string;
|
||||
value: string;
|
||||
}>({
|
||||
label: null,
|
||||
value: null,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
themeChange(false);
|
||||
|
||||
if (!localStorage.getItem("saveImageAs")) {
|
||||
localStorage.setItem("saveImageAs", "png");
|
||||
} else {
|
||||
setSaveImageAs(localStorage.getItem("saveImageAs"));
|
||||
}
|
||||
|
||||
if (!localStorage.getItem("model")) {
|
||||
setCurrentModel(modelOptions[0]);
|
||||
localStorage.setItem("model", JSON.stringify(modelOptions[0]));
|
||||
} else {
|
||||
setCurrentModel(JSON.parse(localStorage.getItem("model")));
|
||||
}
|
||||
}, []);
|
||||
|
||||
const setExportType = (format: string) => {
|
||||
@ -176,7 +192,7 @@ function LeftPaneImageSteps({
|
||||
onChange={handleModelChange}
|
||||
className="react-select-container"
|
||||
classNamePrefix="react-select"
|
||||
defaultValue={modelOptions[0]}
|
||||
value={currentModel}
|
||||
/>
|
||||
|
||||
{model !== "models-DF2K" && !batchMode && (
|
||||
|
@ -240,6 +240,10 @@ const Home = () => {
|
||||
|
||||
const handleModelChange = (e) => {
|
||||
setModel(e.value);
|
||||
localStorage.setItem(
|
||||
"model",
|
||||
JSON.stringify({ label: e.label, value: e.value })
|
||||
);
|
||||
if (e.value === "models-DF2K") {
|
||||
setDoubleUpscayl(false);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user