From cbb2595c8f06b2dc3f7e8d12911449902a575354 Mon Sep 17 00:00:00 2001 From: TGS963 Date: Sun, 18 Sep 2022 20:00:03 +0530 Subject: [PATCH] added batch interface and completion button --- main/commands.js | 1 + main/index.js | 5 +++ renderer/pages/index.jsx | 68 +++++++++++++++++++++++++--------------- 3 files changed, 48 insertions(+), 26 deletions(-) diff --git a/main/commands.js b/main/commands.js index 57e884e..05b0693 100644 --- a/main/commands.js +++ b/main/commands.js @@ -11,6 +11,7 @@ const commands = { FOLDER_UPSCAYL_DONE: "Folder upscaling successful", FOLDER_UPSCAYL_PROGRESS: "Send Folder Upscaling Progress from Main to Renderer", + OPEN_FOLDER: "Open Folder", }; module.exports = commands; diff --git a/main/index.js b/main/index.js index 0c3616f..b8a9f99 100644 --- a/main/index.js +++ b/main/index.js @@ -342,6 +342,11 @@ ipcMain.on(commands.FOLDER_UPSCAYL, async (event, payload) => { }); }); +ipcMain.on(commands.OPEN_FOLDER, async (event, payload) => { + console.log(payload); + shell.openPath(payload); +}); + //------------------------Auto-Update Code-----------------------------// // ! AUTO UPDATE STUFF autoUpdater.on("update-available", (_event, releaseNotes, releaseName) => { diff --git a/renderer/pages/index.jsx b/renderer/pages/index.jsx index fbbdd0b..8d460c4 100644 --- a/renderer/pages/index.jsx +++ b/renderer/pages/index.jsx @@ -133,6 +133,9 @@ const Home = () => { e.preventDefault(); console.log("drag over"); }; + const openFolderHandler = (e) => { + window.electron.send(commands.OPEN_FOLDER, upscaledBatchFolderPath); + }; const allowedFileTypes = ["png", "jpg", "jpeg", "webp"]; @@ -270,8 +273,9 @@ const Home = () => { {imagePath.length === 0 && batchFolderPath.length === 0 ? ( - ) : !batchMode ? ( - upscaledImagePath.length === 0 ? ( + ) : upscaledImagePath.length === 0 && + upscaledBatchFolderPath.length === 0 ? ( + !batchMode ? ( { alt="" /> ) : ( - - } - itemTwo={ - - } - className="h-screen" - /> +

+ Selected folder: {batchFolderPath} +

) + ) : !batchMode ? ( + + } + itemTwo={ + + } + className="h-screen" + /> ) : ( -

- Finished Upscaling Folder! -

+ <> +

+ Finished Upscaling Folder! +

+ + )}