From 361197c7fbd9bf61c741b9a5c251a2e01eddcf5e Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 27 Mar 2025 16:13:23 -0600 Subject: [PATCH] Add view in explore option --- web/src/pages/FaceLibrary.tsx | 45 +++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/web/src/pages/FaceLibrary.tsx b/web/src/pages/FaceLibrary.tsx index 6bd016e37..b43286622 100644 --- a/web/src/pages/FaceLibrary.tsx +++ b/web/src/pages/FaceLibrary.tsx @@ -35,11 +35,19 @@ import { cn } from "@/lib/utils"; import { Event } from "@/types/event"; import { FaceLibraryData, RecognizedFaceData } from "@/types/face"; import { FaceRecognitionConfig, FrigateConfig } from "@/types/frigateConfig"; +import { TooltipPortal } from "@radix-ui/react-tooltip"; import axios from "axios"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { isDesktop, isMobile } from "react-device-detect"; import { useTranslation } from "react-i18next"; -import { LuImagePlus, LuRefreshCw, LuScanFace, LuTrash2 } from "react-icons/lu"; +import { + LuImagePlus, + LuRefreshCw, + LuScanFace, + LuSearch, + LuTrash2, +} from "react-icons/lu"; +import { useNavigate } from "react-router-dom"; import { toast } from "sonner"; import useSWR from "swr"; @@ -392,7 +400,8 @@ function TrainingGrid({ onClickFace, onRefresh, }: TrainingGridProps) { - const { t } = useTranslation(["views/faceLibrary"]); + const { t } = useTranslation(["views/faceLibrary", "views/explore"]); + const navigate = useNavigate(); // face data @@ -499,12 +508,34 @@ function TrainingGrid({ return (
-
- {event.label}: - {event.sub_label - ? ` ${event.sub_label} (${Math.round((event.data.sub_label_score || 0) * 100)}%)` - : " Unknown"} +
+
+ {event.label}: + {event.sub_label + ? ` ${event.sub_label} (${Math.round((event.data.sub_label_score || 0) * 100)}%)` + : " Unknown"} +
+ + +
{ + navigate(`/explore?event_id=${event.id}`); + }} + > + +
+
+ + + {t("details.item.button.viewInExplore", { + ns: "views/explore", + })} + + +
+
{group.map((data: RecognizedFaceData) => (