mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-05 04:57:42 +03:00
Fix explore chip icon logic
This commit is contained in:
parent
e7626b10f6
commit
78bd178056
@ -44,23 +44,31 @@ export default function SearchThumbnail({
|
|||||||
[searchResult, onClick],
|
[searchResult, onClick],
|
||||||
);
|
);
|
||||||
|
|
||||||
const objectLabel = useMemo(() => {
|
|
||||||
if (
|
|
||||||
!config ||
|
|
||||||
!searchResult.sub_label ||
|
|
||||||
!config.model.attributes_map[searchResult.label]
|
|
||||||
) {
|
|
||||||
return searchResult.label;
|
|
||||||
}
|
|
||||||
|
|
||||||
return `${searchResult.label}-verified`;
|
|
||||||
}, [config, searchResult]);
|
|
||||||
|
|
||||||
const hasRecognizedPlate = useMemo(
|
const hasRecognizedPlate = useMemo(
|
||||||
() => (searchResult.data.recognized_license_plate?.length || 0) > 0,
|
() => (searchResult.data.recognized_license_plate?.length || 0) > 0,
|
||||||
[searchResult],
|
[searchResult],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const objectLabel = useMemo(() => {
|
||||||
|
if (!config) {
|
||||||
|
return searchResult.label;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!searchResult.sub_label) {
|
||||||
|
return `${searchResult.label}${hasRecognizedPlate ? "-plate" : ""}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
config.model.attributes_map[searchResult.label]?.includes(
|
||||||
|
searchResult.sub_label,
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return searchResult.sub_label;
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${searchResult.label}-verified`;
|
||||||
|
}, [config, hasRecognizedPlate, searchResult]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="relative size-full cursor-pointer"
|
className="relative size-full cursor-pointer"
|
||||||
@ -102,10 +110,7 @@ export default function SearchThumbnail({
|
|||||||
className={`z-0 flex items-center justify-between gap-1 space-x-1 bg-gray-500 bg-gradient-to-br from-gray-400 to-gray-500 text-xs`}
|
className={`z-0 flex items-center justify-between gap-1 space-x-1 bg-gray-500 bg-gradient-to-br from-gray-400 to-gray-500 text-xs`}
|
||||||
onClick={() => onClick(searchResult, false, true)}
|
onClick={() => onClick(searchResult, false, true)}
|
||||||
>
|
>
|
||||||
{getIconForLabel(
|
{getIconForLabel(objectLabel, "size-3 text-white")}
|
||||||
`${objectLabel}${hasRecognizedPlate ? "-plate" : ""}`,
|
|
||||||
"size-3 text-white",
|
|
||||||
)}
|
|
||||||
{Math.round(
|
{Math.round(
|
||||||
(searchResult.data.score ??
|
(searchResult.data.score ??
|
||||||
searchResult.data.top_score ??
|
searchResult.data.top_score ??
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user