2024-09-01 14:01:45 +02:00
|
|
|
import { translationAtom } from "@/atoms/translations-atom";
|
|
|
|
import { useAtomValue } from "jotai";
|
|
|
|
|
2023-07-22 13:07:53 +02:00
|
|
|
type ImageFormatSelectProps = {
|
|
|
|
batchMode: boolean;
|
|
|
|
saveImageAs: string;
|
|
|
|
setExportType: (arg: string) => void;
|
|
|
|
};
|
|
|
|
|
|
|
|
export function ImageFormatSelect({
|
|
|
|
batchMode,
|
|
|
|
saveImageAs,
|
|
|
|
setExportType,
|
|
|
|
}: ImageFormatSelectProps) {
|
2024-09-01 14:01:45 +02:00
|
|
|
const t = useAtomValue(translationAtom);
|
|
|
|
|
2023-07-22 13:07:53 +02:00
|
|
|
return (
|
|
|
|
<div className="flex flex-col gap-2">
|
|
|
|
<div className="flex flex-row gap-1">
|
2024-09-01 14:01:45 +02:00
|
|
|
<p className="text-sm font-medium">
|
2024-09-03 09:34:58 +02:00
|
|
|
{t("SETTINGS.IMAGE_FORMAT.TITLE")}
|
2024-09-01 14:01:45 +02:00
|
|
|
</p>
|
2023-11-23 06:39:46 +01:00
|
|
|
{/* <p className="badge-primary badge text-[10px] font-medium">
|
2023-07-22 13:07:53 +02:00
|
|
|
EXPERIMENTAL
|
2023-11-23 06:39:46 +01:00
|
|
|
</p> */}
|
2023-07-22 13:07:53 +02:00
|
|
|
</div>
|
|
|
|
<div className="flex flex-col gap-2">
|
2023-11-23 06:39:46 +01:00
|
|
|
{batchMode && <p className="text-xs text-base-content/80"></p>}
|
2023-07-22 13:07:53 +02:00
|
|
|
<div className="flex flex-wrap gap-2">
|
|
|
|
{/* PNG */}
|
|
|
|
<button
|
2023-11-23 06:39:46 +01:00
|
|
|
className={`btn ${saveImageAs === "png" && "btn-primary"}`}
|
2024-04-21 19:14:39 +02:00
|
|
|
onClick={() => setExportType("png")}
|
|
|
|
>
|
2024-09-03 09:34:58 +02:00
|
|
|
{t("SETTINGS.IMAGE_FORMAT.PNG")}
|
2023-07-22 13:07:53 +02:00
|
|
|
</button>
|
|
|
|
{/* JPG */}
|
|
|
|
<button
|
2023-11-23 06:39:46 +01:00
|
|
|
className={`btn ${saveImageAs === "jpg" && "btn-primary"}`}
|
2024-04-21 19:14:39 +02:00
|
|
|
onClick={() => setExportType("jpg")}
|
|
|
|
>
|
2024-09-03 09:34:58 +02:00
|
|
|
{t("SETTINGS.IMAGE_FORMAT.JPG")}
|
2023-07-22 13:07:53 +02:00
|
|
|
</button>
|
2024-01-15 10:07:22 +01:00
|
|
|
{/* WEBP */}
|
2023-07-22 13:07:53 +02:00
|
|
|
<button
|
2024-01-15 10:07:22 +01:00
|
|
|
className={`btn ${saveImageAs === "webp" && "btn-primary"}`}
|
2024-04-21 19:14:39 +02:00
|
|
|
onClick={() => setExportType("webp")}
|
|
|
|
>
|
2024-09-03 09:34:58 +02:00
|
|
|
{t("SETTINGS.IMAGE_FORMAT.WEBP")}
|
2024-01-15 10:07:22 +01:00
|
|
|
</button>
|
2023-07-22 13:07:53 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|