Replace results-phase checkbox with stateful button

This commit is contained in:
2026-02-08 15:06:39 +01:00
parent e666e7c603
commit d534fc256b
7 changed files with 16 additions and 8 deletions

View File

@@ -32,6 +32,7 @@ Help a small Discord group (48 players) pick a co-op game via phased flow:
## Results Phase
- Visible only after admin enables results; players auto-advance when opened
- Admin controls results availability with a single toggle button whose label reflects enabled/disabled state
- Leaderboard sorted by average score; shows totals, counts, players own vote, and links/media
- When results are closed again, only accounts with at least one suggestion return to Vote; accounts without suggestions return to Suggest

View File

@@ -151,6 +151,7 @@ Nein. Vorschläge und Bewertungen sind schreibgeschützt. Wende dich bei Bedarf
- Joker während der Abstimmung vergeben
- Einen Bewerter zurück in die Vorschlagsphase setzen (stärker als ein Joker; sparsam einsetzen)
- Ergebniszugriff mit einem einzelnen Button umschalten (Beschriftung wechselt je nach Zustand)
- Doppelte Vorschläge verknüpfen oder trennen
- Vorschläge löschen
- Abstimmungsstatus einsehen (wer finalisiert hat)

View File

@@ -155,6 +155,7 @@ No. Suggestions and votes are read-only. Contact an admin for assistance.
- Grant jokers during Vote
- Move a voter back to Suggest (stronger than a joker; use sparingly)
- Toggle results access with a single button (label switches by current state)
- Link or unlink duplicate suggestions
- Delete suggestions
- View vote readiness (who has finalized)

View File

@@ -103,6 +103,8 @@
"admin.title": "Admin",
"admin.tools": "Admin tools",
"admin.resultsOpenToggle": "Allow results phase",
"admin.resultsOpenEnable": "Enable results phase",
"admin.resultsOpenDisable": "Disable results phase",
"admin.resultsLocked": "Results locked by admin",
"admin.resultsUpdated": "Results availability updated",
"admin.reset": "Reset (keep players)",
@@ -271,6 +273,8 @@
"admin.title": "Admin",
"admin.tools": "Admin-Werkzeuge",
"admin.resultsOpenToggle": "Ergebnisse freigeben",
"admin.resultsOpenEnable": "Ergebnisse freigeben",
"admin.resultsOpenDisable": "Ergebnisse sperren",
"admin.resultsLocked": "Ergebnisse vom Admin gesperrt",
"admin.resultsUpdated": "Ergebnisfreigabe aktualisiert",
"admin.reset": "Zurücksetzen (Spieler behalten)",

View File

@@ -178,10 +178,7 @@
</table>
</div>
</div>
<label class="stack toggle-row">
<input type="checkbox" id="results-open" />
<span data-i18n="admin.resultsOpenToggle">Allow results phase</span>
</label>
<button id="results-open" class="secondary" type="button" data-i18n="admin.resultsOpenEnable">Enable results phase</button>
<div class="stack hidden" id="admin-linker">
<h4 data-i18n="admin.linkTitle">Link games</h4>
<label class="stack">

View File

@@ -81,8 +81,9 @@ function setupResultsToggle(runSerializedRefresh) {
const resultsToggle = $("results-open");
if (!resultsToggle) return;
resultsToggle.addEventListener("change", async (e) => {
const desired = !!e.target.checked;
resultsToggle.addEventListener("click", async () => {
const desired = !state.resultsOpen;
resultsToggle.disabled = true;
try {
const resp = await adminApi.setResultsOpen(desired);
const wasResultsOpen = state.resultsOpen;
@@ -95,8 +96,9 @@ function setupResultsToggle(runSerializedRefresh) {
toast(t("admin.resultsUpdated"));
await runSerializedRefresh();
} catch (err) {
e.target.checked = !desired;
toast(err.message, true);
} finally {
resultsToggle.disabled = false;
}
});
}

View File

@@ -270,6 +270,8 @@ export function updatePhaseNav() {
const adminResultsToggle = $("results-open");
if (adminResultsToggle) {
adminResultsToggle.checked = !!state.resultsOpen;
adminResultsToggle.textContent = state.resultsOpen
? t("admin.resultsOpenDisable")
: t("admin.resultsOpenEnable");
}
}