import React, { useEffect, useState } from "react"; import Select from "react-select"; import ReactTooltip from "react-tooltip"; import { themeChange } from "theme-change"; interface IProps { progress: string; selectImageHandler: () => Promise; selectFolderHandler: () => Promise; handleModelChange: (e: any) => void; handleDrop: (e: any) => void; outputHandler: () => Promise; upscaylHandler: () => Promise; batchMode: boolean; setBatchMode: (arg: any) => void; imagePath: string; outputPath: string; doubleUpscayl: boolean; setDoubleUpscayl: (arg: boolean) => void; model: string; isVideo: boolean; setIsVideo: (arg: boolean) => void; saveImageAs: string; setSaveImageAs: (arg: string) => void; gpuId: string; setGpuId: (arg: string) => void; leftImageRef: any; dimensions: { width: number | null; height: number | null; }; } function LeftPaneImageSteps({ progress, selectImageHandler, selectFolderHandler, handleModelChange, handleDrop, outputHandler, upscaylHandler, batchMode, setBatchMode, imagePath, outputPath, doubleUpscayl, setDoubleUpscayl, model, isVideo, setIsVideo, gpuId, setGpuId, saveImageAs, setSaveImageAs, dimensions, }: IProps) { useEffect(() => { themeChange(false); if (!localStorage.getItem("saveImageAs")) { localStorage.setItem("saveImageAs", "png"); } else { setSaveImageAs(localStorage.getItem("saveImageAs")); } }, []); const setExportType = (format: string) => { setSaveImageAs(format); localStorage.setItem("saveImageAs", format); }; const handleBatchMode = () => { setBatchMode((oldValue) => !oldValue); }; const handleGpuIdChange = (e) => { setGpuId(e.target.value); }; const customStyles = { option: (provided, state) => ({ ...provided, borderBottom: "1px dotted pink", color: state.isSelected ? "red" : "blue", padding: 20, }), control: () => ({ // none of react-select's styles are passed to width: 200, }), singleValue: (provided, state) => { const opacity = state.isDisabled ? 0.5 : 1; const transition = "opacity 300ms"; return { ...provided, opacity, transition }; }, }; const modelOptions = [ { label: "General Photo (Real-ESRGAN)", value: "realesrgan-x4plus" }, { label: "General Photo (Remacri)", value: "remacri" }, { label: "General Photo (Ultramix Balanced)", value: "ultramix_balanced" }, { label: "General Photo (Ultrasharp)", value: "ultrasharp" }, { label: "Digital Art", value: "realesrgan-x4plus-anime" }, { label: "Sharpen Image", value: "models-DF2K" }, ]; const availableThemes = [ { label: "light", value: "light" }, { label: "dark", value: "dark" }, { label: "cupcake", value: "cupcake" }, { label: "bumblebee", value: "bumblebee" }, { label: "emerald", value: "emerald" }, { label: "corporate", value: "corporate" }, { label: "synthwave", value: "synthwave" }, { label: "retro", value: "retro" }, { label: "cyberpunk", value: "cyberpunk" }, { label: "valentine", value: "valentine" }, { label: "halloween", value: "halloween" }, { label: "garden", value: "garden" }, { label: "forest", value: "forest" }, { label: "aqua", value: "aqua" }, { label: "lofi", value: "lofi" }, { label: "pastel", value: "pastel" }, { label: "fantasy", value: "fantasy" }, { label: "wireframe", value: "wireframe" }, { label: "black", value: "black" }, { label: "luxury", value: "luxury" }, { label: "dracula", value: "dracula" }, { label: "cmyk", value: "cmyk" }, { label: "autumn", value: "autumn" }, { label: "business", value: "business" }, { label: "acid", value: "acid" }, { label: "lemonade", value: "lemonade" }, { label: "night", value: "night" }, { label: "coffee", value: "coffee" }, { label: "winter", value: "winter" }, ]; useEffect(() => {}, [imagePath]); return (
{/* BATCH OPTION */}

Batch Upscale

{/* STEP 1 */}

Step 1

{/* STEP 2 */}

Step 2

Select Upscaling Type

{ if (e.target.checked) { setDoubleUpscayl(true); } else { setDoubleUpscayl(false); } }} />

{ setDoubleUpscayl(!doubleUpscayl); }}> Double Upscayl

)}
{/* STEP 3 */}

Step 3

Defaults to Image's path

{/* STEP 4 */}

Step 4

{dimensions.width && dimensions.height && (

Upscale from{" "} {dimensions.width}x{dimensions.height} {" "} to{" "} {dimensions.width * 4}x{dimensions.height * 4}

)}
Advanced Options

Save Image As:

Upscayl Theme:

GPU ID:

); } export default LeftPaneImageSteps;