mirror of
https://github.com/azaion/ui.git
synced 2026-06-21 13:41:12 +00:00
[AZ-450] [AZ-451] [AZ-452] [AZ-454] Externalize URLs + accessors
Refactor batch 1 of 2 for the 01-testability-refactoring epic (AZ-447). Minimal-surgical edits to make the UI's external dependencies overridable for the test profiles in _docs/02_document/tests/environment.md. - AZ-450 (C03): tile URLs externalized to VITE_OSM_TILE_URL and VITE_ESRI_TILE_URL with the production strings as defaults. Fixes the AC-N3 / NFT-RES-03 air-gap regression and lets the e2e profile's tile-stub serve tiles deterministically. - AZ-451 (C04): Leaflet marker icon imported from the pinned leaflet package as a Vite asset; removes the unpkg.com CDN reference (also fixes the leaflet@1.7.1 vs ^1.9.4 mismatch). - AZ-452 (C05): getApiBase() accessor reading VITE_API_BASE_URL. request(), refreshToken(), and createSSE() prepend the prefix. Default '' preserves every call site. - AZ-454 (C07): JSDoc on setToken/getToken documenting the test-override intent so future cleanup doesn't delete them. Also: .env.example documents every VITE_* var; vite-env.d.ts declares ImportMetaEnv; .gitignore now excludes /dist and *.tsbuildinfo (tracked-by-mistake cache file removed). Build verification: `bunx tsc -b --noEmit` passes. No tests in this run (testability-run exemption per refactor SKILL — tests land in autodev Step 6). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import L from 'leaflet'
|
||||
import markerIcon from 'leaflet/dist/images/marker-icon.png'
|
||||
|
||||
function pinIcon(color: string) {
|
||||
return L.divIcon({
|
||||
@@ -15,7 +16,7 @@ export const pointIconBlue = pinIcon('#228be6')
|
||||
export const pointIconRed = pinIcon('#fa5252')
|
||||
|
||||
export const defaultIcon = new L.Icon({
|
||||
iconUrl: 'https://unpkg.com/leaflet@1.7.1/dist/images/marker-icon.png',
|
||||
iconUrl: markerIcon,
|
||||
iconSize: [25, 41],
|
||||
iconAnchor: [12, 41],
|
||||
popupAnchor: [1, -34],
|
||||
|
||||
@@ -52,7 +52,13 @@ export const PURPOSES = [
|
||||
|
||||
export const COORDINATE_PRECISION = 8
|
||||
|
||||
const trimTrailingSlash = (s: string) => s.replace(/\/+$/, '')
|
||||
|
||||
export const TILE_URLS = {
|
||||
classic: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
satellite: 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
|
||||
classic:
|
||||
trimTrailingSlash(import.meta.env.VITE_OSM_TILE_URL ?? '') ||
|
||||
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||
satellite:
|
||||
trimTrailingSlash(import.meta.env.VITE_ESRI_TILE_URL ?? '') ||
|
||||
'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
|
||||
} as const
|
||||
|
||||
Reference in New Issue
Block a user