feat: extract fuel.map component and wire Leaflet to map-update browser event

This commit is contained in:
Ovidiu U
2026-04-08 08:46:33 +01:00
parent 0809a5340b
commit bce5aa72c8
5 changed files with 64 additions and 7 deletions

View File

@@ -65,11 +65,13 @@ export function stationMap(results, meta, radius) {
maxZoom: 19,
}).addTo(this._map);
if (this.results && this.results.length > 0) {
window.addEventListener('map-update', (e) => {
this.results = e.detail.results;
this.meta = e.detail.meta;
this.radius = e.detail.radius;
this._plotMarkers();
}
});
this.$watch('results', () => this._plotMarkers());
this.locateUser();
},

View File

@@ -1,6 +1,4 @@
@props(['results' => []])
<div
x-data="stationMap(@entangle('results'), @entangle('meta'), @entangle('radius'))"
class="h-56 w-full overflow-hidden border-y border-[#e5ded7] md:h-96"
x-data="stationMap([], {}, 5)"
class="h-56 w-full overflow-hidden border-y border-border md:h-96"
></div>

View File

@@ -0,0 +1,3 @@
<div class="mb-4" wire:ignore>
<x-fuel.station-map />
</div>