mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-05 13:07:44 +03:00
Add view in explore option
This commit is contained in:
parent
d765153992
commit
361197c7fb
@ -35,11 +35,19 @@ import { cn } from "@/lib/utils";
|
|||||||
import { Event } from "@/types/event";
|
import { Event } from "@/types/event";
|
||||||
import { FaceLibraryData, RecognizedFaceData } from "@/types/face";
|
import { FaceLibraryData, RecognizedFaceData } from "@/types/face";
|
||||||
import { FaceRecognitionConfig, FrigateConfig } from "@/types/frigateConfig";
|
import { FaceRecognitionConfig, FrigateConfig } from "@/types/frigateConfig";
|
||||||
|
import { TooltipPortal } from "@radix-ui/react-tooltip";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||||
import { isDesktop, isMobile } from "react-device-detect";
|
import { isDesktop, isMobile } from "react-device-detect";
|
||||||
import { useTranslation } from "react-i18next";
|
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 { toast } from "sonner";
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
|
|
||||||
@ -392,7 +400,8 @@ function TrainingGrid({
|
|||||||
onClickFace,
|
onClickFace,
|
||||||
onRefresh,
|
onRefresh,
|
||||||
}: TrainingGridProps) {
|
}: TrainingGridProps) {
|
||||||
const { t } = useTranslation(["views/faceLibrary"]);
|
const { t } = useTranslation(["views/faceLibrary", "views/explore"]);
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
// face data
|
// face data
|
||||||
|
|
||||||
@ -499,12 +508,34 @@ function TrainingGrid({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-2 rounded-lg bg-card p-2">
|
<div className="flex flex-col gap-2 rounded-lg bg-card p-2">
|
||||||
|
<div className="flex flex-row justify-between">
|
||||||
<div className="capitalize">
|
<div className="capitalize">
|
||||||
{event.label}:
|
{event.label}:
|
||||||
{event.sub_label
|
{event.sub_label
|
||||||
? ` ${event.sub_label} (${Math.round((event.data.sub_label_score || 0) * 100)}%)`
|
? ` ${event.sub_label} (${Math.round((event.data.sub_label_score || 0) * 100)}%)`
|
||||||
: " Unknown"}
|
: " Unknown"}
|
||||||
</div>
|
</div>
|
||||||
|
<Tooltip>
|
||||||
|
<TooltipTrigger>
|
||||||
|
<div
|
||||||
|
className="cursor-pointer"
|
||||||
|
onClick={() => {
|
||||||
|
navigate(`/explore?event_id=${event.id}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<LuSearch className="size-4 text-muted-foreground" />
|
||||||
|
</div>
|
||||||
|
</TooltipTrigger>
|
||||||
|
<TooltipPortal>
|
||||||
|
<TooltipContent>
|
||||||
|
{t("details.item.button.viewInExplore", {
|
||||||
|
ns: "views/explore",
|
||||||
|
})}
|
||||||
|
</TooltipContent>
|
||||||
|
</TooltipPortal>
|
||||||
|
</Tooltip>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="flex flex-row flex-wrap gap-2">
|
<div className="flex flex-row flex-wrap gap-2">
|
||||||
{group.map((data: RecognizedFaceData) => (
|
{group.map((data: RecognizedFaceData) => (
|
||||||
<FaceAttempt
|
<FaceAttempt
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user