Files
builazoo/web/js/ui-helpers.js
ncantu c7d389ecbb 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
2026-03-04 15:32:27 +01:00

37 lines
1.1 KiB
JavaScript

/**
* @param {string} labelContent
* @param {string} tooltipText
* @returns {HTMLElement}
*/
export function makeHelpWrap(labelContent, tooltipText) {
const wrap = document.createElement("div");
wrap.className = "help-wrap";
const label = document.createElement("span");
label.textContent = labelContent;
const icon = document.createElement("span");
icon.className = "help-icon";
icon.setAttribute("aria-label", "Aide");
icon.textContent = "?";
const bubble = document.createElement("div");
bubble.className = "tooltip-bubble";
bubble.textContent = tooltipText;
wrap.append(label, icon, bubble);
return wrap;
}
/**
* @param {HTMLElement} parent
* @param {string} titleText
* @param {string} helpText
* @returns {void}
*/
export function addSectionTitle(parent, titleText, helpText) {
const section = document.createElement("div");
section.className = "section-with-help";
const h2 = document.createElement("h2");
h2.textContent = titleText;
section.appendChild(h2);
section.appendChild(makeHelpWrap("", helpText));
parent.appendChild(section);
}