Replace results-phase checkbox with stateful button
This commit is contained in:
1
SPEC.md
1
SPEC.md
@@ -32,6 +32,7 @@ Help a small Discord group (4–8 players) pick a co-op game via phased flow:
|
|||||||
|
|
||||||
## Results Phase
|
## Results Phase
|
||||||
- Visible only after admin enables results; players auto-advance when opened
|
- 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, player’s own vote, and links/media
|
- Leaderboard sorted by average score; shows totals, counts, player’s 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
|
- When results are closed again, only accounts with at least one suggestion return to Vote; accounts without suggestions return to Suggest
|
||||||
|
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ Nein. Vorschläge und Bewertungen sind schreibgeschützt. Wende dich bei Bedarf
|
|||||||
|
|
||||||
- Joker während der Abstimmung vergeben
|
- Joker während der Abstimmung vergeben
|
||||||
- Einen Bewerter zurück in die Vorschlagsphase setzen (stärker als ein Joker; sparsam einsetzen)
|
- 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
|
- Doppelte Vorschläge verknüpfen oder trennen
|
||||||
- Vorschläge löschen
|
- Vorschläge löschen
|
||||||
- Abstimmungsstatus einsehen (wer finalisiert hat)
|
- Abstimmungsstatus einsehen (wer finalisiert hat)
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ No. Suggestions and votes are read-only. Contact an admin for assistance.
|
|||||||
|
|
||||||
- Grant jokers during Vote
|
- Grant jokers during Vote
|
||||||
- Move a voter back to Suggest (stronger than a joker; use sparingly)
|
- 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
|
- Link or unlink duplicate suggestions
|
||||||
- Delete suggestions
|
- Delete suggestions
|
||||||
- View vote readiness (who has finalized)
|
- View vote readiness (who has finalized)
|
||||||
|
|||||||
@@ -103,6 +103,8 @@
|
|||||||
"admin.title": "Admin",
|
"admin.title": "Admin",
|
||||||
"admin.tools": "Admin tools",
|
"admin.tools": "Admin tools",
|
||||||
"admin.resultsOpenToggle": "Allow results phase",
|
"admin.resultsOpenToggle": "Allow results phase",
|
||||||
|
"admin.resultsOpenEnable": "Enable results phase",
|
||||||
|
"admin.resultsOpenDisable": "Disable results phase",
|
||||||
"admin.resultsLocked": "Results locked by admin",
|
"admin.resultsLocked": "Results locked by admin",
|
||||||
"admin.resultsUpdated": "Results availability updated",
|
"admin.resultsUpdated": "Results availability updated",
|
||||||
"admin.reset": "Reset (keep players)",
|
"admin.reset": "Reset (keep players)",
|
||||||
@@ -271,6 +273,8 @@
|
|||||||
"admin.title": "Admin",
|
"admin.title": "Admin",
|
||||||
"admin.tools": "Admin-Werkzeuge",
|
"admin.tools": "Admin-Werkzeuge",
|
||||||
"admin.resultsOpenToggle": "Ergebnisse freigeben",
|
"admin.resultsOpenToggle": "Ergebnisse freigeben",
|
||||||
|
"admin.resultsOpenEnable": "Ergebnisse freigeben",
|
||||||
|
"admin.resultsOpenDisable": "Ergebnisse sperren",
|
||||||
"admin.resultsLocked": "Ergebnisse vom Admin gesperrt",
|
"admin.resultsLocked": "Ergebnisse vom Admin gesperrt",
|
||||||
"admin.resultsUpdated": "Ergebnisfreigabe aktualisiert",
|
"admin.resultsUpdated": "Ergebnisfreigabe aktualisiert",
|
||||||
"admin.reset": "Zurücksetzen (Spieler behalten)",
|
"admin.reset": "Zurücksetzen (Spieler behalten)",
|
||||||
|
|||||||
@@ -178,10 +178,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<label class="stack toggle-row">
|
<button id="results-open" class="secondary" type="button" data-i18n="admin.resultsOpenEnable">Enable results phase</button>
|
||||||
<input type="checkbox" id="results-open" />
|
|
||||||
<span data-i18n="admin.resultsOpenToggle">Allow results phase</span>
|
|
||||||
</label>
|
|
||||||
<div class="stack hidden" id="admin-linker">
|
<div class="stack hidden" id="admin-linker">
|
||||||
<h4 data-i18n="admin.linkTitle">Link games</h4>
|
<h4 data-i18n="admin.linkTitle">Link games</h4>
|
||||||
<label class="stack">
|
<label class="stack">
|
||||||
|
|||||||
@@ -81,8 +81,9 @@ function setupResultsToggle(runSerializedRefresh) {
|
|||||||
const resultsToggle = $("results-open");
|
const resultsToggle = $("results-open");
|
||||||
if (!resultsToggle) return;
|
if (!resultsToggle) return;
|
||||||
|
|
||||||
resultsToggle.addEventListener("change", async (e) => {
|
resultsToggle.addEventListener("click", async () => {
|
||||||
const desired = !!e.target.checked;
|
const desired = !state.resultsOpen;
|
||||||
|
resultsToggle.disabled = true;
|
||||||
try {
|
try {
|
||||||
const resp = await adminApi.setResultsOpen(desired);
|
const resp = await adminApi.setResultsOpen(desired);
|
||||||
const wasResultsOpen = state.resultsOpen;
|
const wasResultsOpen = state.resultsOpen;
|
||||||
@@ -95,8 +96,9 @@ function setupResultsToggle(runSerializedRefresh) {
|
|||||||
toast(t("admin.resultsUpdated"));
|
toast(t("admin.resultsUpdated"));
|
||||||
await runSerializedRefresh();
|
await runSerializedRefresh();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
e.target.checked = !desired;
|
|
||||||
toast(err.message, true);
|
toast(err.message, true);
|
||||||
|
} finally {
|
||||||
|
resultsToggle.disabled = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -270,6 +270,8 @@ export function updatePhaseNav() {
|
|||||||
|
|
||||||
const adminResultsToggle = $("results-open");
|
const adminResultsToggle = $("results-open");
|
||||||
if (adminResultsToggle) {
|
if (adminResultsToggle) {
|
||||||
adminResultsToggle.checked = !!state.resultsOpen;
|
adminResultsToggle.textContent = state.resultsOpen
|
||||||
|
? t("admin.resultsOpenDisable")
|
||||||
|
: t("admin.resultsOpenEnable");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user