mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-15 07:35:27 +03:00
Merge branch 'fix-selected-outline' of https://github.com/blakeblackshear/frigate into fix-selected-outline
This commit is contained in:
commit
b5f99c8bd5
@ -1,4 +1,4 @@
|
|||||||
import { useCallback } from "react";
|
import { useCallback, useMemo } from "react";
|
||||||
import { useApiHost } from "@/api";
|
import { useApiHost } from "@/api";
|
||||||
import { getIconForLabel } from "@/utils/iconUtil";
|
import { getIconForLabel } from "@/utils/iconUtil";
|
||||||
import TimeAgo from "../dynamic/TimeAgo";
|
import TimeAgo from "../dynamic/TimeAgo";
|
||||||
@ -48,6 +48,26 @@ export default function SearchThumbnail({
|
|||||||
onClick(searchResult);
|
onClick(searchResult);
|
||||||
}, [searchResult, onClick]);
|
}, [searchResult, onClick]);
|
||||||
|
|
||||||
|
const objectLabel = useMemo(() => {
|
||||||
|
if (
|
||||||
|
!config ||
|
||||||
|
!searchResult.sub_label ||
|
||||||
|
!config.model.attributes_map[searchResult.label]
|
||||||
|
) {
|
||||||
|
return searchResult.label;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
config.model.attributes_map[searchResult.label].includes(
|
||||||
|
searchResult.sub_label,
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return searchResult.sub_label;
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${searchResult.label}-verified`;
|
||||||
|
}, [config, searchResult]);
|
||||||
|
|
||||||
// date
|
// date
|
||||||
|
|
||||||
const formattedDate = useFormattedTimestamp(
|
const formattedDate = useFormattedTimestamp(
|
||||||
@ -93,14 +113,14 @@ export default function SearchThumbnail({
|
|||||||
className={`z-0 flex items-start justify-between space-x-1 bg-gray-500 bg-gradient-to-br from-gray-400 to-gray-500`}
|
className={`z-0 flex items-start justify-between space-x-1 bg-gray-500 bg-gradient-to-br from-gray-400 to-gray-500`}
|
||||||
onClick={() => onClick(searchResult)}
|
onClick={() => onClick(searchResult)}
|
||||||
>
|
>
|
||||||
{getIconForLabel(searchResult.label, "size-3 text-white")}
|
{getIconForLabel(objectLabel, "size-3 text-white")}
|
||||||
</Chip>
|
</Chip>
|
||||||
</div>
|
</div>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
</div>
|
</div>
|
||||||
<TooltipPortal>
|
<TooltipPortal>
|
||||||
<TooltipContent className="capitalize">
|
<TooltipContent className="capitalize">
|
||||||
{[...new Set([searchResult.label])]
|
{[objectLabel]
|
||||||
.filter(
|
.filter(
|
||||||
(item) => item !== undefined && !item.includes("-verified"),
|
(item) => item !== undefined && !item.includes("-verified"),
|
||||||
)
|
)
|
||||||
|
|||||||
@ -340,6 +340,7 @@ export interface FrigateConfig {
|
|||||||
path: string | null;
|
path: string | null;
|
||||||
width: number;
|
width: number;
|
||||||
colormap: { [key: string]: [number, number, number] };
|
colormap: { [key: string]: [number, number, number] };
|
||||||
|
attributes_map: { [key: string]: [string] };
|
||||||
};
|
};
|
||||||
|
|
||||||
motion: Record<string, unknown> | null;
|
motion: Record<string, unknown> | null;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user