2024-04-20 17:44:42 +02:00
|
|
|
import { useCustomWidthAtom } from "@/atoms/userSettingsAtom";
|
|
|
|
import { useAtom } from "jotai";
|
|
|
|
|
2023-07-22 13:07:53 +02:00
|
|
|
type ImageScaleSelectProps = {
|
|
|
|
scale: "4" | "2" | "3";
|
|
|
|
setScale: (arg: "4" | "2" | "3") => void;
|
|
|
|
};
|
|
|
|
|
|
|
|
export function ImageScaleSelect({ scale, setScale }: ImageScaleSelectProps) {
|
2024-04-20 17:44:42 +02:00
|
|
|
const [useCustomWidth, setUseCustomWidth] = useAtom(useCustomWidthAtom);
|
|
|
|
|
2023-07-22 13:07:53 +02:00
|
|
|
return (
|
2024-04-20 17:44:42 +02:00
|
|
|
<div className={`${useCustomWidth && "opacity-50"}`}>
|
2023-07-22 13:07:53 +02:00
|
|
|
<div className="flex flex-row gap-1">
|
2024-04-20 17:44:42 +02:00
|
|
|
<p className="text-sm font-medium">
|
|
|
|
IMAGE SCALE ({scale}X) {useCustomWidth && "DISABLED"}
|
|
|
|
</p>
|
2023-07-22 13:07:53 +02:00
|
|
|
</div>
|
2024-04-17 18:25:40 +02:00
|
|
|
<p className="text-xs text-base-content/80">
|
|
|
|
Anything above 4X (except 16X Double Upscayl) only resizes the image and
|
|
|
|
does not use AI upscaling.
|
|
|
|
</p>
|
2024-04-21 19:14:39 +02:00
|
|
|
{parseInt(scale) >= 6 && (
|
|
|
|
<p className="text-xs text-base-content/80 text-red-500">
|
|
|
|
This may cause performance issues on some devices!
|
|
|
|
</p>
|
|
|
|
)}
|
2023-07-22 13:07:53 +02:00
|
|
|
<input
|
|
|
|
type="range"
|
2023-07-23 08:32:22 +02:00
|
|
|
min="1"
|
2024-04-09 20:21:54 +02:00
|
|
|
max="16"
|
2024-04-21 19:14:39 +02:00
|
|
|
placeholder="Example: 1320"
|
2023-07-22 13:07:53 +02:00
|
|
|
value={scale}
|
|
|
|
onChange={(e: any) => {
|
|
|
|
setScale(e.target.value.toString());
|
|
|
|
}}
|
|
|
|
step="1"
|
|
|
|
className="range range-primary mt-2"
|
2024-04-20 17:44:42 +02:00
|
|
|
disabled={useCustomWidth}
|
2023-07-22 13:07:53 +02:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|