mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-15 15:45: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 { getIconForLabel } from "@/utils/iconUtil";
|
||||
import TimeAgo from "../dynamic/TimeAgo";
|
||||
@ -48,6 +48,26 @@ export default function SearchThumbnail({
|
||||
onClick(searchResult);
|
||||
}, [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
|
||||
|
||||
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`}
|
||||
onClick={() => onClick(searchResult)}
|
||||
>
|
||||
{getIconForLabel(searchResult.label, "size-3 text-white")}
|
||||
{getIconForLabel(objectLabel, "size-3 text-white")}
|
||||
</Chip>
|
||||
</div>
|
||||
</TooltipTrigger>
|
||||
</div>
|
||||
<TooltipPortal>
|
||||
<TooltipContent className="capitalize">
|
||||
{[...new Set([searchResult.label])]
|
||||
{[objectLabel]
|
||||
.filter(
|
||||
(item) => item !== undefined && !item.includes("-verified"),
|
||||
)
|
||||
|
||||
@ -340,6 +340,7 @@ export interface FrigateConfig {
|
||||
path: string | null;
|
||||
width: number;
|
||||
colormap: { [key: string]: [number, number, number] };
|
||||
attributes_map: { [key: string]: [string] };
|
||||
};
|
||||
|
||||
motion: Record<string, unknown> | null;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user