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.
23 lines
717 B
JavaScript
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)),
|
|
])
|
|
]))
|
|
])
|
|
]);
|
|
}
|
|
}
|