Skip to content

Commit

Permalink
DRY up pushState() for stops
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronbrethorst committed Sep 3, 2024
1 parent 7a9c674 commit ca21a50
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/components/map/GoogleMap.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
} from '$env/static/public';
import { debounce } from '$lib/utils';
import { pushState } from '$app/navigation';
import { createMap, loadGoogleMapsLibrary, nightModeStyles } from '$lib/googleMaps';
import LocationButton from '$lib/LocationButton/LocationButton.svelte';
import StopMarker from './StopMarker.svelte';
Expand Down Expand Up @@ -101,7 +100,6 @@
// show the same stop twice on the map
if (stop.id != selectedStopID) {
addMarker(stop);
pushState(`/stops/${stop.id}`);
map.setCenter({ lat: stop.lat, lng: stop.lon });
}
}
Expand Down Expand Up @@ -143,7 +141,6 @@
icon,
onClick: () => {
selectedStopID = s.id;
pushState(`/stops/${s.id}`);
dispatch('stopSelected', { stop: s });
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script>
import { pushState } from '$app/navigation';
import GoogleMap from '../components/map/GoogleMap.svelte';
import Header from '../components/navigation/Header.svelte';
import ModalPane from '../components/navigation/ModalPane.svelte';
Expand All @@ -15,6 +16,7 @@
function stopSelected(event) {
stop = event.detail.stop;
pushState(`/stops/${stop.id}`);
}
function closePane() {
Expand Down

0 comments on commit ca21a50

Please sign in to comment.