1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-12-23 21:05:06 +01:00
upscayl/renderer/components/upscayl-tab/config/LeftPaneVideoSteps.tsx

108 lines
2.9 KiB
TypeScript
Raw Normal View History

2022-11-23 19:24:30 +01:00
import React from "react";
import Select from "react-select";
interface IProps {
progress: string;
2022-11-25 08:30:03 +01:00
selectVideoHandler: () => Promise<void>;
2022-11-23 19:24:30 +01:00
handleModelChange: (e: any) => void;
handleDrop: (e: any) => void;
outputHandler: () => Promise<void>;
upscaylHandler: () => Promise<void>;
2022-11-25 08:30:03 +01:00
videoPath: string;
2022-11-23 19:24:30 +01:00
outputPath: string;
model: string;
isVideo: boolean;
setIsVideo: (arg: boolean) => void;
}
function LeftPaneVideoSteps({
progress,
2022-11-25 08:30:03 +01:00
selectVideoHandler,
2022-11-23 19:24:30 +01:00
handleModelChange,
handleDrop,
outputHandler,
upscaylHandler,
2022-11-25 08:30:03 +01:00
videoPath,
2022-11-23 19:24:30 +01:00
outputPath,
model,
isVideo,
setIsVideo,
}: IProps) {
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 <Control />
width: 200,
}),
singleValue: (provided, state) => {
const opacity = state.isDisabled ? 0.5 : 1;
const transition = "opacity 300ms";
return { ...provided, opacity, transition };
},
};
const modelOptions = [
2022-11-25 08:30:03 +01:00
{ label: "2x Digital Art", value: "realesr-animevideov3-x2" },
{ label: "3x Digital Art", value: "realesr-animevideov3-x3" },
{ label: "4x Digital Art", value: "realesr-animevideov3-x4" },
2022-11-23 19:24:30 +01:00
];
return (
<div className="animate-step-in animate flex h-screen flex-col gap-7 overflow-y-auto p-5 overflow-x-hidden">
{/* STEP 1 */}
2022-11-25 08:30:03 +01:00
<div data-tip={videoPath}>
2022-11-23 19:24:30 +01:00
<p className="step-heading">Step 1</p>
2022-11-25 08:30:03 +01:00
<button className="btn-primary btn" onClick={selectVideoHandler}>
2022-11-23 19:24:30 +01:00
Select Video
</button>
</div>
{/* STEP 2 */}
2022-11-25 08:30:03 +01:00
<div className="animate-step-in">
2022-11-23 19:24:30 +01:00
<p className="step-heading">Step 2</p>
2022-11-25 08:30:03 +01:00
<p className="mb-2 text-sm">Select Scaling</p>
<Select
options={modelOptions}
components={{
IndicatorSeparator: () => null,
DropdownIndicator: () => null,
}}
onChange={handleModelChange}
className="react-select-container"
classNamePrefix="react-select"
defaultValue={modelOptions[0]}
/>
</div>
{/* STEP 3 */}
<div className="animate-step-in" data-tip={outputPath}>
<p className="step-heading">Step 3</p>
2022-11-23 19:24:30 +01:00
<p className="mb-2 text-sm">Defaults to Video's path</p>
<button className="btn-primary btn" onClick={outputHandler}>
Set Output Folder
</button>
</div>
{/* STEP 4 */}
<div className="animate-step-in">
<p className="step-heading">Step 4</p>
<button
className="btn-accent btn"
onClick={upscaylHandler}
disabled={progress.length > 0}>
{progress.length > 0 ? "Upscayling⏳" : "Upscayl"}
</button>
</div>
</div>
);
}
export default LeftPaneVideoSteps;