Show icons for sub labels

This commit is contained in:
Nicolas Mowen 2024-02-21 06:16:34 -07:00
parent a95f4d843f
commit 992a854d36
3 changed files with 24 additions and 3 deletions

View File

@ -6,7 +6,7 @@ import { formatUnixTimestampToDateTime } from "@/utils/dateUtil";
import { isSafari } from "@/utils/browserUtil";
import { ReviewSegment } from "@/types/review";
import { Slider } from "../ui/slider";
import { getIconForLabel } from "@/utils/iconUtil";
import { getIconForLabel, getIconForSubLabel } from "@/utils/iconUtil";
import TimeAgo from "../dynamic/TimeAgo";
import useSWR from "swr";
import { FrigateConfig } from "@/types/frigateConfig";
@ -157,6 +157,9 @@ export default function PreviewThumbnailPlayer({
{review.data.audio.map((audio) => {
return getIconForLabel(audio, "w-3 h-3 text-white");
})}
{review.data.sub_labels?.map((sub) => {
return getIconForSubLabel(sub, "w-3 h-3 text-white");
})}
</div>
)}
{!hover && (

View File

@ -15,7 +15,7 @@ export type ReviewData = {
audio: string[];
detections: string[];
objects: string[];
sub_labels?: [string, number][];
sub_labels?: string[];
significant_motion_areas: number[];
zones: string[];
};

View File

@ -1,5 +1,12 @@
import { BsPersonWalking } from "react-icons/bs";
import { FaCarSide, FaCat, FaDog } from "react-icons/fa";
import {
FaAmazon,
FaCarSide,
FaCat,
FaDog,
FaFedex,
FaUps,
} from "react-icons/fa";
import { LuBox, LuLassoSelect } from "react-icons/lu";
export function getIconForLabel(label: string, className?: string) {
@ -18,3 +25,14 @@ export function getIconForLabel(label: string, className?: string) {
return <LuLassoSelect key={label} className={className} />;
}
}
export function getIconForSubLabel(label: string, className?: string) {
switch (label) {
case "amazon":
return <FaAmazon key={label} className={className} />;
case "fedex":
return <FaFedex key={label} className={className} />;
case "ups":
return <FaUps key={label} className={className} />;
}
}