From 58257690d329e480ad350b17b22a989d3d554a81 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 29 Oct 2025 06:50:10 -0600 Subject: [PATCH] Adjust train title for mobile --- .../locales/en/views/classificationModel.json | 1 + .../classification/ModelTrainingView.tsx | 20 +++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/web/public/locales/en/views/classificationModel.json b/web/public/locales/en/views/classificationModel.json index a13870221..4b268480f 100644 --- a/web/public/locales/en/views/classificationModel.json +++ b/web/public/locales/en/views/classificationModel.json @@ -43,6 +43,7 @@ }, "train": { "title": "Recent Classifications", + "titleShort": "Recent", "aria": "Select Recent Classifications" }, "categories": "Classes", diff --git a/web/src/views/classification/ModelTrainingView.tsx b/web/src/views/classification/ModelTrainingView.tsx index 5c7a649c3..7c2a4aa05 100644 --- a/web/src/views/classification/ModelTrainingView.tsx +++ b/web/src/views/classification/ModelTrainingView.tsx @@ -44,7 +44,7 @@ import { useRef, useState, } from "react"; -import { isDesktop } from "react-device-detect"; +import { isDesktop, isMobileOnly } from "react-device-detect"; import { Trans, useTranslation } from "react-i18next"; import { LuPencil, LuTrash2 } from "react-icons/lu"; import { toast } from "sonner"; @@ -436,8 +436,24 @@ function LibrarySelector({ onRename, }: LibrarySelectorProps) { const { t } = useTranslation(["views/classificationModel"]); + + // data + const [confirmDelete, setConfirmDelete] = useState(null); const [renameClass, setRenameFace] = useState(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( (name: string) => { @@ -507,7 +523,7 @@ function LibrarySelector({