mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-14 02:52:11 +03:00
Adjust train title for mobile
This commit is contained in:
parent
a798ded80b
commit
58257690d3
@ -43,6 +43,7 @@
|
|||||||
},
|
},
|
||||||
"train": {
|
"train": {
|
||||||
"title": "Recent Classifications",
|
"title": "Recent Classifications",
|
||||||
|
"titleShort": "Recent",
|
||||||
"aria": "Select Recent Classifications"
|
"aria": "Select Recent Classifications"
|
||||||
},
|
},
|
||||||
"categories": "Classes",
|
"categories": "Classes",
|
||||||
|
|||||||
@ -44,7 +44,7 @@ import {
|
|||||||
useRef,
|
useRef,
|
||||||
useState,
|
useState,
|
||||||
} from "react";
|
} from "react";
|
||||||
import { isDesktop } from "react-device-detect";
|
import { isDesktop, isMobileOnly } from "react-device-detect";
|
||||||
import { Trans, useTranslation } from "react-i18next";
|
import { Trans, useTranslation } from "react-i18next";
|
||||||
import { LuPencil, LuTrash2 } from "react-icons/lu";
|
import { LuPencil, LuTrash2 } from "react-icons/lu";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
@ -436,8 +436,24 @@ function LibrarySelector({
|
|||||||
onRename,
|
onRename,
|
||||||
}: LibrarySelectorProps) {
|
}: LibrarySelectorProps) {
|
||||||
const { t } = useTranslation(["views/classificationModel"]);
|
const { t } = useTranslation(["views/classificationModel"]);
|
||||||
|
|
||||||
|
// data
|
||||||
|
|
||||||
const [confirmDelete, setConfirmDelete] = useState<string | null>(null);
|
const [confirmDelete, setConfirmDelete] = useState<string | null>(null);
|
||||||
const [renameClass, setRenameFace] = useState<string | null>(null);
|
const [renameClass, setRenameFace] = useState<string | null>(null);
|
||||||
|
const pageTitle = useMemo(() => {
|
||||||
|
if (pageToggle != "train") {
|
||||||
|
return pageToggle;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isMobileOnly) {
|
||||||
|
return t("train.titleShort");
|
||||||
|
}
|
||||||
|
|
||||||
|
return t("train.title");
|
||||||
|
}, [pageToggle, t]);
|
||||||
|
|
||||||
|
// interaction
|
||||||
|
|
||||||
const handleDeleteFace = useCallback(
|
const handleDeleteFace = useCallback(
|
||||||
(name: string) => {
|
(name: string) => {
|
||||||
@ -507,7 +523,7 @@ function LibrarySelector({
|
|||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger asChild>
|
<DropdownMenuTrigger asChild>
|
||||||
<Button className="flex justify-between smart-capitalize">
|
<Button className="flex justify-between smart-capitalize">
|
||||||
{pageToggle == "train" ? t("train.title") : pageToggle}
|
{pageTitle}
|
||||||
<span className="ml-2 text-primary-variant">
|
<span className="ml-2 text-primary-variant">
|
||||||
(
|
(
|
||||||
{(pageToggle &&
|
{(pageToggle &&
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user