Files
frigate/web/src/components/overlay/SaveExportOverlay.tsx
T

76 lines
2.1 KiB
TypeScript
Raw Normal View History

import { LuVideo, LuX } from "react-icons/lu";
2024-03-27 17:03:05 -06:00
import { Button } from "../ui/button";
import { FaCompactDisc } from "react-icons/fa";
2024-06-02 12:00:59 -05:00
import { cn } from "@/lib/utils";
import { useTranslation } from "react-i18next";
2024-03-27 17:03:05 -06:00
type SaveExportOverlayProps = {
className: string;
show: boolean;
2026-04-14 09:19:50 -05:00
hidePreview?: boolean;
saveLabel?: string;
isSaving?: boolean;
onPreview: () => void;
2024-03-27 17:03:05 -06:00
onSave: () => void;
onCancel: () => void;
};
export default function SaveExportOverlay({
className,
show,
2026-04-14 09:19:50 -05:00
hidePreview = false,
saveLabel,
isSaving = false,
onPreview,
2024-03-27 17:03:05 -06:00
onSave,
onCancel,
}: SaveExportOverlayProps) {
const { t } = useTranslation("components/dialog");
2024-03-27 17:03:05 -06:00
return (
<div className={className}>
<div
2024-06-02 12:00:59 -05:00
className={cn(
"pointer-events-auto flex items-center justify-center gap-2 rounded-lg px-2",
show ? "duration-500 animate-in slide-in-from-top" : "invisible",
"mx-auto mt-5 text-center",
)}
2024-03-27 17:03:05 -06:00
>
<Button
className="flex items-center gap-1 text-primary"
aria-label={t("button.cancel", { ns: "common" })}
size="sm"
2026-04-14 09:19:50 -05:00
disabled={isSaving}
onClick={onCancel}
>
<LuX />
{t("button.cancel", { ns: "common" })}
</Button>
2026-04-14 09:19:50 -05:00
{!hidePreview && (
<Button
className="flex items-center gap-1"
aria-label={t("export.fromTimeline.previewExport")}
size="sm"
disabled={isSaving}
onClick={onPreview}
>
<LuVideo />
{t("export.fromTimeline.previewExport")}
</Button>
)}
<Button
className="flex items-center gap-1"
2026-04-14 09:19:50 -05:00
aria-label={saveLabel || t("export.fromTimeline.saveExport")}
2024-03-27 17:03:05 -06:00
variant="select"
size="sm"
2026-04-14 09:19:50 -05:00
disabled={isSaving}
2024-03-27 17:03:05 -06:00
onClick={onSave}
>
<FaCompactDisc />
2026-04-14 09:19:50 -05:00
{isSaving
? t("export.fromTimeline.queueingExport")
: saveLabel || t("export.fromTimeline.saveExport")}
2024-03-27 17:03:05 -06:00
</Button>
</div>
</div>
);
}