aboutsummaryrefslogtreecommitdiff
path: root/webAO/dom/renderAreaList.ts
blob: e622765360f38e100dd563a6b5eb40c7069d5e92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { client } from "../client";
import { area_click } from "./areaClick";

export function renderAreaList() {
  const container = document.getElementById("areas")!;
  container.innerHTML = "";

  for (let i = 0; i < client.areas.length; i++) {
    const area = client.areas[i];
    const el = document.createElement("SPAN");
    el.className = `area-button area-${area.status.toLowerCase()}`;
    el.id = `area${i}`;
    el.innerText = `${area.name} (${area.players}) [${area.status}]`;
    el.title =
      `Players: ${area.players}\n` +
      `Status: ${area.status}\n` +
      `CM: ${area.cm}\n` +
      `Area lock: ${area.locked}`;
    el.onclick = function () {
      area_click(el);
    };
    container.appendChild(el);
  }
}