Skip to content

Commit

Permalink
fixes: map switch issue, removed unncessary imports, mapview
Browse files Browse the repository at this point in the history
  • Loading branch information
tarunsinghofficial committed Sep 23, 2024
1 parent eec8172 commit 3c0f14f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/components/MapContainer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
import MapView from './map/MapView.svelte';
import GoogleMapProvider from '$lib/Provider/GoogleMapProvider';
import OpenStreetMapProvider from '$lib/Provider/OpenStreetMapProvider';
import { PUBLIC_OBA_MAP_PROVIDER, PUBLIC_OBA_GOOGLE_MAPS_API_KEY } from '$env/static/public';
import { PUBLIC_OBA_MAP_PROVIDER, PUBLIC_OBA_GOOGLE_MAPS_API_KEY as apiKey } from '$env/static/public';
import { createEventDispatcher, onMount } from 'svelte';
let mapProvider = null;
const dispatch = createEventDispatcher();
onMount(() => {
if (PUBLIC_OBA_MAP_PROVIDER === 'google') {
mapProvider = new GoogleMapProvider(PUBLIC_OBA_GOOGLE_MAPS_API_KEY);
mapProvider = new GoogleMapProvider(apiKey);
} else if (PUBLIC_OBA_MAP_PROVIDER === 'osm') {
mapProvider = new OpenStreetMapProvider();
mapProvider = new OpenStreetMapProvider(apiKey);
} else {
console.error('Unknown map provider:');
}
Expand Down
10 changes: 2 additions & 8 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
import ModalPane from '../components/navigation/ModalPane.svelte';
import StopPane from '../components/oba/StopPane.svelte';
import SearchResults from '../components/search/SearchResults.svelte';
import MapView from '../components/map/MapView.svelte';
import MapContainer from '$components/MapContainer.svelte';
import { PUBLIC_OBA_GOOGLE_MAPS_API_KEY as apiKey } from '$env/static/public';
import GoogleMapProvider from '$lib/Provider/GoogleMapProvider';
const mapProvider = new GoogleMapProvider(apiKey);
let stop;
let selectedTrip = null;
Expand Down Expand Up @@ -71,7 +66,7 @@
}
</script>
<div class="absolute left-0 right-0 top-0 z-40">
<div class="absolute top-0 left-0 right-0 z-40">
<Header on:searchResults={handleSearch} />
</div>
Expand All @@ -96,7 +91,7 @@
on:stopSelected={stopSelected}
/>
{:else}
<p class="p-4 text-center dark:text-gray-200">No results found.</p>
<p class="dark:text-gray-200 p-4 text-center">No results found.</p>
{/if}
</ModalPane>
{/if}
Expand All @@ -108,5 +103,4 @@
{showRoute}
{showRouteMap}
{stop}
{mapProvider}
/>

0 comments on commit 3c0f14f

Please sign in to comment.