Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix realtime map issues #144

Merged
merged 18 commits into from
Oct 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/pages/RealtimeMapPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function numberToColorHsl(i: number, max: number) {
}

const fiveMinutesAgo = moment().subtract(5, 'minutes')
const fourMinutesAgo = fiveMinutesAgo.add(1, 'minutes')
const fourMinutesAgo = moment().subtract(4, 'minutes')

export default function RealtimeMapPage() {
const position: Point = {
Expand Down Expand Up @@ -131,8 +131,8 @@ export default function RealtimeMapPage() {
time={to}
onChange={(ts) => {
const val = ts ? ts : from
setFrom(moment(val))
setTo(moment(val).add(moment(to).diff(moment(from)))) // keep the same time difference
setFrom(moment(val).subtract(moment(to).diff(moment(from))))
NoamGaash marked this conversation as resolved.
Show resolved Hide resolved
setTo(moment(val)) // keep the same time difference
NoamGaash marked this conversation as resolved.
Show resolved Hide resolved
}}
/>
</Grid>
Expand All @@ -144,7 +144,7 @@ export default function RealtimeMapPage() {
<MinuteSelector
num={to.diff(from) / 1000 / 60}
setNum={(num) => {
setTo(moment(from).add(Math.abs(+num) || 1, 'minutes'))
setFrom(moment(to).subtract(Math.abs(+num) || 1, 'minutes'))
NoamGaash marked this conversation as resolved.
Show resolved Hide resolved
}}
/>
</Grid>
Expand Down
Loading