3.9 KiB
TASK-249 - Wire map images and Steam brand icon
Summary
This task connects the new local map images to current match and historical match detail using a shared frontend resolver, and wires the new Steam brand icon into the external profile buttons.
No map or brand asset files were modified.
Files Read First
frontend/partida-actual.htmlfrontend/assets/js/partida-actual.jsfrontend/historico-partida.htmlfrontend/assets/js/historico-partida.jsfrontend/assets/css/historico.cssfrontend/assets/img/maps/frontend/assets/img/brands/
Problem
The frontend was still using narrow map-name heuristics and did not know how to resolve the new map image naming pattern consistently across:
- current match
- historical match detail
The Steam external profile button also had no brand icon wired even though the asset already existed locally.
Decision
Create one shared client-side resolver instead of duplicating ad hoc logic in each page.
Rules:
- normalize map ids, layer ids and pretty names aggressively
- resolve to local assets using the
mapid-environment.webppattern when possible - keep a safe fallback image path
- do not modify physical assets
Asset Coverage Detected
Detected local coverage in frontend/assets/img/maps/:
carentan: day, dusk, night, raindriel: dawn, day, nightelalamein: day, duskelsenbornridge: dawn, day, dusk, nightfoy: day, nighthill400: day, dusk, nighthurtgenforest: day, nightjunobeach: dawn, day, nightkharkov: day, nightkursk: day, nightmortain: day, dusk, night, overcastomahabeach: day, duskpurpleheartlane: dawn, day, night, rainremagen: day, nightsmolensk: day, dusk, nightstalingrad: day, dusk, night, overcaststmariedumont: day, night, rainstmereeglise: dawn, day, nighttobruk: dawn, day, duskutahbeach: day, night- fallback assets:
unknown-day.webp,unknown.webp
Implementation
Shared map resolver
Added frontend/assets/js/map-image-resolver.js with:
- canonical map aliases
- environment aliases
- compact normalization of layer ids and display names
- deterministic fallback selection
Examples resolved correctly:
junobeachwarfare->./assets/img/maps/junobeach-day.webpJuno Beach Warfare->./assets/img/maps/junobeach-day.webputahbeach->./assets/img/maps/utahbeach-day.webpDriel->./assets/img/maps/driel-day.webpst marie du mont warfare->./assets/img/maps/stmariedumont-day.webp
Current match
partida-actual.htmlnow loads the shared resolver before the page script.partida-actual.jsnow resolves map assets from layer id, map id and pretty names instead of a short hardcoded map list.
Historical match detail
historico-partida.htmlnow loads the shared resolver.historico-partida.jsnow resolves map images frommatch_id,map.id,map.nameandmap.pretty_name.- It keeps the existing fallback behavior if no match is found.
Steam brand icon
- Wired the Steam profile button to
./assets/img/brands/steam.png. - Added
onerror="this.remove();"to brand icons so a missing file does not leave a broken image.
Validation
Executed:
node --check frontend/assets/js/map-image-resolver.jsnode --check frontend/assets/js/partida-actual.jsnode --check frontend/assets/js/historico-partida.js
Static/runtime validation performed:
- confirmed
historico-partida.htmldoes not loadcurrent-match-weapon-icons.js - confirmed
partida-actual.htmlstill loadscurrent-match-weapon-icons.js - confirmed resolver maps
junobeachwarfaretojunobeach-day.webp - confirmed resolver maps
utahbeach,drielandst marie du mont warfareto existing local assets - confirmed Steam button now points to the brand icon asset when present
Notes
- No backend changes were required for this task.
- No asset files were moved, renamed or modified.
- No weapon or clan asset path was touched.