mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-06-02 07:00:32 +00:00
* remove redundant per-view toasters in settings * add variants to standardize dialog footer button layouts * remove text-md this class name compiles to nothing in tailwind. we used to add it to prevent iOS from zooming when focusing on an input, but that is now solved via the viewport meta in index.html * make wizard footers consistent with dialog footers * consistent destructive button style remove text-white from individual buttons and add it to the variant
69 lines
1.9 KiB
TypeScript
69 lines
1.9 KiB
TypeScript
import { Trans, useTranslation } from "react-i18next";
|
|
import { Button } from "../ui/button";
|
|
import {
|
|
Dialog,
|
|
DialogContent,
|
|
DialogFooter,
|
|
DialogHeader,
|
|
} from "../ui/dialog";
|
|
import { DialogDescription } from "@radix-ui/react-dialog";
|
|
|
|
type DeleteUserDialogProps = {
|
|
show: boolean;
|
|
username?: string;
|
|
onDelete: () => void;
|
|
onCancel: () => void;
|
|
};
|
|
export default function DeleteUserDialog({
|
|
show,
|
|
username,
|
|
onDelete,
|
|
onCancel,
|
|
}: DeleteUserDialogProps) {
|
|
const { t } = useTranslation(["views/settings"]);
|
|
return (
|
|
<Dialog open={show} onOpenChange={onCancel}>
|
|
<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")}
|
|
<DialogDescription>
|
|
{t("users.dialog.deleteUser.desc")}
|
|
</DialogDescription>
|
|
</div>
|
|
</DialogHeader>
|
|
|
|
<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">
|
|
<Trans
|
|
i18nKey="users.dialog.deleteUser.warn"
|
|
ns="views/settings"
|
|
values={{ username }}
|
|
components={{
|
|
strong: <span className="font-medium" />,
|
|
}}
|
|
/>
|
|
</p>
|
|
</div>
|
|
|
|
<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>
|
|
</DialogFooter>
|
|
</DialogContent>
|
|
</Dialog>
|
|
);
|
|
}
|