mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-12 18:17:36 +03:00
ensure data being sent to api is segment aligned
This commit is contained in:
parent
a627a79f47
commit
c215a60f2c
@ -233,7 +233,9 @@ export function MotionSegment({
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{hasRecording && (
|
{(hasRecording ||
|
||||||
|
firstHalfSegmentWidth > 0 ||
|
||||||
|
secondHalfSegmentWidth > 0) && (
|
||||||
<div className="absolute left-1/2 z-10 h-[8px] w-[20px] -translate-x-1/2 transform cursor-pointer md:w-[40px]">
|
<div className="absolute left-1/2 z-10 h-[8px] w-[20px] -translate-x-1/2 transform cursor-pointer md:w-[40px]">
|
||||||
<div className="mb-[1px] flex w-[20px] flex-row justify-center pt-[1px] md:w-[40px]">
|
<div className="mb-[1px] flex w-[20px] flex-row justify-center pt-[1px] md:w-[40px]">
|
||||||
<div className="mb-[1px] flex justify-center">
|
<div className="mb-[1px] flex justify-center">
|
||||||
|
|||||||
@ -402,7 +402,7 @@ export function ReviewTimeline({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/* TODO: determine if we should keep this tooltip */}
|
{/* TODO: determine if we should keep this tooltip */}
|
||||||
{isHandlebarInNoRecordingPeriod && (
|
{false && isHandlebarInNoRecordingPeriod && (
|
||||||
<div className="absolute left-1/2 top-full z-50 mt-2 -translate-x-1/2 rounded-md bg-destructive/80 px-4 py-1 text-center text-xs text-white shadow-lg">
|
<div className="absolute left-1/2 top-full z-50 mt-2 -translate-x-1/2 rounded-md bg-destructive/80 px-4 py-1 text-center text-xs text-white shadow-lg">
|
||||||
No recordings
|
No recordings
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -56,6 +56,7 @@ import { useFullscreen } from "@/hooks/use-fullscreen";
|
|||||||
import { useTimezone } from "@/hooks/use-date-utils";
|
import { useTimezone } from "@/hooks/use-date-utils";
|
||||||
import { useTimelineZoom } from "@/hooks/use-timeline-zoom";
|
import { useTimelineZoom } from "@/hooks/use-timeline-zoom";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { useTimelineUtils } from "@/hooks/use-timeline-utils";
|
||||||
import {
|
import {
|
||||||
Tooltip,
|
Tooltip,
|
||||||
TooltipContent,
|
TooltipContent,
|
||||||
@ -908,12 +909,20 @@ function Timeline({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// motion data
|
// motion data
|
||||||
|
const { alignStartDateToTimeline, alignEndDateToTimeline } = useTimelineUtils(
|
||||||
|
{
|
||||||
|
segmentDuration: zoomSettings.segmentDuration,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const alignedAfter = alignStartDateToTimeline(timeRange.after);
|
||||||
|
const alignedBefore = alignEndDateToTimeline(timeRange.before);
|
||||||
|
|
||||||
const { data: motionData, isLoading } = useSWR<MotionData[]>([
|
const { data: motionData, isLoading } = useSWR<MotionData[]>([
|
||||||
"review/activity/motion",
|
"review/activity/motion",
|
||||||
{
|
{
|
||||||
before: timeRange.before,
|
before: alignedBefore,
|
||||||
after: timeRange.after,
|
after: alignedAfter,
|
||||||
scale: Math.round(zoomSettings.segmentDuration / 2),
|
scale: Math.round(zoomSettings.segmentDuration / 2),
|
||||||
cameras: mainCamera,
|
cameras: mainCamera,
|
||||||
},
|
},
|
||||||
@ -922,8 +931,8 @@ function Timeline({
|
|||||||
const { data: noRecordings } = useSWR<RecordingSegment[]>([
|
const { data: noRecordings } = useSWR<RecordingSegment[]>([
|
||||||
"recordings/unavailable",
|
"recordings/unavailable",
|
||||||
{
|
{
|
||||||
before: timeRange.before,
|
before: alignedBefore,
|
||||||
after: timeRange.after,
|
after: alignedAfter,
|
||||||
scale: Math.round(zoomSettings.segmentDuration),
|
scale: Math.round(zoomSettings.segmentDuration),
|
||||||
cameras: mainCamera,
|
cameras: mainCamera,
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user