From ee1ee1e90171b1f73468b644fda4158aee3f5b5c Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Sat, 24 Jan 2026 19:55:09 +0000 Subject: [PATCH] Add map and photo upload to nuisance report page --- htmlpage/static/js/map-locator.js | 14 ++- public-report/mock.go | 8 +- public-report/template/mock/nuisance.html | 121 ++++++++++++++++++---- public-report/template/pool.html | 1 - 4 files changed, 113 insertions(+), 31 deletions(-) diff --git a/htmlpage/static/js/map-locator.js b/htmlpage/static/js/map-locator.js index 012ba60d..65b94cd1 100644 --- a/htmlpage/static/js/map-locator.js +++ b/htmlpage/static/js/map-locator.js @@ -12,7 +12,7 @@ class MapLocator extends HTMLElement { this.render(); // markers shown on the map. Should be none or 1, generally. - this._markers = null; + this._markers = []; } // Lifecycle: when element is added to the DOM @@ -34,9 +34,9 @@ class MapLocator extends HTMLElement { const lng = Number(this.getAttribute('longitude') || -119.2); const zoom = Number(this.getAttribute('zoom') || 15); - const mapElement = this.shadowRoot.querySelector("#map"); mapboxgl.accessToken = apiKey; - map = new mapboxgl.Map({ + const mapElement = this.shadowRoot.querySelector("#map"); + this._map = new mapboxgl.Map({ container: mapElement, center: { lat: lat, @@ -45,6 +45,7 @@ class MapLocator extends HTMLElement { style: 'mapbox://styles/mapbox/streets-v12', // style URL zoom: zoom, }); + /* map.addControl(new mapboxgl.GeolocateControl({ positionOptions: { enableHighAccuracy: true @@ -53,7 +54,9 @@ class MapLocator extends HTMLElement { showUserHeading: true })); map.addControl(new mapboxgl.NavigationControl()); - map.on("load", function() { + */ + this._map.on("load", () => { + console.log("map loaded"); this.dispatchEvent(new CustomEvent('load'), { bubbles: true, composed: true, // Allows event to cross shadow DOM boundary @@ -67,6 +70,7 @@ class MapLocator extends HTMLElement { // Initial render of component render() { this.shadowRoot.innerHTML = ` +