Add votes-final flag, warn on missing votes, and sync phases with results toggle
This commit is contained in:
@@ -145,11 +145,12 @@ export function renderVotes() {
|
||||
});
|
||||
const hasVote = Object.prototype.hasOwnProperty.call(votesMap, s.id);
|
||||
const current = hasVote ? votesMap[s.id] : 5; // start neutral when no prior vote
|
||||
const displayScore = hasVote ? current : "—";
|
||||
const displayEmoji = hasVote ? scoreToEmoji(current) : neutralEmoji();
|
||||
const displayScore = hasVote ? current : t("vote.missing");
|
||||
const displayEmoji = hasVote ? scoreToEmoji(current) : "⚠️";
|
||||
const footer = document.createElement("div");
|
||||
footer.className = "vote-controls";
|
||||
footer.innerHTML = `
|
||||
<div class="warning-text ${hasVote ? "hidden" : ""}" id="warn-${s.id}">${t("vote.missingWarn")}</div>
|
||||
<input class="full-slider" type="range" min="0" max="10" value="${current}" data-id="${s.id}">
|
||||
<span class="score" id="score-${s.id}">${displayScore}</span>
|
||||
<span class="score-emoji" id="emoji-${s.id}">${displayEmoji}</span>`;
|
||||
@@ -162,6 +163,8 @@ export function renderVotes() {
|
||||
$("score-" + e.target.dataset.id).textContent = val;
|
||||
const emojiEl = $("emoji-" + e.target.dataset.id);
|
||||
if (emojiEl) emojiEl.textContent = scoreToEmoji(val);
|
||||
const warn = $("warn-" + e.target.dataset.id);
|
||||
if (warn) warn.classList.add("hidden");
|
||||
});
|
||||
input.addEventListener("change", async (e) => {
|
||||
const suggestionId = Number(e.target.dataset.id);
|
||||
@@ -627,7 +630,7 @@ export function neutralEmoji() {
|
||||
}
|
||||
|
||||
function formatVotes(votes) {
|
||||
if (!Array.isArray(votes) || votes.length === 0) return "—";
|
||||
if (!Array.isArray(votes) || votes.length === 0) return "⚠️";
|
||||
const sorted = [...votes].sort((a, b) => a - b);
|
||||
return sorted.map((v) => scoreToEmoji(v)).join("");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user