Roster: icon view switcher, phone table

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-28 18:58:31 +00:00
parent 0e89f37283
commit a205d429bd
2 changed files with 14 additions and 8 deletions

View file

@ -2665,8 +2665,8 @@ function rosterNav() {
function roster() {
const ordered = [...S.players].sort((a, b) => online(b) - online(a)); // stable: by donations within each
const view = (id, label) => `<button class="tab ${rosterView === id ? "on" : ""}" data-roster-view="${id}">${label}</button>`;
return `<div class="tabs sm roster-views">${view("cards", "▦ Cards")}${view("table", "☰ Table")}</div>`
const view = (id, icon, label) => `<button class="tab ${rosterView === id ? "on" : ""}" data-roster-view="${id}" title="${label}" aria-label="${label}">${icon}</button>`;
return `<div class="tabs sm roster-views">${view("cards", "▦", "Cards")}${view("table", "☰", "Table")}</div>`
+ (rosterView === "table" ? rosterTable(ordered) : rosterCards(ordered));
}
@ -2713,15 +2713,15 @@ function rosterTable(players) {
<td class="left"><div class="who-cell"><span class="avatar">${crest(p.look, 30)}${presence(p)}</span>
<div><button class="who" data-nav="character:${esc(p.id)}" title="Character sheet">${esc(p.name)}</button><div class="small muted">${rosterSub(p)}${lastSeen(p)}</div></div></div></td>
<td class="total">${p.total}</td>
<td class="left"><div class="doing small">${rosterDoing(p)}${p.garrison ? `<span class="tag warn" title="On guard">🛡️</span>` : ""}${joinButton(p)}</div></td>
<td class="left doing-col"><div class="doing small">${rosterDoing(p)}${p.garrison ? `<span class="tag warn" title="On guard">🛡️</span>` : ""}${joinButton(p)}</div></td>
${skills.map((s) => {
const lvl = p.levels[s.id];
return `<td class="${sep(s)} ${lvl <= 1 ? "low" : lvl === best[s.id] ? "best" : ""}" title="${s.name} ${lvl}">${lvl}</td>`;
}).join("")}
<td class="favour">${fmt(p.donated)}</td></tr>`).join("");
return `<div class="panel roster-table"><table>
<thead><tr><th colspan="3"></th>${groups.map(([name, list]) => `<th class="grp sep" colspan="${list.length}">${esc(name)}</th>`).join("")}<th></th></tr>
<tr><th class="left">Player</th><th>Total</th><th class="left">Doing</th>${skills.map((s) => `<th class="${sep(s)}" title="${s.name}">${s.icon}</th>`).join("")}<th class="favour" title="Given to the city">${FAVOUR}</th></tr></thead>
<thead><tr><th colspan="2"></th><th class="doing-col"></th>${groups.map(([name, list]) => `<th class="grp sep" colspan="${list.length}">${esc(name)}</th>`).join("")}<th></th></tr>
<tr><th class="left">Player</th><th>Total</th><th class="left doing-col">Doing</th>${skills.map((s) => `<th class="${sep(s)}" title="${s.name}">${s.icon}</th>`).join("")}<th class="favour" title="Given to the city">${FAVOUR}</th></tr></thead>
<tbody>${rows}</tbody></table></div>`;
}