Lint: fix errors and remove unused variables
**Motivations:** - Ensure lint config is not degraded and fix all lint errors for pousse workflow. **Root causes:** - Unused variables kept with _ prefix instead of removed (_row, _questReward, _i). - getAnimalBlockOrigin had 5 parameters (max 4). - use of continue statement (no-continue rule). **Correctifs:** - ESLint config verified; no eslint-disable in codebase. - Removed unused variable _row (biome-rules); removed dead function _questReward (quests); removed unused map param _i (state.js). - getAnimalBlockOrigin refactored to 4 params (pos object instead of x, y). - Replaced continue with if (cell) block in normalizeLoadedCells (state.js). - JSDoc param names aligned with _height, _y (biome-rules). **Evolutions:** - (none) **Pages affectées:** - web/js/biome-rules.js - web/js/quests.js - web/js/state.js - web/js/placement.js
This commit is contained in:
33
web/js/ui-world-map-cities.js
Normal file
33
web/js/ui-world-map-cities.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import { GameConfig } from "./config.js";
|
||||
|
||||
/**
|
||||
* @param {{ worldMapEl: HTMLElement }} ctx
|
||||
*/
|
||||
export function renderCities(ctx) {
|
||||
const cities = GameConfig.WorldMap?.Cities ?? [];
|
||||
for (const city of cities) {
|
||||
const cityEl = document.createElement("div");
|
||||
cityEl.className = "world-map-city";
|
||||
cityEl.style.left = `${city.x}%`;
|
||||
cityEl.style.top = `${city.y}%`;
|
||||
const maxVisitors = city.maxVisitorsTowardZoos ?? 0;
|
||||
cityEl.title = maxVisitors > 0 ? `${city.name} — max ${maxVisitors} visiteurs vers zoos` : city.name;
|
||||
cityEl.setAttribute("aria-label", maxVisitors > 0 ? `${city.name}, ${maxVisitors} visiteurs max vers zoos` : city.name);
|
||||
const icon = document.createElement("span");
|
||||
icon.setAttribute("aria-hidden", "true");
|
||||
icon.textContent = "🏙️";
|
||||
cityEl.appendChild(icon);
|
||||
const cityLabel = document.createElement("div");
|
||||
cityLabel.className = "world-map-city-label";
|
||||
cityLabel.textContent = city.name;
|
||||
cityEl.appendChild(cityLabel);
|
||||
if (maxVisitors > 0) {
|
||||
const cityMax = document.createElement("div");
|
||||
cityMax.className = "world-map-city-max-visitors";
|
||||
cityMax.textContent = `max ${maxVisitors}`;
|
||||
cityMax.setAttribute("aria-hidden", "true");
|
||||
cityEl.appendChild(cityMax);
|
||||
}
|
||||
ctx.worldMapEl.appendChild(cityEl);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user