From 649f2d239d43ff04cc35b94cb541d570a2fb1a47 Mon Sep 17 00:00:00 2001 From: Nayam Amarshe <25067102+NayamAmarshe@users.noreply.github.com> Date: Wed, 7 Feb 2024 06:53:19 +0530 Subject: [PATCH] Fix lens and update errors. --- .prettierrc | 3 ++ electron/utils/convert-and-scale.ts | 1 - package-lock.json | 8 ++--- package.json | 2 +- renderer/pages/index.tsx | 55 ++++++++++++++++------------- renderer/styles/globals.css | 8 ++--- 6 files changed, 42 insertions(+), 35 deletions(-) create mode 100644 .prettierrc diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..8b0bc4e --- /dev/null +++ b/.prettierrc @@ -0,0 +1,3 @@ +{ + "plugins": ["prettier-plugin-tailwindcss"] +} \ No newline at end of file diff --git a/electron/utils/convert-and-scale.ts b/electron/utils/convert-and-scale.ts index cd6495d..998b966 100644 --- a/electron/utils/convert-and-scale.ts +++ b/electron/utils/convert-and-scale.ts @@ -106,7 +106,6 @@ const convertAndScale = async ( lossless: compression === 0, smartSubsample: true, }), - force: true, }) .toFile(processedImagePath); diff --git a/package-lock.json b/package-lock.json index 815e4d8..9c47035 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,7 +40,7 @@ "electron-builder": "^24.9.1", "next": "^13.5.6", "postcss": "^8.4.31", - "prettier": "^3.0.0", + "prettier": "^3.2.5", "prettier-plugin-tailwindcss": "^0.4.1", "react": "^18.2.0", "react-dom": "^18.2.0", @@ -6156,9 +6156,9 @@ } }, "node_modules/prettier": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.4.tgz", - "integrity": "sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" diff --git a/package.json b/package.json index 599acaf..075d307 100644 --- a/package.json +++ b/package.json @@ -216,7 +216,7 @@ "electron-builder": "^24.9.1", "next": "^13.5.6", "postcss": "^8.4.31", - "prettier": "^3.0.0", + "prettier": "^3.2.5", "prettier-plugin-tailwindcss": "^0.4.1", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/renderer/pages/index.tsx b/renderer/pages/index.tsx index 04720f8..98c4e10 100644 --- a/renderer/pages/index.tsx +++ b/renderer/pages/index.tsx @@ -74,7 +74,7 @@ const Home = () => { const [modelOptions, setModelOptions] = useAtom(modelsListAtom); const [scale] = useAtom(scaleAtom); const [dontShowCloudModal, setDontShowCloudModal] = useAtom( - dontShowCloudModalAtom + dontShowCloudModalAtom, ); const noImageProcessing = useAtomValue(noImageProcessingAtom); const [news, setNews] = useAtom(newsAtom); @@ -99,7 +99,7 @@ const Home = () => { useEffect(() => { // UPSCAYL VERSION const upscaylVersion = navigator?.userAgent?.match( - /Upscayl\/([\d\.]+\d+)/ + /Upscayl\/([\d\.]+\d+)/, )[1]; setVersion(upscaylVersion); }, []); @@ -109,7 +109,7 @@ const Home = () => { const handleErrors = (data: string) => { if (data.includes("invalid gpu")) { alert( - "Error. Please make sure you have a Vulkan compatible GPU (Most modern GPUs support Vulkan). Upscayl does not work with CPU or iGPU sadly." + "Error. Please make sure you have a Vulkan compatible GPU (Most modern GPUs support Vulkan). Upscayl does not work with CPU or iGPU sadly.", ); resetImagePaths(); } else if (data.includes("failed")) { @@ -117,12 +117,12 @@ const Home = () => { alert( data.includes("encode") ? `ENCODING ERROR: ${data}. For troubleshooting, please read the Upscayl Wiki.` - : `DECODING ERROR: ${data}. Additional Info: This image is possibly corrupt or not supported by Upscayl, or your GPU drivers are acting funny (PLEASE READ THE UPSCAYL WIKI). You could try converting the image into another format and upscaling again. Also make sure that the output path is correct and you have the proper write permissions for the directory. If not, then unfortunately there's not much we can do to help, sorry.` + : `DECODING ERROR: ${data}. Additional Info: This image is possibly corrupt or not supported by Upscayl, or your GPU drivers are acting funny (PLEASE READ THE UPSCAYL WIKI). You could try converting the image into another format and upscaling again. Also make sure that the output path is correct and you have the proper write permissions for the directory. If not, then unfortunately there's not much we can do to help, sorry.`, ); resetImagePaths(); } else if (data.includes("uncaughtException")) { alert( - "Upscayl encountered an error. Possibly, the upscayl binary failed to execute the commands properly. Try checking the logs to see if you get any information. You can post an issue on Upscayl's GitHub repository for more help." + "Upscayl encountered an error. Possibly, the upscayl binary failed to execute the commands properly. Try checking the logs to see if you get any information. You can post an issue on Upscayl's GitHub repository for more help.", ); resetImagePaths(); } @@ -134,7 +134,7 @@ const Home = () => { if (data) { setOs(data); } - } + }, ); // LOG window.electron.on(COMMAND.LOG, (_, data: string) => { @@ -217,7 +217,7 @@ const Home = () => { const uniqueModelOptions = combinedModelOptions.filter( // Check if any model in the array appears more than once (model, index, array) => - array.findIndex((t) => t.value === model.value) === index + array.findIndex((t) => t.value === model.value) === index, ); setModelOptions(uniqueModelOptions); }); @@ -226,7 +226,7 @@ const Home = () => { // FETCH CUSTOM MODELS FROM CUSTOM MODELS PATH useEffect(() => { const customModelsPath = JSON.parse( - localStorage.getItem("customModelsPath") + localStorage.getItem("customModelsPath"), ); if (customModelsPath !== null) { window.electron.send(COMMAND.GET_MODELS_LIST, customModelsPath); @@ -364,7 +364,7 @@ const Home = () => { logit("🔀 Model changed: ", e.value); localStorage.setItem( "model", - JSON.stringify({ label: e.label, value: e.value }) + JSON.stringify({ label: e.label, value: e.value }), ); }; @@ -517,7 +517,7 @@ const Home = () => { Upscayl icon ); } @@ -533,16 +533,17 @@ const Home = () => { /> )} {window.electron.platform === "mac" && ( -
+
)} {/* HEADER */}
{!dontShowCloudModal && featureFlags.SHOW_UPSCAYL_CLOUD_INFO && ( )} @@ -613,9 +614,10 @@ const Home = () => { selectImageHandler(); } }} - onPaste={(e) => handlePaste(e)}> + onPaste={(e) => handlePaste(e)} + > {window.electron.platform === "mac" && ( -
+
)} {progress.length > 0 && upscaledImagePath.length === 0 && @@ -677,8 +679,9 @@ const Home = () => { All done!

@@ -693,10 +696,11 @@ const Home = () => { upscaledImagePath && imagePath && (
+ className="img-with-border group relative h-full w-full overflow-hidden" + onMouseMove={handleMouseMoveCompare} + > { }} />
diff --git a/renderer/styles/globals.css b/renderer/styles/globals.css index b9e3eb8..fbcae16 100644 --- a/renderer/styles/globals.css +++ b/renderer/styles/globals.css @@ -153,7 +153,7 @@ } [data-theme="upscayl"] .btn { - @apply font-medium normal-case !min-h-min h-10 py-2 px-3; + @apply h-10 !min-h-min px-3 py-2 font-medium normal-case; } [data-theme="upscayl"] input[type="range"] { @@ -165,15 +165,15 @@ } [data-theme="upscayl"] .react-select-container .react-select__single-value { - @apply text-primary-content normal-case font-medium; + @apply font-medium normal-case text-primary-content; } [data-theme="upscayl"] .react-select-container .react-select__input-container { - @apply text-xs text-primary-content normal-case font-medium; + @apply text-xs font-medium normal-case text-primary-content; } [data-theme="upscayl"] .react-select-container .react-select__menu { - @apply rounded-lg bg-primary p-1 normal-case font-medium; + @apply rounded-lg bg-primary p-1 font-medium normal-case; } .mac-titlebar {