Motion review improvements (#10833)

* render skeleton for preview player until motion data is loaded

* skeleton for timeline
This commit is contained in:
Josh Hawkins 2024-04-04 15:54:58 -05:00 committed by GitHub
parent 42559fa55d
commit 466a9104e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -42,6 +42,7 @@ import VideoControls from "@/components/player/VideoControls";
import { TimeRange } from "@/types/timeline";
import { useCameraMotionNextTimestamp } from "@/hooks/use-camera-activity";
import useOptimisticState from "@/hooks/use-optimistic-state";
import { Skeleton } from "@/components/ui/skeleton";
type EventViewProps = {
reviews?: ReviewSegment[];
@ -837,6 +838,7 @@ function MotionReview({
const detectionType = getDetectionType(camera.name);
return (
<div key={camera.name} className={`relative ${spans}`}>
{motionData ? (
<PreviewPlayer
key={camera.name}
className={`rounded-2xl ${spans} ${grow}`}
@ -851,11 +853,14 @@ function MotionReview({
onClick={() =>
onOpenRecording({
camera: camera.name,
startTime: Math.min(currentTime, Date.now() / 1000 - 10),
startTime: currentTime,
severity: "significant_motion",
})
}
/>
) : (
<Skeleton className={`rounded-2xl ${spans} ${grow}`} />
)}
<div
className={`review-item-ring pointer-events-none z-10 absolute rounded-lg inset-0 size-full -outline-offset-[2.8px] outline outline-[3px] ${detectionType ? `outline-severity_${detectionType} shadow-severity_${detectionType}` : "outline-transparent duration-500"}`}
/>
@ -865,6 +870,7 @@ function MotionReview({
</div>
</div>
<div className="w-[55px] md:w-[100px] overflow-y-auto no-scrollbar">
{motionData ? (
<MotionReviewTimeline
segmentDuration={segmentDuration}
timestampSpread={15}
@ -887,6 +893,9 @@ function MotionReview({
}}
dense={isMobile}
/>
) : (
<Skeleton className="rounded-2xl size-full" />
)}
</div>
<VideoControls