1
0
watterblock/ui/session_head.js
Adrian Wannenmacher 7e7410a406
improve design of session view
This improves the design of the session view a lot. However, several
things still need to be done:

1. The rules section is not styled.

2. The session list is not styled.

3. The design is not responsive yet. This will take longer, as the base
   view will need to be overhauled substantially to take advantage of
   wider screens.

4. A light mode needs to be added.
2026-03-03 01:45:14 +01:00

70 lines
2.0 KiB
JavaScript

"use strict";
import { RaisingRule } from "/models/game_rules.js";
import Session from "/models/session.js";
export default class SessionHead {
/** @param {{ attrs: { model: Session } }} param The session model to use. */
view({ attrs: { model } }) {
return m("section.session_head", [
m("h3", "Satzeinstellungen"),
m("section.session-head-names", [
m("h4", "Teamnamen"),
m("label", [
"Nam von eana",
m("input", {
placeholder: "Se",
value: model.theirTeam,
oninput: (e) => model.theirTeam = e.target.value,
}),
]),
m("label", [
"Nam von ins",
m("input", {
placeholder: "Mia",
value: model.ourTeam,
oninput: (e) => model.ourTeam = e.target.value,
}),
]),
]),
m("section.session-head-base", [
m("h4", "Grundregln"),
m("label", [
"Punkte zum gwinna",
m("input", {
placeholder: "mindestns 1",
type: "number",
value: model.rules.goal,
oninput: (e) => {
let num = parseInt(e.target.value);
if (!isNaN(num) && num >= 1)
model.rules.goal = num;
else
alert("Es Punkteziel muas a Nummer größer als null sein.");
},
}),
]),
]),
m("section.session-head-raising", [
m("h4", "Erhöhn"),
m("label", [
m("input", {
type: "radio",
checked: model.rules.raising === RaisingRule.UnlessStricken,
oninput: () => model.rules.raising = RaisingRule.UnlessStricken,
}),
"Außa wenn gstrichn",
]),
m("label", [
m("input", {
type: "radio",
checked: model.rules.raising === RaisingRule.UntilEnough,
oninput: () => model.rules.raising = RaisingRule.UntilEnough,
}),
"Bis es langt",
]),
]),
])
}
}