From 7b472870359f2aa16f1eafcb5b6efc03c774d88a Mon Sep 17 00:00:00 2001 From: Feenix <25067102+NayamAmarshe@users.noreply.github.com> Date: Fri, 21 Apr 2023 00:04:49 +0530 Subject: [PATCH] Change outputfolder name --- package-lock.json | 14 +++++++------- package.json | 2 +- renderer/atoms/userSettingsAtom.ts | 7 +++++-- renderer/components/SettingsTab.tsx | 12 +++++++----- renderer/pages/index.tsx | 8 ++++++++ 5 files changed, 28 insertions(+), 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index a255cb6..5f36576 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,7 +35,7 @@ "@types/react-dom": "^18.0.8", "autoprefixer": "^10.4.13", "cross-env": "^7.0.3", - "electron": "^23.1.4", + "electron": "^23.2.4", "electron-builder": "^24.0.0", "next": "^13.0.2", "postcss": "^8.4.18", @@ -3221,9 +3221,9 @@ } }, "node_modules/electron": { - "version": "23.1.4", - "resolved": "https://registry.npmjs.org/electron/-/electron-23.1.4.tgz", - "integrity": "sha512-3Z6CpAPdhv6haYX9DTO7k0l6uAUreZM3/EngQYqGN3Gz7Fp0DPb/egt8BwR3ClG/jTlQM+PQ+5WkTK0eMjm07A==", + "version": "23.2.4", + "resolved": "https://registry.npmjs.org/electron/-/electron-23.2.4.tgz", + "integrity": "sha512-ceFd+KIhzK3srGY22kcBu8QH7hV1G3DHlgrg2LGjg7mgtzxlXeyKzk2Efq0iFNu3ly14QKfiN5gYdvEenmzOAA==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -10047,9 +10047,9 @@ } }, "electron": { - "version": "23.1.4", - "resolved": "https://registry.npmjs.org/electron/-/electron-23.1.4.tgz", - "integrity": "sha512-3Z6CpAPdhv6haYX9DTO7k0l6uAUreZM3/EngQYqGN3Gz7Fp0DPb/egt8BwR3ClG/jTlQM+PQ+5WkTK0eMjm07A==", + "version": "23.2.4", + "resolved": "https://registry.npmjs.org/electron/-/electron-23.2.4.tgz", + "integrity": "sha512-ceFd+KIhzK3srGY22kcBu8QH7hV1G3DHlgrg2LGjg7mgtzxlXeyKzk2Efq0iFNu3ly14QKfiN5gYdvEenmzOAA==", "dev": true, "requires": { "@electron/get": "^2.0.0", diff --git a/package.json b/package.json index 897635d..fbc3449 100644 --- a/package.json +++ b/package.json @@ -143,7 +143,7 @@ "@types/react-dom": "^18.0.8", "autoprefixer": "^10.4.13", "cross-env": "^7.0.3", - "electron": "^23.1.4", + "electron": "^23.2.4", "electron-builder": "^24.0.0", "next": "^13.0.2", "postcss": "^8.4.18", diff --git a/renderer/atoms/userSettingsAtom.ts b/renderer/atoms/userSettingsAtom.ts index fec7436..8d847a1 100644 --- a/renderer/atoms/userSettingsAtom.ts +++ b/renderer/atoms/userSettingsAtom.ts @@ -7,6 +7,9 @@ export const customModelsPathAtom = atomWithStorage( export const scaleAtom = atomWithStorage<"2" | "3" | "4">("scale", "4"); -export const batchModeAtom = atomWithStorage("batchMode", false); +export const batchModeAtom = atomWithStorage("batchMode", false); -export const saveOutputFolderAtom = atomWithStorage("saveOutputFolder", false); +export const rememberOutputFolderAtom = atomWithStorage( + "rememberOutputFolder", + false +); diff --git a/renderer/components/SettingsTab.tsx b/renderer/components/SettingsTab.tsx index 1ecc1c7..6d55d2c 100644 --- a/renderer/components/SettingsTab.tsx +++ b/renderer/components/SettingsTab.tsx @@ -4,8 +4,8 @@ import commands from "../../electron/commands"; import { useAtom } from "jotai"; import { customModelsPathAtom, + rememberOutputFolderAtom, scaleAtom, - saveOutputFolderAtom, } from "../atoms/userSettingsAtom"; import { modelsListAtom } from "../atoms/modelsListAtom"; @@ -45,7 +45,9 @@ function SettingsTab({ const [customModelsPath, setCustomModelsPath] = useAtom(customModelsPathAtom); const [modelOptions, setModelOptions] = useAtom(modelsListAtom); - const [saveOutputFolder, setSaveOutputFolder] = useAtom(saveOutputFolderAtom); + const [rememberOutputFolder, setRememberOutputFolder] = useAtom( + rememberOutputFolderAtom + ); const [scale, setScale] = useAtom(scaleAtom); @@ -156,9 +158,9 @@ function SettingsTab({ { - setSaveOutputFolder((oldValue) => !oldValue); + defaultChecked={rememberOutputFolder} + onChange={() => { + setRememberOutputFolder((oldValue) => !oldValue); }} /> diff --git a/renderer/pages/index.tsx b/renderer/pages/index.tsx index 51129c1..b1b575d 100644 --- a/renderer/pages/index.tsx +++ b/renderer/pages/index.tsx @@ -337,6 +337,14 @@ const Home = () => { e.preventDefault(); resetImagePaths(); + if ( + e.dataTransfer.items.length === 0 || + e.dataTransfer.files.length === 0 + ) { + alert("Please drag and drop an image"); + return; + } + const type = e.dataTransfer.items[0].type; console.log("🚀 => handleDrop => type", type); const filePath = e.dataTransfer.files[0].path;