import { useEventSegmentUtils } from "@/hooks/use-event-segment-utils"; import { ReviewSegment, ReviewSeverity } from "@/types/review"; import React, { useMemo } from "react"; // import useTapUtils from "@/hooks/use-tap-utils"; type SummarySegmentProps = { events: ReviewSegment[]; segmentTime: number; segmentDuration: number; segmentHeight: number; severityType: ReviewSeverity; }; export function SummarySegment({ events, segmentTime, segmentDuration, segmentHeight, severityType, }: SummarySegmentProps) { const { getSeverity, getReviewed, displaySeverityType } = useEventSegmentUtils(segmentDuration, events, severityType); const severity = useMemo( () => getSeverity(segmentTime, displaySeverityType), [getSeverity, segmentTime, displaySeverityType], ); const reviewed = useMemo( () => getReviewed(segmentTime), [getReviewed, segmentTime], ); const segmentKey = useMemo(() => segmentTime, [segmentTime]); const severityColors: { [key: number]: string } = { 1: reviewed ? "bg-severity_motion/50" : "bg-severity_motion", 2: reviewed ? "bg-severity_detection/50" : "bg-severity_detection", 3: reviewed ? "bg-severity_alert/50" : "bg-severity_alert", }; return (
{severity.map((severityValue: number, index: number) => ( {severityValue === displaySeverityType && (
)}
))}
); } export default SummarySegment;