Skip to content

Commit

Permalink
Fix previews loading
Browse files Browse the repository at this point in the history
  • Loading branch information
NickM-27 committed May 19, 2024
1 parent 62c92db commit a3e706c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
6 changes: 0 additions & 6 deletions web/src/components/player/dynamic/DynamicVideoPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ export default function DynamicVideoPlayer({
const apiHost = useApiHost();
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

const playerRef = useRef<HTMLVideoElement | null>(null);
Expand Down
7 changes: 5 additions & 2 deletions web/src/pages/Events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
ReviewSeverity,
ReviewSummary,
} from "@/types/review";
import { getUTCOffset } from "@/utils/dateUtil";
import EventView from "@/views/events/EventView";
import { RecordingView } from "@/views/events/RecordingView";
import axios from "axios";
Expand Down Expand Up @@ -166,15 +167,17 @@ export default function Events() {
return undefined;
}

const timezoneMinuteOffset = (getUTCOffset(new Date()) % 60) * 60;

const startDate = new Date();
startDate.setMinutes(0, 0, 0);

const endDate = new Date(reviews.at(-1)?.end_time || 0);
endDate.setHours(0, 0, 0, 0);

return {
after: startDate.getTime() / 1000,
before: endDate.getTime() / 1000,
after: startDate.getTime() / 1000 + timezoneMinuteOffset,
before: endDate.getTime() / 1000 + timezoneMinuteOffset,
};
}, [reviews]);

Expand Down
7 changes: 0 additions & 7 deletions web/src/views/events/RecordingView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,6 @@ export function RecordingView({
() => getChunkedTimeDay(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(
chunkedTimeRange.findIndex((chunk) => {
return chunk.after <= startTime && chunk.before >= startTime;
Expand Down

0 comments on commit a3e706c

Please sign in to comment.