Fix previews loading

This commit is contained in:
Nicolas Mowen 2024-05-19 13:13:57 -06:00
parent 22d977661a
commit 2d03c152fd
3 changed files with 5 additions and 15 deletions

View File

@ -50,12 +50,6 @@ export default function DynamicVideoPlayer({
const apiHost = useApiHost(); const apiHost = useApiHost();
const { data: config } = useSWR<FrigateConfig>("config"); const { data: config } = useSWR<FrigateConfig>("config");
useEffect(() => {
console.log(
`the time range is ${new Date(timeRange.after * 1000)} -> ${new Date(timeRange.before * 1000)}`,
);
}, [timeRange]);
// controlling playback // controlling playback
const playerRef = useRef<HTMLVideoElement | null>(null); const playerRef = useRef<HTMLVideoElement | null>(null);

View File

@ -11,6 +11,7 @@ import {
ReviewSeverity, ReviewSeverity,
ReviewSummary, ReviewSummary,
} from "@/types/review"; } from "@/types/review";
import { getUTCOffset } from "@/utils/dateUtil";
import EventView from "@/views/events/EventView"; import EventView from "@/views/events/EventView";
import { RecordingView } from "@/views/events/RecordingView"; import { RecordingView } from "@/views/events/RecordingView";
import axios from "axios"; import axios from "axios";
@ -166,6 +167,8 @@ export default function Events() {
return undefined; return undefined;
} }
const timezoneMinuteOffset = (getUTCOffset(new Date()) % 60) * 60;
const startDate = new Date(); const startDate = new Date();
startDate.setMinutes(0, 0, 0); startDate.setMinutes(0, 0, 0);
@ -173,8 +176,8 @@ export default function Events() {
endDate.setHours(0, 0, 0, 0); endDate.setHours(0, 0, 0, 0);
return { return {
after: startDate.getTime() / 1000, after: startDate.getTime() / 1000 + timezoneMinuteOffset,
before: endDate.getTime() / 1000, before: endDate.getTime() / 1000 + timezoneMinuteOffset,
}; };
}, [reviews]); }, [reviews]);

View File

@ -101,13 +101,6 @@ export function RecordingView({
() => getChunkedTimeDay(timeRange), () => getChunkedTimeDay(timeRange),
[timeRange], [timeRange],
); );
useEffect(() => {
chunkedTimeRange.forEach((c) =>
console.log(
`the chunk is ${new Date(c.after * 1000)} -> ${new Date(c.before * 1000)}`,
),
);
}, [chunkedTimeRange]);
const [selectedRangeIdx, setSelectedRangeIdx] = useState( const [selectedRangeIdx, setSelectedRangeIdx] = useState(
chunkedTimeRange.findIndex((chunk) => { chunkedTimeRange.findIndex((chunk) => {
return chunk.after <= startTime && chunk.before >= startTime; return chunk.after <= startTime && chunk.before >= startTime;