Add vote finalize UX and missing-vote warning placement

This commit is contained in:
2026-02-04 23:02:09 +01:00
parent 0571877f3a
commit 58159119cf
5 changed files with 31 additions and 0 deletions

View File

@@ -642,6 +642,14 @@ function formatMyVote(score) {
return `${score} ${scoreToEmoji(score)}`;
}
function missingVotesCount() {
const total = state.allSuggestions?.length ?? 0;
const mine = state.myVotes?.length ?? 0;
const votedIds = new Set(state.myVotes?.map((v) => v.suggestionId));
const missing = total - votedIds.size;
return missing < 0 ? 0 : missing;
}
function openDeleteConfirmModal(s) {
const overlay = document.createElement("div");
overlay.className = "edit-modal";
@@ -733,6 +741,18 @@ export function updatePhaseNav() {
lockBadge.textContent = t("admin.resultsLocked");
}
const finalizeBtn = $("finalize-votes");
if (finalizeBtn) {
finalizeBtn.textContent = state.votesFinal ? t("vote.unfinalize") : t("vote.finalize");
}
const voteMissingBadge = $("vote-missing");
if (voteMissingBadge) {
const missing = missingVotesCount();
voteMissingBadge.classList.toggle("hidden", missing === 0);
voteMissingBadge.textContent = missing > 0 ? t("vote.missingWarn") : "";
}
// Toggle admin-only back buttons
const backButtons = ["nav-vote-prev"];
backButtons.forEach((id) => {