1
0
watterblock/ui/session_list.js
Adrian Wannenmacher 4e9d35178a
make opening sessions by query param possible
Specific sessions can now be opened by setting a query param to their
id. This is needed to allow users to reload the page without being
kicked out to the session selection.
2026-02-27 00:08:18 +01:00

23 lines
717 B
JavaScript

"use strict";
import Session from "/models/session.js";
export default class SessionList {
/** @param {{ attrs: { models: Session[] } }} param The sessions to show. */
view({attrs: { models, onSelect, onNew } }) {
return m("section", [
m("button", { onclick: () => onNew() }, "Neie Session"),
m("ol", [
models.map((s) => m("li", [
m("button", { onclick: () => onSelect(s) }, [
m("p", s.ourTeam !== "" ? s.ourTeam : "Unbnannts Team"),
m("p", s.theirTeam !== "" ? s.theirTeam : "Unbnannts Team"),
m("p", "•".repeat(s.result.ourPoints)),
m("p", "•".repeat(s.result.theirPoints)),
])
]))
])
]);
}
}