diff options
Diffstat (limited to 'webAO/dom/renderAreaList.ts')
| -rw-r--r-- | webAO/dom/renderAreaList.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/webAO/dom/renderAreaList.ts b/webAO/dom/renderAreaList.ts new file mode 100644 index 0000000..e622765 --- /dev/null +++ b/webAO/dom/renderAreaList.ts @@ -0,0 +1,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); + } +} |
