frigate/web/src/components/overlay/MobileTimelineDrawer.tsx
Josh Hawkins 7b6d0c5e42
Some checks are pending
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
i18n workflow improvements and tweaks (#22586)
* mobile button spacing

* prevent console warning about div being descendant of p

* ensure consistent spacing

* add missing i18n keys

* i18n fixes

- add missing translations
- fix dot notation keys

* use plain string

* add missing key

* add i18next-cli commands for extraction and status

also add false positives removal for several keys

* add i18n key check step to PR workflow

* formatting
2026-03-23 08:48:02 -05:00

67 lines
2.0 KiB
TypeScript

import { useState } from "react";
import { Drawer, DrawerContent, DrawerTrigger } from "../ui/drawer";
import { Button } from "../ui/button";
import { FaFlag } from "react-icons/fa";
import { TimelineType } from "@/types/timeline";
import { isMobile } from "react-device-detect";
import { useTranslation } from "react-i18next";
type MobileTimelineDrawerProps = {
selected: TimelineType;
onSelect: (timeline: TimelineType) => void;
};
export default function MobileTimelineDrawer({
selected,
onSelect,
}: MobileTimelineDrawerProps) {
const { t } = useTranslation(["views/events"]);
const [drawer, setDrawer] = useState(false);
if (!isMobile) {
return;
}
return (
<Drawer open={drawer} onOpenChange={setDrawer}>
<DrawerTrigger asChild>
<Button
className="rounded-lg smart-capitalize"
aria-label="Select timeline or events list"
size="sm"
>
<FaFlag className="text-secondary-foreground" />
</Button>
</DrawerTrigger>
<DrawerContent className="mx-1 flex max-h-[75dvh] flex-col items-center gap-2 overflow-hidden rounded-t-2xl px-4 pb-4">
<div
className={`mx-4 w-full py-2 text-center smart-capitalize ${selected == "timeline" ? "rounded-lg bg-secondary" : ""}`}
onClick={() => {
onSelect("timeline");
setDrawer(false);
}}
>
{t("timeline.label")}
</div>
<div
className={`mx-4 w-full py-2 text-center smart-capitalize ${selected == "events" ? "rounded-lg bg-secondary" : ""}`}
onClick={() => {
onSelect("events");
setDrawer(false);
}}
>
{t("events.label")}
</div>
<div
className={`mx-4 w-full py-2 text-center smart-capitalize ${selected == "detail" ? "rounded-lg bg-secondary" : ""}`}
onClick={() => {
onSelect("detail");
setDrawer(false);
}}
>
{t("detail.label")}
</div>
</DrawerContent>
</Drawer>
);
}