mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-08 06:25:27 +03:00
Some checks are pending
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
* Adjust title prompt to have less rigidity * Improve motion boxes handling for features that don't require motion * Improve handling of classes starting with digits * Improve vehicle nuance * tweak lpr docs * Improve grammar * Don't allow # in face name * add password requirements to new user dialog * change password requirements * Clenaup --------- Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
73 lines
1.9 KiB
TypeScript
73 lines
1.9 KiB
TypeScript
import TextEntry from "@/components/input/TextEntry";
|
|
import { Button } from "@/components/ui/button";
|
|
import {
|
|
Dialog,
|
|
DialogContent,
|
|
DialogDescription,
|
|
DialogFooter,
|
|
DialogHeader,
|
|
DialogTitle,
|
|
} from "@/components/ui/dialog";
|
|
import { cn } from "@/lib/utils";
|
|
import { isMobile } from "react-device-detect";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
type TextEntryDialogProps = {
|
|
open: boolean;
|
|
title: string;
|
|
description?: string;
|
|
setOpen: (open: boolean) => void;
|
|
onSave: (text: string) => void;
|
|
defaultValue?: string;
|
|
allowEmpty?: boolean;
|
|
regexPattern?: RegExp;
|
|
regexErrorMessage?: string;
|
|
forbiddenPattern?: RegExp;
|
|
forbiddenErrorMessage?: string;
|
|
};
|
|
|
|
export default function TextEntryDialog({
|
|
open,
|
|
title,
|
|
description,
|
|
setOpen,
|
|
onSave,
|
|
defaultValue = "",
|
|
allowEmpty = false,
|
|
regexPattern,
|
|
regexErrorMessage,
|
|
forbiddenPattern,
|
|
forbiddenErrorMessage,
|
|
}: TextEntryDialogProps) {
|
|
const { t } = useTranslation("common");
|
|
|
|
return (
|
|
<Dialog open={open} defaultOpen={false} onOpenChange={setOpen}>
|
|
<DialogContent>
|
|
<DialogHeader>
|
|
<DialogTitle>{title}</DialogTitle>
|
|
{description && <DialogDescription>{description}</DialogDescription>}
|
|
</DialogHeader>
|
|
<TextEntry
|
|
defaultValue={defaultValue}
|
|
allowEmpty={allowEmpty}
|
|
onSave={onSave}
|
|
regexPattern={regexPattern}
|
|
regexErrorMessage={regexErrorMessage}
|
|
forbiddenPattern={forbiddenPattern}
|
|
forbiddenErrorMessage={forbiddenErrorMessage}
|
|
>
|
|
<DialogFooter className={cn("pt-4", isMobile && "gap-2")}>
|
|
<Button type="button" onClick={() => setOpen(false)}>
|
|
{t("button.cancel")}
|
|
</Button>
|
|
<Button variant="select" type="submit">
|
|
{t("button.save")}
|
|
</Button>
|
|
</DialogFooter>
|
|
</TextEntry>
|
|
</DialogContent>
|
|
</Dialog>
|
|
);
|
|
}
|