feat(map): right-click place dossier (Nominatim + nearby overlays)
Right-click (long-press on touch) opens a What's here? HUD panel: reverse geocode via GET /api/place (honest UA, 1 req/s, 60s/500-key cache) and lists already-loaded cameras, aircraft, vessels, fires, and alerts within 5 km.
This commit is contained in:
parent
c48788d4b6
commit
5cef596a3c
7 changed files with 566 additions and 6 deletions
59
tests/test_place_dossier_frontend.py
Normal file
59
tests/test_place_dossier_frontend.py
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
"""Right-click place dossier HUD contract."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
HTML = (ROOT / "app/static/index.html").read_text()
|
||||
|
||||
|
||||
def test_place_dossier_panel_markup():
|
||||
assert 'id="place-dossier"' in HTML
|
||||
assert "What’s here?" in HTML or "What's here?" in HTML
|
||||
assert 'id="pd-nearby"' in HTML
|
||||
assert 'id="pd-close"' in HTML
|
||||
assert 'role="dialog"' in HTML
|
||||
|
||||
|
||||
def test_place_dossier_uses_backend_nominatim_proxy():
|
||||
js = HTML.split("async function openPlaceDossier", 1)[1].split(
|
||||
"/* ═══════════════ INITIAL LOAD", 1
|
||||
)[0]
|
||||
assert "/api/place?lat=" in js
|
||||
assert "nominatim.openstreetmap.org" not in js
|
||||
assert "/api/aircraft" not in js
|
||||
assert "/api/vessels" not in js
|
||||
assert "/api/cameras" not in js
|
||||
assert "/api/fires" not in js
|
||||
assert "/api/weather-alerts" not in js
|
||||
assert "/api/infrastructure" not in js
|
||||
|
||||
|
||||
def test_place_dossier_scans_loaded_overlays_5km():
|
||||
assert "const PLACE_PAD_KM = 5" in HTML
|
||||
assert "function collectNearby" in HTML
|
||||
assert "lastCams" in HTML
|
||||
assert "lastAircraft" in HTML
|
||||
assert "lastVessels" in HTML
|
||||
assert "lastFires" in HTML
|
||||
assert "lastAlerts" in HTML
|
||||
assert "function haversineKm" in HTML
|
||||
|
||||
|
||||
def test_place_dossier_right_click_and_long_press():
|
||||
assert "map.on('contextmenu'" in HTML
|
||||
assert "function bindPlaceLongPress" in HTML
|
||||
assert "function closePlaceDossier" in HTML
|
||||
assert "Escape" in HTML.split("function initMap", 1)[1][:8000] or "Escape" in HTML.split(
|
||||
"bindPlaceLongPress(map)", 1
|
||||
)[0][-500:]
|
||||
|
||||
|
||||
def test_place_dossier_mobile_is_bottom_sheet():
|
||||
mobile = HTML.split("@media (max-width: 820px)")[1].split(
|
||||
"@media (prefers-reduced-motion"
|
||||
)[0]
|
||||
assert "#place-dossier" in mobile
|
||||
assert "bottom: 56px" in mobile
|
||||
assert "max-height: 36vh" in mobile
|
||||
Loading…
Reference in a new issue