Add per-user phase navigation with results toggle
This commit is contained in:
@@ -65,7 +65,8 @@ export function handleAuthError(err, clearUserState) {
|
||||
|
||||
export function renderPhasePill() {
|
||||
const phaseKey = typeof state.phase === "string" ? state.phase.toLowerCase() : null;
|
||||
$("phase-pill").textContent = phaseKey ? "" : t("phase.loading");
|
||||
const pill = $("phase-pill");
|
||||
if (pill) pill.textContent = phaseKey ? t(`phase.${phaseKey}`) : t("phase.loading");
|
||||
document.querySelectorAll(".phase-view").forEach((el) =>
|
||||
el.classList.add("hidden"),
|
||||
);
|
||||
@@ -77,9 +78,27 @@ export function renderPhasePill() {
|
||||
};
|
||||
const id = viewMap[state.phase];
|
||||
if (id) $(id).classList.remove("hidden");
|
||||
const phaseSelect = $("phase-select");
|
||||
if (phaseSelect && !phaseSelect.dataset.userEditing) {
|
||||
phaseSelect.value = state.phase || "Suggest";
|
||||
|
||||
const prevBtn = $("prev-phase");
|
||||
if (prevBtn) prevBtn.disabled = state.phase === "Suggest";
|
||||
|
||||
const nextBtn = $("next-phase");
|
||||
if (nextBtn) {
|
||||
const atResults = state.phase === "Results";
|
||||
const locked = !state.resultsOpen && state.phase === "Vote";
|
||||
nextBtn.disabled = atResults || locked;
|
||||
nextBtn.textContent = locked ? t("nav.waitingForResults") : t("nav.next");
|
||||
}
|
||||
|
||||
const resultsLock = $("results-lock");
|
||||
if (resultsLock) {
|
||||
resultsLock.classList.toggle("hidden", state.resultsOpen);
|
||||
resultsLock.textContent = t("admin.resultsLocked");
|
||||
}
|
||||
|
||||
const adminResultsToggle = $("results-open");
|
||||
if (adminResultsToggle) {
|
||||
adminResultsToggle.checked = !!state.resultsOpen;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user