mirror of
https://github.com/upscayl/upscayl.git
synced 2024-12-19 10:55:53 +01:00
95843ded88
* Initial refactor * Remove unused imports * Update code * Refactor and Update Code - Change file names to kebab-caase - Add new useTranslation Hook - Change useLog hook name to useLogger - Update translation hook to provide autocomplete * Update import and component name * Rename files and components * Update locales * Update electron commands * Update var * Change Lowercase * Replace filter with map * Add props * Update flag check * Add validate paths * Update formats * Update import * Update function * Update function and translation * Update handlePaste
56 lines
1.6 KiB
TypeScript
56 lines
1.6 KiB
TypeScript
import { translationAtom } from "@/atoms/translations-atom";
|
|
import { useAtomValue } from "jotai";
|
|
|
|
type ImageFormatSelectProps = {
|
|
batchMode: boolean;
|
|
saveImageAs: string;
|
|
setExportType: (arg: string) => void;
|
|
};
|
|
|
|
export function SelectImageFormat({
|
|
batchMode,
|
|
saveImageAs,
|
|
setExportType,
|
|
}: ImageFormatSelectProps) {
|
|
const t = useAtomValue(translationAtom);
|
|
|
|
return (
|
|
<div className="flex flex-col gap-2">
|
|
<div className="flex flex-row gap-1">
|
|
<p className="text-sm font-medium">
|
|
{t("SETTINGS.IMAGE_FORMAT.TITLE")}
|
|
</p>
|
|
{/* <p className="badge-primary badge text-[10px] font-medium">
|
|
EXPERIMENTAL
|
|
</p> */}
|
|
</div>
|
|
<div className="flex flex-col gap-2">
|
|
{batchMode && <p className="text-xs text-base-content/80"></p>}
|
|
<div className="flex flex-wrap gap-2">
|
|
{/* PNG */}
|
|
<button
|
|
className={`btn ${saveImageAs === "png" && "btn-primary"}`}
|
|
onClick={() => setExportType("png")}
|
|
>
|
|
{t("SETTINGS.IMAGE_FORMAT.PNG")}
|
|
</button>
|
|
{/* JPG */}
|
|
<button
|
|
className={`btn ${saveImageAs === "jpg" && "btn-primary"}`}
|
|
onClick={() => setExportType("jpg")}
|
|
>
|
|
{t("SETTINGS.IMAGE_FORMAT.JPG")}
|
|
</button>
|
|
{/* WEBP */}
|
|
<button
|
|
className={`btn ${saveImageAs === "webp" && "btn-primary"}`}
|
|
onClick={() => setExportType("webp")}
|
|
>
|
|
{t("SETTINGS.IMAGE_FORMAT.WEBP")}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|