1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-11-14 10:47:56 +01:00

Added isVideo

This commit is contained in:
Feenix 2022-11-15 20:24:06 +05:30
parent a5dd8b89ea
commit c7ba506782

View File

@ -2,9 +2,45 @@ import React from "react";
import Select from "react-select"; import Select from "react-select";
import ReactTooltip from "react-tooltip"; import ReactTooltip from "react-tooltip";
function LeftPaneSteps(props) { interface IProps {
progress: string;
selectImageHandler: () => Promise<void>;
selectFolderHandler: () => Promise<void>;
handleModelChange: (e: any) => void;
handleDrop: (e: any) => void;
outputHandler: () => Promise<void>;
upscaylHandler: () => Promise<void>;
batchMode: boolean;
setBatchMode: (arg: any) => void;
imagePath: string;
outputPath: string;
doubleUpscayl: boolean;
setDoubleUpscayl: (arg: boolean) => void;
model: string;
isVideo: boolean;
setIsVideo: (arg: boolean) => void;
}
function LeftPaneSteps({
progress,
selectImageHandler,
selectFolderHandler,
handleModelChange,
handleDrop,
outputHandler,
upscaylHandler,
batchMode,
setBatchMode,
imagePath,
outputPath,
doubleUpscayl,
setDoubleUpscayl,
model,
isVideo,
setIsVideo,
}: IProps) {
const handleBatchMode = () => { const handleBatchMode = () => {
props.setBatchMode((oldValue) => !oldValue); setBatchMode((oldValue) => !oldValue);
}; };
const customStyles = { const customStyles = {
@ -36,8 +72,20 @@ function LeftPaneSteps(props) {
<div className="animate-step-in animate flex h-screen flex-col gap-7 overflow-y-auto p-5 overflow-x-hidden"> <div className="animate-step-in animate flex h-screen flex-col gap-7 overflow-y-auto p-5 overflow-x-hidden">
<div className="flex items-center justify-center gap-2 font-medium"> <div className="flex items-center justify-center gap-2 font-medium">
<p>Image</p> <p>Image</p>
<input type="radio" name="radio-1" className="radio" /> <input
<input type="radio" name="radio-1" className="radio" /> type="radio"
name="radio-1"
className="radio"
checked={!isVideo}
onClick={() => setIsVideo(false)}
/>
<input
type="radio"
name="radio-1"
className="radio"
checked={isVideo}
onClick={() => setIsVideo(true)}
/>
<p>Video</p> <p>Video</p>
</div> </div>
@ -57,17 +105,13 @@ function LeftPaneSteps(props) {
</div> </div>
{/* STEP 1 */} {/* STEP 1 */}
<div data-tip={props.imagePath}> <div data-tip={imagePath}>
<p className="step-heading">Step 1</p> <p className="step-heading">Step 1</p>
<button <button
className="btn-primary btn" className="btn-primary btn"
onClick={ onClick={!batchMode ? selectImageHandler : selectFolderHandler}
!props.batchMode
? props.selectImageHandler
: props.selectFolderHandler
}
> >
Select {props.batchMode ? "Folder" : "Image"} Select {batchMode ? "Folder" : "Image"}
</button> </button>
</div> </div>
@ -82,30 +126,30 @@ function LeftPaneSteps(props) {
IndicatorSeparator: () => null, IndicatorSeparator: () => null,
DropdownIndicator: () => null, DropdownIndicator: () => null,
}} }}
onChange={props.handleModelChange} onChange={handleModelChange}
className="react-select-container" className="react-select-container"
classNamePrefix="react-select" classNamePrefix="react-select"
defaultValue={modelOptions[0]} defaultValue={modelOptions[0]}
/> />
{props.model !== "models-DF2K" && !props.batchMode && ( {model !== "models-DF2K" && !batchMode && (
<div className="mt-2 flex items-center gap-1"> <div className="mt-2 flex items-center gap-1">
<input <input
type="checkbox" type="checkbox"
className="checkbox" className="checkbox"
checked={props.doubleUpscayl} checked={doubleUpscayl}
onChange={(e) => { onChange={(e) => {
if (e.target.checked) { if (e.target.checked) {
props.setDoubleUpscayl(true); setDoubleUpscayl(true);
} else { } else {
props.setDoubleUpscayl(false); setDoubleUpscayl(false);
} }
}} }}
/> />
<p <p
className="cursor-pointer text-sm" className="cursor-pointer text-sm"
onClick={(e) => { onClick={(e) => {
props.setDoubleUpscayl(!props.doubleUpscayl); setDoubleUpscayl(!doubleUpscayl);
}} }}
> >
Double Upscayl Double Upscayl
@ -121,10 +165,10 @@ function LeftPaneSteps(props) {
</div> </div>
{/* STEP 3 */} {/* STEP 3 */}
<div className="animate-step-in" data-tip={props.outputPath}> <div className="animate-step-in" data-tip={outputPath}>
<p className="step-heading">Step 3</p> <p className="step-heading">Step 3</p>
<p className="mb-2 text-sm">Defaults to Image's path</p> <p className="mb-2 text-sm">Defaults to Image's path</p>
<button className="btn-primary btn" onClick={props.outputHandler}> <button className="btn-primary btn" onClick={outputHandler}>
Set Output Folder Set Output Folder
</button> </button>
</div> </div>
@ -145,10 +189,10 @@ function LeftPaneSteps(props) {
<p className="step-heading">Step 4</p> <p className="step-heading">Step 4</p>
<button <button
className="btn-accent btn" className="btn-accent btn"
onClick={props.upscaylHandler} onClick={upscaylHandler}
disabled={props.progress.length > 0} disabled={progress.length > 0}
> >
{props.progress.length > 0 ? "Upscayling⏳" : "Upscayl"} {progress.length > 0 ? "Upscayling⏳" : "Upscayl"}
</button> </button>
</div> </div>
</div> </div>