diff --git a/webapp/src/components/Map.svelte b/webapp/src/components/Map.svelte index c190e2a..3930afa 100644 --- a/webapp/src/components/Map.svelte +++ b/webapp/src/components/Map.svelte @@ -5,9 +5,12 @@ import { SpotType, type ID, type ParkingLot } from "$lib/types"; import { currentMap } from "$lib/store"; import { markerColor, parkingLotStatus } from "$lib/utils"; + import MapMarker from "./MapMarker.svelte"; export let parkingLots: Record; + const markers: Record = {}; + onMount(async () => { const mapboxgl = await import("mapbox-gl"); const map = new mapboxgl.Map({ @@ -28,9 +31,10 @@ `; const popup = new mapboxgl.Popup({offset: 25}).setHTML(popupHtml); const status = parkingLotStatus(parkingLot, SpotType.CAR)[0]; - const options = { + const options: mapboxgl.MarkerOptions = { color: markerColor(parkingLot.state.availableSpots["CAR"], parkingLot.metadata.totalSpots["CAR"], status) } + const marker = markers[id]; return new mapboxgl.Marker(options) .setLngLat([longitude, latitude]) .setPopup(popup); @@ -40,6 +44,9 @@
+{#each Object.entries(parkingLots) as [id, parkingLot]} + +{/each} \ No newline at end of file diff --git a/webapp/src/components/MapMarker.svelte b/webapp/src/components/MapMarker.svelte new file mode 100644 index 0000000..2749a0a --- /dev/null +++ b/webapp/src/components/MapMarker.svelte @@ -0,0 +1,20 @@ + +
+ room + Elo +
+ + \ No newline at end of file