diff --git a/web/src/pages/Settings.tsx b/web/src/pages/Settings.tsx index 3743a2100..6dce7d853 100644 --- a/web/src/pages/Settings.tsx +++ b/web/src/pages/Settings.tsx @@ -56,11 +56,16 @@ import { SidebarMenuSubItem, SidebarProvider, } from "@/components/ui/sidebar"; -import { IoMdArrowRoundBack } from "react-icons/io"; import { cn } from "@/lib/utils"; import Heading from "@/components/ui/heading"; import { LuChevronRight } from "react-icons/lu"; import Logo from "@/components/Logo"; +import { + MobilePage, + MobilePageContent, + MobilePageHeader, + MobilePageTitle, +} from "@/components/mobile/MobilePage"; const allSettingsViews = [ "ui", @@ -131,7 +136,7 @@ function MobileMenuItem({ }: { item: { key: string }; onSelect: (key: string) => void; - onClose: () => void; + onClose?: () => void; className?: string; }) { const { t } = useTranslation(["views/settings"]); @@ -142,7 +147,7 @@ function MobileMenuItem({ className={cn("w-full justify-between pr-2", className)} onClick={() => { onSelect(item.key); - onClose(); + onClose?.(); }} >
{t("menu." + item.key)}
@@ -155,7 +160,7 @@ export default function Settings() { const { t } = useTranslation(["views/settings"]); const [page, setPage] = useState("ui"); const [_, setPageToggle] = useOptimisticState(page, setPage, 100); - const [mobileMenuOpen, setMobileMenuOpen] = useState(isMobile); + const [contentMobileOpen, setContentMobileOpen] = useState(false); const { data: config } = useSWR("config"); @@ -271,7 +276,7 @@ export default function Settings() { if (isMobile) { return ( <> - {mobileMenuOpen ? ( + {!contentMobileOpen && (
@@ -311,8 +316,8 @@ export default function Settings() { } else { setPageToggle(key as SettingsType); } + setContentMobileOpen(true); }} - onClose={() => setMobileMenuOpen(false)} /> ))}
@@ -320,61 +325,54 @@ export default function Settings() { })}
- ) : ( -
- -

- {t("menu." + page)} -

- {[ - "debug", - "cameras", - "masksAndZones", - "motionTuner", - "triggers", - ].includes(page) && ( -
- {page == "masksAndZones" && ( - - )} - -
- )} -
)} -
- {(() => { - const CurrentComponent = getCurrentComponent(page); - if (!CurrentComponent) return null; - return ( - - ); - })()} -
+ + + + {t("menu." + page)} + {[ + "debug", + "cameras", + "masksAndZones", + "motionTuner", + "triggers", + ].includes(page) && ( +
+ {page == "masksAndZones" && ( + + )} + +
+ )} +
+ +
+ {(() => { + const CurrentComponent = getCurrentComponent(page); + if (!CurrentComponent) return null; + return ( + + ); + })()} +
+
+
{confirmationDialogOpen && (