Make vote missing badge update immediately
This commit is contained in:
@@ -164,6 +164,7 @@ export function renderVotes() {
|
||||
list.appendChild(li);
|
||||
});
|
||||
updatePhaseNav();
|
||||
updateMissingBadgeFromDom();
|
||||
list.querySelectorAll("input[type=range]").forEach((input) => {
|
||||
input.addEventListener("input", (e) => {
|
||||
if (state.votesFinal) return;
|
||||
@@ -174,6 +175,7 @@ export function renderVotes() {
|
||||
const warn = $("warn-" + e.target.dataset.id);
|
||||
if (warn) warn.classList.add("hidden");
|
||||
syncLinkedSliders(e.target, val);
|
||||
updateMissingBadgeFromDom();
|
||||
});
|
||||
input.addEventListener("change", async (e) => {
|
||||
if (state.votesFinal) return;
|
||||
@@ -675,6 +677,21 @@ function missingVotesCount() {
|
||||
return missing < 0 ? 0 : missing;
|
||||
}
|
||||
|
||||
function updateMissingBadgeFromDom() {
|
||||
const badge = $("vote-missing");
|
||||
if (!badge) return;
|
||||
if (state.votesFinal || state.phase !== "Vote") {
|
||||
badge.classList.add("hidden");
|
||||
return;
|
||||
}
|
||||
const sliders = document.querySelectorAll("#vote-list input[type=range]");
|
||||
const missing = Array.from(sliders).some((slider) => {
|
||||
const scoreLabel = $("score-" + slider.dataset.id);
|
||||
return !scoreLabel || scoreLabel.textContent === "—";
|
||||
});
|
||||
badge.classList.toggle("hidden", !missing);
|
||||
}
|
||||
|
||||
function renderAdminVoteStatus() {
|
||||
if (!state.me?.isAdmin) return;
|
||||
const list = $("admin-voter-list");
|
||||
@@ -956,6 +973,7 @@ export function updatePhaseNav() {
|
||||
|
||||
renderAdminVoteStatus();
|
||||
renderAdminLinker();
|
||||
updateMissingBadgeFromDom();
|
||||
|
||||
// Toggle admin-only back buttons
|
||||
const backButtons = ["nav-vote-prev"];
|
||||
|
||||
Reference in New Issue
Block a user