mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-12 10:07:36 +03:00
show audio events in detail stream
This commit is contained in:
parent
a8bcc109a9
commit
f7a8caaa23
@ -232,15 +232,20 @@ function ReviewGroup({
|
||||
date_style: "medium",
|
||||
});
|
||||
|
||||
const shouldFetchEvents = review?.data?.detections?.length > 0;
|
||||
|
||||
const { data: fetchedEvents } = useSWR<Event[]>(
|
||||
review?.data?.detections?.length
|
||||
shouldFetchEvents
|
||||
? ["event_ids", { ids: review.data.detections.join(",") }]
|
||||
: null,
|
||||
);
|
||||
|
||||
const rawIconLabels: string[] = fetchedEvents
|
||||
? fetchedEvents.map((e) => e.label)
|
||||
: (review.data?.objects ?? []);
|
||||
const rawIconLabels: string[] = [
|
||||
...(fetchedEvents
|
||||
? fetchedEvents.map((e) => e.label)
|
||||
: (review.data?.objects ?? [])),
|
||||
...(review.data?.audio ?? []),
|
||||
];
|
||||
|
||||
// limit to 5 icons
|
||||
const seen = new Set<string>();
|
||||
@ -310,10 +315,10 @@ function ReviewGroup({
|
||||
|
||||
{isActive && (
|
||||
<div className="mt-2 space-y-2">
|
||||
{!fetchedEvents ? (
|
||||
{shouldFetchEvents && !fetchedEvents ? (
|
||||
<ActivityIndicator />
|
||||
) : (
|
||||
fetchedEvents.map((event) => {
|
||||
(fetchedEvents || []).map((event) => {
|
||||
return (
|
||||
<EventCollapsible
|
||||
key={event.id}
|
||||
@ -325,6 +330,24 @@ function ReviewGroup({
|
||||
);
|
||||
})
|
||||
)}
|
||||
{review.data.audio && review.data.audio.length > 0 && (
|
||||
<div className="space-y-1">
|
||||
{review.data.audio.map((audioLabel) => (
|
||||
<div
|
||||
key={audioLabel}
|
||||
className="rounded-md bg-secondary p-2 outline outline-[3px] -outline-offset-[2.8px] outline-transparent duration-500"
|
||||
>
|
||||
<div className="flex items-center gap-2 text-sm font-medium">
|
||||
{getIconForLabel(
|
||||
audioLabel,
|
||||
"size-4 text-primary dark:text-white",
|
||||
)}
|
||||
<span>{getTranslatedLabel(audioLabel)}</span>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user