Mondsaal: Sitzplan mit Platzwahl und Reihen-Fluestern (Zusatzansicht)
Knopf im Chatkopf oeffnet eine Tafel ueber der Chatspalte (am Handy unter dem Video, nie auf dem YouTube-Bild): 6 Reihen x 12 Plaetze, Stammplatz bleibt gemerkt (60 Tage), unsichtbar sitzen verraet keinen Namen, auch nicht in der Schnittstelle. Reihen-Fluestern nur fuer die eigene Reihe, das Team liest mit und entfernt; dieselben Schranken wie im Saal-Chat; geleert beim Beenden. Neue Tabellen reaktion_plaetze, reaktion_fluestern (DB vorher gesichert). reaktion.js reicht den Strom als saal:strom weiter. pruef-reaktion 673, mondsaal-test 20/20. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
/* =====================================================================
|
||||
DER MONDSAAL (03.11.2026) – siehe mondsaal.js
|
||||
Eine ruhige Seitentafel; der eigene Platz golden, alle anderen gedeckt.
|
||||
Jeder Sitz ist ein 44-px-Tippziel – die Reihen brechen um, statt seitlich
|
||||
zu rollen (Filipe, 28.09.2026: nie wischen müssen).
|
||||
===================================================================== */
|
||||
.schiene__mond { gap: 6px; }
|
||||
.schiene__mond svg { width: 16px; height: 16px; fill: currentColor; }
|
||||
.schiene__mond[hidden] { display: none !important; }
|
||||
@media (max-width: 860px) { .schiene__mond-wort { display: none; } }
|
||||
|
||||
.mondsaal {
|
||||
position: fixed; z-index: 80;
|
||||
top: var(--ms-oben, 30dvh); right: var(--ms-rechts, 0px); bottom: 0; left: auto;
|
||||
width: var(--ms-breite, min(420px, 100vw)); max-height: none; height: auto;
|
||||
margin: 0; padding: 0;
|
||||
display: none; flex-direction: column;
|
||||
border: 1px solid var(--rand-hell, rgba(170, 180, 210, .26)); border-radius: 0;
|
||||
background: #0b0a14; color: var(--schrift, #e8f1fa);
|
||||
box-shadow: -30px -20px 80px -30px #000;
|
||||
overflow: hidden;
|
||||
}
|
||||
.mondsaal[open] { display: flex; }
|
||||
.mondsaal [hidden] { display: none !important; }
|
||||
.mondsaal__kopf { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--rand, rgba(150, 160, 190, .14)); }
|
||||
.mondsaal__kopf h2 { margin: 0; font-size: 1rem; }
|
||||
.mondsaal__reiter { display: flex; gap: 4px; padding: 8px 10px 0; }
|
||||
.mondsaal__tab {
|
||||
appearance: none; min-height: 44px; padding: 0 14px; border: 0; border-radius: 10px;
|
||||
background: none; color: var(--schrift-leise, #a9a3bd); font: inherit; font-weight: 700; cursor: pointer;
|
||||
}
|
||||
.mondsaal__tab[aria-selected="true"] { color: var(--schrift, #e8f1fa); background: rgba(143, 211, 255, .09); box-shadow: inset 0 0 0 1px rgba(143, 211, 255, .22); }
|
||||
.mondsaal__tab:disabled { opacity: .45; cursor: default; }
|
||||
.mondsaal__seite { padding: 10px 14px 14px; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 10px; align-content: start; }
|
||||
|
||||
.ms-leinwand {
|
||||
text-align: center; font-size: .66rem; letter-spacing: .3em; text-transform: uppercase; color: var(--schrift-leise, #a9a3bd);
|
||||
padding: 6px; border-radius: 0 0 50% 50% / 0 0 100% 100%; border-bottom: 2px solid rgba(143, 211, 255, .35);
|
||||
}
|
||||
.ms-plan { display: grid; gap: 6px; }
|
||||
.ms-reihe { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 6px; align-items: start; }
|
||||
.ms-reihe__name { font-size: .72rem; font-weight: 700; color: var(--schrift-leise, #a9a3bd); line-height: 44px; text-align: center; }
|
||||
.ms-reihe__sitze { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px; }
|
||||
.ms-sitz {
|
||||
position: relative; appearance: none; min-height: 44px; min-width: 44px; padding: 0;
|
||||
border-radius: 50%; border: 1px solid rgba(170, 180, 210, .3); background: none;
|
||||
color: var(--schrift, #e8f1fa); font: inherit; font-size: .72rem; font-weight: 700; cursor: pointer;
|
||||
}
|
||||
.ms-sitz[data-art="frei"]:hover { background: rgba(143, 211, 255, .1); }
|
||||
.ms-sitz[data-art="besetzt"] { background: rgba(169, 147, 230, .16); border-color: transparent; cursor: default; }
|
||||
.ms-sitz[data-art="reserviert"] { border-style: dashed; opacity: .45; cursor: default; }
|
||||
.ms-sitz[data-art="ich"] { border: 2px solid #e6c35c; color: #ecd38a; background: rgba(230, 195, 92, .1); cursor: default; }
|
||||
.ms-sitz:disabled { opacity: 1; }
|
||||
.ms-sitz[data-art="reserviert"]:disabled { opacity: .45; }
|
||||
.ms-sitz:focus-visible { outline: 2px solid #8fd3ff; outline-offset: 2px; }
|
||||
.ms-sitz__name {
|
||||
position: absolute; left: 50%; bottom: calc(100% + 4px); transform: translateX(-50%);
|
||||
white-space: nowrap; font-size: .72rem; font-weight: 600; padding: 2px 6px; border-radius: 6px;
|
||||
background: #0d0c16; border: 1px solid rgba(170, 180, 210, .26); opacity: 0; pointer-events: none;
|
||||
}
|
||||
.ms-sitz:hover .ms-sitz__name, .ms-sitz:focus-visible .ms-sitz__name { opacity: 1; }
|
||||
.ms-mein { margin: 4px 0 0; font-weight: 700; }
|
||||
.ms-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
|
||||
.ms-schalter { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
|
||||
.ms-hinweis, .ms-sagt { color: var(--schrift-leise, #a9a3bd); font-size: .84rem; line-height: 1.5; margin: 0; }
|
||||
.ms-sagt { padding: 0 14px 12px; min-height: 1em; }
|
||||
.ms-sagt:empty { display: none; }
|
||||
.ms-team { display: grid; gap: 4px; font-size: .78rem; color: var(--schrift-leise, #a9a3bd); }
|
||||
.ms-team:has(select[hidden]) { display: none; }
|
||||
.ms-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 42dvh; overflow-y: auto; }
|
||||
.ms-beitrag { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; }
|
||||
.ms-beitrag strong { font-size: .82rem; grid-column: 1; }
|
||||
.ms-beitrag span { grid-column: 1; overflow-wrap: anywhere; }
|
||||
.ms-beitrag[data-ich="ja"] strong { color: #ecd38a; }
|
||||
.ms-weg { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
|
||||
.ms-form { display: flex; gap: 8px; }
|
||||
.ms-form .eingabe { flex: 1 1 auto; min-width: 0; min-height: 44px; }
|
||||
|
||||
@media (max-width: 860px) {
|
||||
.mondsaal { border-radius: 16px 16px 0 0; }
|
||||
}
|
||||
@@ -188,6 +188,14 @@
|
||||
Satz. Ein Maschinenwort auf dem Bildschirm ist kein Fehler des
|
||||
Servers -- es ist einer der Oberflaeche, und pruef-meldungen
|
||||
zaehlt sie mit. */
|
||||
platz_ungueltig:
|
||||
'Diesen Platz gibt es im Mondsaal nicht.',
|
||||
platz_belegt:
|
||||
'Der Platz ist gerade vergeben – such dir einen anderen.',
|
||||
kein_platz:
|
||||
'Such dir zuerst einen Platz im Mondsaal, dann flüsterst du mit deiner Reihe.',
|
||||
nur_team:
|
||||
'Das darf nur das Team.',
|
||||
nicht_live:
|
||||
'Das geht nur, während die Sendung live ist.',
|
||||
medienweiche_nicht_eingerichtet:
|
||||
|
||||
@@ -0,0 +1,212 @@
|
||||
/* =====================================================================
|
||||
DER MONDSAAL (03.11.2026, Neuplan M1/M2) – Zusatzansicht des Saals
|
||||
|
||||
Ein Knopf im Chatkopf öffnet eine Seitentafel: der SITZPLAN (Platzwahl
|
||||
wie im Kino, der Platz bleibt als Stammplatz für die nächste Sendung)
|
||||
und das REIHEN-FLÜSTERN (ein kleiner Chat nur mit der eigenen Reihe;
|
||||
das Team liest mit und kann Beiträge entfernen).
|
||||
|
||||
Der Saal selbst bleibt unverändert – ob der Raum einmal Standard wird,
|
||||
ist Filipes Entscheidung (Plan G, Nr. 7). Alles, was hier steht, kommt
|
||||
vom Server (/workspace/api/reaktion/mondsaal, …/fluestern); was ein
|
||||
Platz über seinen Besitzer verrät, entscheidet der Server.
|
||||
|
||||
Live-Änderungen kommen über den Ereignisstrom des Saals: reaktion.js
|
||||
reicht jede Meldung als `saal:strom` weiter.
|
||||
===================================================================== */
|
||||
(() => {
|
||||
'use strict';
|
||||
const $ = (id) => document.getElementById(id);
|
||||
const el = (tag, cls, text) => { const e = document.createElement(tag); if (cls) e.className = cls; if (text != null) e.textContent = text; return e; };
|
||||
const kuerzel = (n) => String(n || '?').trim().split(/\s+/).map((w) => w[0]).join('').slice(0, 2).toUpperCase();
|
||||
let plan = null;
|
||||
let reiter = 'plan';
|
||||
let fluesterReihe = null;
|
||||
let team = false;
|
||||
|
||||
async function holen(weg, opt) {
|
||||
const a = await fetch(weg, { credentials: 'same-origin', cache: 'no-store', ...(opt || {}) });
|
||||
const j = await a.json().catch(() => null);
|
||||
return { ok: a.ok, code: a.status, j };
|
||||
}
|
||||
/* Die Sätze stehen an EINER Stelle (meldung.js, von pruef-meldungen bewacht). */
|
||||
const satz = (j, sonst) => (window.sagWas ? window.sagWas(j?.fehler, sonst) : sonst);
|
||||
function sagen(text) { $('ms-sagt').textContent = text || ''; }
|
||||
|
||||
/* ------------------------------------------------------------ Sitzplan */
|
||||
async function planLaden() {
|
||||
const r = await holen('/workspace/api/reaktion/mondsaal');
|
||||
if (!r.ok || !r.j) { sagen('Der Sitzplan ging gerade nicht.'); return; }
|
||||
plan = r.j;
|
||||
planZeichnen();
|
||||
}
|
||||
function planZeichnen() {
|
||||
const f = $('ms-plan');
|
||||
f.textContent = '';
|
||||
for (const r of plan.reihen) {
|
||||
const zeile = el('div', 'ms-reihe');
|
||||
zeile.setAttribute('role', 'group');
|
||||
zeile.setAttribute('aria-label', `Reihe ${r.reihe}`);
|
||||
zeile.append(el('span', 'ms-reihe__name', r.reihe));
|
||||
const sitze = el('div', 'ms-reihe__sitze');
|
||||
for (const p of r.plaetze) {
|
||||
const k = el('button', 'ms-sitz');
|
||||
k.type = 'button';
|
||||
k.dataset.reihe = r.reihe;
|
||||
k.dataset.platz = p.platz;
|
||||
const art = p.ich ? 'ich' : p.frei ? 'frei' : p.reserviert ? 'reserviert' : 'besetzt';
|
||||
k.dataset.art = art;
|
||||
k.textContent = p.ich ? '★' : p.name ? kuerzel(p.name) : '';
|
||||
const wer = p.ich ? `dein Platz${p.unsichtbar ? ' (unsichtbar)' : ''}` : p.frei ? 'frei' : p.reserviert ? 'Stammplatz von jemandem' : p.name ? `besetzt: ${p.name}` : 'besetzt';
|
||||
k.setAttribute('aria-label', `Reihe ${r.reihe}, Platz ${p.platz}: ${wer}`);
|
||||
if (p.name && !p.ich) k.append(el('span', 'ms-sitz__name', p.name));
|
||||
k.disabled = !(p.frei || p.ich);
|
||||
if (p.frei) k.addEventListener('click', () => setzen(r.reihe, p.platz));
|
||||
sitze.append(k);
|
||||
}
|
||||
zeile.append(sitze);
|
||||
f.append(zeile);
|
||||
}
|
||||
const mein = plan.mein;
|
||||
$('ms-mein').textContent = mein ? `Dein Platz: Reihe ${mein.reihe}, Platz ${mein.platz}${mein.unsichtbar ? ' – unsichtbar' : ''}` : 'Du hast noch keinen Platz. Tipp einen freien an.';
|
||||
$('ms-unsichtbar').checked = !!mein?.unsichtbar;
|
||||
$('ms-unsichtbar').disabled = !mein;
|
||||
$('ms-frei').hidden = !mein;
|
||||
const rk = $('ms-reiter-reihe');
|
||||
rk.textContent = mein ? `Reihe ${mein.reihe}` : 'Reihe';
|
||||
rk.disabled = !mein && !team;
|
||||
}
|
||||
async function setzen(reihe, platz, unsichtbar) {
|
||||
const r = await holen('/workspace/api/reaktion/mondsaal/platz', {
|
||||
method: 'PUT', headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ reihe, platz, unsichtbar: unsichtbar ?? $('ms-unsichtbar').checked }),
|
||||
});
|
||||
if (!r.ok) { sagen(satz(r.j, 'Das ging gerade nicht.')); await planLaden(); return; }
|
||||
plan = r.j;
|
||||
planZeichnen();
|
||||
sagen(`Du sitzt in Reihe ${reihe}, Platz ${platz}.`);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------- Flüstern */
|
||||
async function fluesternLaden(reihe) {
|
||||
const r = await holen('/workspace/api/reaktion/fluestern' + (reihe ? `?reihe=${encodeURIComponent(reihe)}` : ''));
|
||||
if (!r.ok || !r.j) { sagen('Das Flüstern ging gerade nicht.'); return; }
|
||||
team = !!r.j.team;
|
||||
/* Das Team ohne eigenen Platz liest zuerst Reihe A mit. */
|
||||
if (team && !r.j.reihe && !reihe) return fluesternLaden('A');
|
||||
fluesterReihe = r.j.reihe;
|
||||
$('ms-team-wahl').hidden = !team;
|
||||
if (team && fluesterReihe) $('ms-team-wahl').value = fluesterReihe;
|
||||
const ol = $('ms-liste');
|
||||
ol.textContent = '';
|
||||
for (const b of r.j.beitraege) ol.append(beitragBauen(b));
|
||||
$('ms-leer').hidden = r.j.beitraege.length > 0;
|
||||
$('ms-leer').textContent = fluesterReihe ? 'Noch flüstert niemand in dieser Reihe.' : 'Such dir zuerst einen Platz – dann flüsterst du mit deiner Reihe.';
|
||||
ol.scrollTop = ol.scrollHeight;
|
||||
}
|
||||
function beitragBauen(b) {
|
||||
const li = el('li', 'ms-beitrag');
|
||||
li.dataset.id = b.id;
|
||||
if (b.ich) li.dataset.ich = 'ja';
|
||||
li.append(el('strong', '', b.name), el('span', '', b.text));
|
||||
if (team) {
|
||||
const weg = el('button', 'btn btn-klein btn-sekundaer ms-weg', 'entfernen');
|
||||
weg.type = 'button';
|
||||
weg.addEventListener('click', async () => {
|
||||
const r = await holen(`/workspace/api/reaktion/fluestern/${b.id}`, { method: 'DELETE' });
|
||||
if (r.ok) li.remove(); else sagen(satz(r.j, 'Entfernen ging gerade nicht.'));
|
||||
});
|
||||
li.append(weg);
|
||||
}
|
||||
return li;
|
||||
}
|
||||
async function schicken(e) {
|
||||
e.preventDefault();
|
||||
const feld = $('ms-feld');
|
||||
const text = feld.value.trim();
|
||||
if (!text) return;
|
||||
const r = await holen('/workspace/api/reaktion/fluestern', {
|
||||
method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ text }),
|
||||
});
|
||||
if (!r.ok) { sagen(satz(r.j, 'Das ging gerade nicht.')); return; }
|
||||
feld.value = '';
|
||||
if (!$('ms-liste').querySelector(`[data-id="${r.j.id}"]`)) $('ms-liste').append(beitragBauen(r.j));
|
||||
$('ms-leer').hidden = true;
|
||||
$('ms-liste').scrollTop = $('ms-liste').scrollHeight;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ Tafel */
|
||||
function reiterWaehlen(wer) {
|
||||
reiter = wer;
|
||||
$('ms-reiter-plan').setAttribute('aria-selected', String(wer === 'plan'));
|
||||
$('ms-reiter-reihe').setAttribute('aria-selected', String(wer === 'reihe'));
|
||||
$('ms-seite-plan').hidden = wer !== 'plan';
|
||||
$('ms-seite-reihe').hidden = wer !== 'reihe';
|
||||
if (wer === 'reihe') fluesternLaden(team ? $('ms-team-wahl').value || null : null);
|
||||
}
|
||||
/* ==== DIE TAFEL LIEGT NIE AUF DEM YOUTUBE-BILD (YouTube-Regeln) ====
|
||||
Am Rechner genau über der Chatspalte, am Handy unter dem Video – beides
|
||||
gemessen, nicht angenommen, und bei jeder Größenänderung neu. */
|
||||
function lageSetzen() {
|
||||
const d = $('mondsaal');
|
||||
if (!d.open) return;
|
||||
const schiene = $('schiene')?.getBoundingClientRect();
|
||||
const bild = $('yt-spieler')?.getBoundingClientRect();
|
||||
if (innerWidth > 860 && schiene && schiene.width > 0) {
|
||||
d.style.setProperty('--ms-oben', `${Math.max(0, Math.round(schiene.top))}px`);
|
||||
d.style.setProperty('--ms-breite', `${Math.round(schiene.width)}px`);
|
||||
d.style.setProperty('--ms-rechts', `${Math.max(0, Math.round(innerWidth - schiene.right))}px`);
|
||||
} else {
|
||||
const unten = bild && bild.height > 0 ? Math.round(bild.bottom) : Math.round(innerHeight * 0.3);
|
||||
d.style.setProperty('--ms-oben', `${Math.max(0, Math.min(unten, innerHeight - 260))}px`);
|
||||
d.style.setProperty('--ms-breite', '100vw');
|
||||
d.style.setProperty('--ms-rechts', '0px');
|
||||
}
|
||||
}
|
||||
async function oeffnen() {
|
||||
const d = $('mondsaal');
|
||||
if (!d.open) d.show();
|
||||
lageSetzen();
|
||||
$('mondsaal-knopf').setAttribute('aria-expanded', 'true');
|
||||
await planLaden();
|
||||
reiterWaehlen(plan?.mein ? reiter : 'plan');
|
||||
$('ms-reiter-plan').focus({ preventScroll: true });
|
||||
}
|
||||
function schliessen() {
|
||||
$('mondsaal').close();
|
||||
$('mondsaal-knopf').setAttribute('aria-expanded', 'false');
|
||||
$('mondsaal-knopf').focus({ preventScroll: true });
|
||||
}
|
||||
|
||||
function start() {
|
||||
if (!$('mondsaal') || !$('mondsaal-knopf')) return;
|
||||
$('mondsaal-knopf').hidden = false;
|
||||
$('mondsaal-knopf').addEventListener('click', () => ($('mondsaal').open ? schliessen() : oeffnen()));
|
||||
$('ms-zu').addEventListener('click', schliessen);
|
||||
window.addEventListener('resize', lageSetzen);
|
||||
$('mondsaal').addEventListener('keydown', (e) => { if (e.key === 'Escape') { e.preventDefault(); schliessen(); } });
|
||||
$('ms-reiter-plan').addEventListener('click', () => reiterWaehlen('plan'));
|
||||
$('ms-reiter-reihe').addEventListener('click', () => reiterWaehlen('reihe'));
|
||||
$('ms-unsichtbar').addEventListener('change', () => plan?.mein && setzen(plan.mein.reihe, plan.mein.platz, $('ms-unsichtbar').checked));
|
||||
$('ms-frei').addEventListener('click', async () => {
|
||||
const r = await holen('/workspace/api/reaktion/mondsaal/platz', { method: 'DELETE' });
|
||||
if (r.ok) { plan = r.j; planZeichnen(); sagen('Platz freigegeben.'); }
|
||||
});
|
||||
$('ms-form').addEventListener('submit', schicken);
|
||||
$('ms-team-wahl').addEventListener('change', (e) => fluesternLaden(e.target.value));
|
||||
window.addEventListener('saal:strom', (e) => {
|
||||
const d = e.detail || {};
|
||||
if (!$('mondsaal').open) return;
|
||||
if (d.was === 'mondsaal' && reiter === 'plan') planLaden();
|
||||
if (d.was === 'fluestern' && d.reihe === fluesterReihe && reiter === 'reihe' && !$('ms-liste').querySelector(`[data-id="${d.beitrag?.id}"]`)) {
|
||||
$('ms-liste').append(beitragBauen(d.beitrag));
|
||||
$('ms-leer').hidden = true;
|
||||
$('ms-liste').scrollTop = $('ms-liste').scrollHeight;
|
||||
}
|
||||
if (d.was === 'fluestern_weg' && d.reihe === fluesterReihe) $('ms-liste').querySelector(`[data-id="${d.id}"]`)?.remove();
|
||||
});
|
||||
}
|
||||
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start);
|
||||
else start();
|
||||
window.Mondsaal = { oeffnen, schliessen, plan: () => plan };
|
||||
})();
|
||||
@@ -7412,6 +7412,7 @@
|
||||
sie über den Strom weiß. */
|
||||
standFolge++;
|
||||
const d = JSON.parse(e.data);
|
||||
window.dispatchEvent(new CustomEvent('saal:strom', { detail: d }));
|
||||
if (d.was === 'video') {
|
||||
/* WER STEUERT, FOLGT SEINEM EIGENEN ECHO NICHT (29.09.2026).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user