2025-03-17 22:50:13 +03:00
|
|
|
import ImageEntry from "@/components/input/ImageEntry";
|
2024-11-26 23:41:49 +03:00
|
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
|
import {
|
|
|
|
|
Dialog,
|
|
|
|
|
DialogContent,
|
|
|
|
|
DialogDescription,
|
|
|
|
|
DialogFooter,
|
|
|
|
|
DialogHeader,
|
|
|
|
|
DialogTitle,
|
|
|
|
|
} from "@/components/ui/dialog";
|
2025-03-17 22:50:13 +03:00
|
|
|
import { useTranslation } from "react-i18next";
|
2024-11-26 23:41:49 +03:00
|
|
|
|
|
|
|
|
type UploadImageDialogProps = {
|
|
|
|
|
open: boolean;
|
|
|
|
|
title: string;
|
|
|
|
|
description?: string;
|
|
|
|
|
setOpen: (open: boolean) => void;
|
|
|
|
|
onSave: (file: File) => void;
|
|
|
|
|
};
|
|
|
|
|
export default function UploadImageDialog({
|
|
|
|
|
open,
|
|
|
|
|
title,
|
|
|
|
|
description,
|
|
|
|
|
setOpen,
|
|
|
|
|
onSave,
|
|
|
|
|
}: UploadImageDialogProps) {
|
2025-03-17 22:50:13 +03:00
|
|
|
const { t } = useTranslation("common");
|
2024-11-26 23:41:49 +03:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Dialog open={open} defaultOpen={false} onOpenChange={setOpen}>
|
|
|
|
|
<DialogContent>
|
|
|
|
|
<DialogHeader>
|
|
|
|
|
<DialogTitle>{title}</DialogTitle>
|
|
|
|
|
{description && <DialogDescription>{description}</DialogDescription>}
|
|
|
|
|
</DialogHeader>
|
2025-03-17 22:50:13 +03:00
|
|
|
<ImageEntry onSave={onSave}>
|
|
|
|
|
<DialogFooter className="pt-4">
|
2025-04-10 16:17:13 +03:00
|
|
|
<Button type="button" onClick={() => setOpen(false)}>
|
|
|
|
|
{t("button.cancel")}
|
|
|
|
|
</Button>
|
2025-03-17 22:50:13 +03:00
|
|
|
<Button variant="select" type="submit">
|
|
|
|
|
{t("button.save")}
|
|
|
|
|
</Button>
|
|
|
|
|
</DialogFooter>
|
|
|
|
|
</ImageEntry>
|
2024-11-26 23:41:49 +03:00
|
|
|
</DialogContent>
|
|
|
|
|
</Dialog>
|
|
|
|
|
);
|
|
|
|
|
}
|