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

69 lines
1.9 KiB
TypeScript
Raw Normal View History

2025-04-19 20:53:23 -05:00
import { Trans, useTranslation } from "react-i18next";
2024-05-18 11:36:13 -05:00
import { Button } from "../ui/button";
import {
Dialog,
DialogContent,
DialogFooter,
DialogHeader,
} from "../ui/dialog";
2025-03-08 10:01:08 -06:00
import { DialogDescription } from "@radix-ui/react-dialog";
2024-05-18 11:36:13 -05:00
2025-03-08 10:01:08 -06:00
type DeleteUserDialogProps = {
2024-05-18 11:36:13 -05:00
show: boolean;
2025-03-08 10:01:08 -06:00
username?: string;
2024-05-18 11:36:13 -05:00
onDelete: () => void;
onCancel: () => void;
};
export default function DeleteUserDialog({
show,
2025-03-08 10:01:08 -06:00
username,
2024-05-18 11:36:13 -05:00
onDelete,
onCancel,
2025-03-08 10:01:08 -06:00
}: DeleteUserDialogProps) {
const { t } = useTranslation(["views/settings"]);
2024-05-18 11:36:13 -05:00
return (
<Dialog open={show} onOpenChange={onCancel}>
2025-03-08 10:01:08 -06:00
<DialogContent className="sm:max-w-[425px]">
<DialogHeader className="flex flex-col items-center gap-2 sm:items-start">
<div className="space-y-1 text-center sm:text-left">
{t("users.dialog.deleteUser.title")}
2025-03-08 10:01:08 -06:00
<DialogDescription>
{t("users.dialog.deleteUser.desc")}
2025-03-08 10:01:08 -06:00
</DialogDescription>
</div>
2024-05-18 11:36:13 -05:00
</DialogHeader>
2025-03-08 10:01:08 -06:00
<div className="my-4 rounded-md border border-destructive/20 bg-destructive/5 p-4 text-center text-sm">
<p className="font-medium text-destructive">
2025-04-19 20:53:23 -05:00
<Trans
i18nKey="users.dialog.deleteUser.warn"
ns="views/settings"
values={{ username }}
components={{
strong: <span className="font-medium" />,
}}
/>
2025-03-08 10:01:08 -06:00
</p>
</div>
2026-05-29 17:00:30 -05:00
<DialogFooter>
<Button
aria-label={t("button.cancel", { ns: "common" })}
onClick={onCancel}
type="button"
>
{t("button.cancel", { ns: "common" })}
</Button>
<Button
variant="destructive"
aria-label={t("button.delete", { ns: "common" })}
onClick={onDelete}
>
{t("button.delete", { ns: "common" })}
</Button>
2024-05-18 11:36:13 -05:00
</DialogFooter>
</DialogContent>
</Dialog>
);
}