diff --git a/web/src/components/filter/CameraGroupSelector.tsx b/web/src/components/filter/CameraGroupSelector.tsx index 6f14b8eb9..fdb01c5ee 100644 --- a/web/src/components/filter/CameraGroupSelector.tsx +++ b/web/src/components/filter/CameraGroupSelector.tsx @@ -7,8 +7,13 @@ import { Button } from "../ui/button"; import { useCallback, useMemo, useState } from "react"; import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip"; import { LuPencil, LuPlus } from "react-icons/lu"; -import { Dialog, DialogContent, DialogTitle } from "../ui/dialog"; -import { Drawer, DrawerContent } from "../ui/drawer"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, +} from "../ui/dialog"; import { Input } from "../ui/input"; import { Separator } from "../ui/separator"; import { @@ -24,6 +29,7 @@ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, + DropdownMenuPortal, DropdownMenuTrigger, } from "../ui/dropdown-menu"; import { @@ -53,6 +59,13 @@ import { cn } from "@/lib/utils"; import * as LuIcons from "react-icons/lu"; import IconPicker, { IconName, IconRenderer } from "../icons/IconPicker"; import { isValidIconName } from "@/utils/iconUtil"; +import { + MobilePage, + MobilePageContent, + MobilePageDescription, + MobilePageHeader, + MobilePageTitle, +} from "../mobile/MobilePage"; type CameraGroupSelectorProps = { className?: string; @@ -278,6 +291,7 @@ function NewGroupDialog({ const onSave = () => { setOpen(false); setEditState("none"); + setEditingGroupName(""); }; const onCancel = () => { @@ -290,8 +304,11 @@ function NewGroupDialog({ setEditState("edit"); }, []); - const Overlay = isDesktop ? Dialog : Drawer; - const Content = isDesktop ? DialogContent : DrawerContent; + const Overlay = isDesktop ? Dialog : MobilePage; + const Content = isDesktop ? DialogContent : MobilePageContent; + const Header = isDesktop ? DialogHeader : MobilePageHeader; + const Description = isDesktop ? DialogDescription : MobilePageDescription; + const Title = isDesktop ? DialogTitle : MobilePageTitle; return ( <> @@ -308,16 +325,36 @@ function NewGroupDialog({ }} > -
- {editState === "none" && ( - <> -
- Camera Groups + {editState === "none" && ( + <> +
setOpen(false)} + > + Camera Groups + + Edit camera groups + +
+
+
{currentGroups.map((group) => ( onEditGroup(group)} /> ))} - - )} +
+ + )} - {editState != "none" && ( - <> -
- - {editState == "add" ? "Add" : "Edit"} Camera Group - -
- - - )} -
+ {editState != "none" && ( + <> +
{ + setEditState("none"); + setEditingGroupName(""); + }} + > + + {editState == "add" ? "Add" : "Edit"} Camera Group + + + Edit camera groups + +
+ + + )} @@ -372,6 +420,12 @@ export function EditGroupDialog({ currentGroups, activeGroup, }: EditGroupDialogProps) { + const Overlay = isDesktop ? Dialog : MobilePage; + const Content = isDesktop ? DialogContent : MobilePageContent; + const Header = isDesktop ? DialogHeader : MobilePageHeader; + const Description = isDesktop ? DialogDescription : MobilePageDescription; + const Title = isDesktop ? DialogTitle : MobilePageTitle; + // editing group and state const editingGroup = useMemo(() => { @@ -391,19 +445,24 @@ export function EditGroupDialog({ position="top-center" closeButton={true} /> - { setOpen(open); }} > - -
-
- Edit Camera Group -
+
+
setOpen(false)}> + Edit Camera Group + Edit camera group +
+ setOpen(false)} />
- -
+ + ); } @@ -440,7 +499,7 @@ export function CameraGroupRow({ <>

{group[0]}

@@ -472,12 +531,16 @@ export function CameraGroupRow({ - - Edit - setDeleteDialogOpen(true)}> - Delete - - + + + + Edit + + setDeleteDialogOpen(true)}> + Delete + + + )} @@ -659,7 +722,7 @@ export function CameraGroupEdit({ /> -
+
{filter?.before == undefined && (