From db0b48774a5d8ea37223b9c65169ce7261a19b63 Mon Sep 17 00:00:00 2001 From: Nikolay Tatarinov Date: Sun, 1 Mar 2026 16:04:19 +0300 Subject: [PATCH] Implement error handling and visual enhancements in map components - Introduced MapErrorBoundary component to handle map loading errors gracefully. - Enhanced MapView with a reconnection status indicator for live updates. - Added tile freshness animation to indicate updated tiles visually. - Preloaded marker icon images to improve rendering performance. - Updated various pages to utilize the new MapErrorBoundary for better user experience. --- .../assets/css/leaflet-overrides.css | 15 +++++++++ frontend-nuxt/components/MapErrorBoundary.vue | 33 +++++++++++++++++++ frontend-nuxt/components/MapView.vue | 15 ++++++++- frontend-nuxt/composables/useMapInit.ts | 31 +++++++++++++++++ frontend-nuxt/composables/useMapUpdates.ts | 18 +++++++++- frontend-nuxt/lib/SmartTileLayer.ts | 5 ++- .../pages/character/[characterId].vue | 4 ++- .../grid/[map]/[gridX]/[gridY]/[zoom].vue | 14 ++++---- frontend-nuxt/pages/index.vue | 4 ++- 9 files changed, 128 insertions(+), 11 deletions(-) create mode 100644 frontend-nuxt/components/MapErrorBoundary.vue diff --git a/frontend-nuxt/assets/css/leaflet-overrides.css b/frontend-nuxt/assets/css/leaflet-overrides.css index bf2023a..05348f8 100644 --- a/frontend-nuxt/assets/css/leaflet-overrides.css +++ b/frontend-nuxt/assets/css/leaflet-overrides.css @@ -8,3 +8,18 @@ .leaflet-tile { visibility: visible !important; } + +/* Brief highlight when a tile is updated via SSE (tile freshness indicator). */ +@keyframes tile-fresh-glow { + 0% { + filter: brightness(1.15); + box-shadow: 0 0 0 0 oklch(0.6 0.2 264 / 0.4); + } + 100% { + filter: brightness(1); + box-shadow: none; + } +} +.leaflet-tile.tile-fresh { + animation: tile-fresh-glow 0.6s ease-out; +} diff --git a/frontend-nuxt/components/MapErrorBoundary.vue b/frontend-nuxt/components/MapErrorBoundary.vue new file mode 100644 index 0000000..1e7471e --- /dev/null +++ b/frontend-nuxt/components/MapErrorBoundary.vue @@ -0,0 +1,33 @@ + + + diff --git a/frontend-nuxt/components/MapView.vue b/frontend-nuxt/components/MapView.vue index 9cb891e..3398d09 100644 --- a/frontend-nuxt/components/MapView.vue +++ b/frontend-nuxt/components/MapView.vue @@ -32,6 +32,17 @@ :mapid="mapLogic.state.mapid.value" :display-coords="mapLogic.state.displayCoords.value" /> +
+ + +