Notify voters when suggestions change during refresh
This commit is contained in:
@@ -172,6 +172,7 @@ export function renderAllSuggestions() {
|
||||
export function renderVotes() {
|
||||
const list = $("vote-list");
|
||||
if (!list) return;
|
||||
const prevScroll = list.scrollTop;
|
||||
list.innerHTML = "";
|
||||
const votesMap = Object.fromEntries(
|
||||
state.myVotes.map((v) => [v.suggestionId, v.score]),
|
||||
@@ -205,6 +206,7 @@ export function renderVotes() {
|
||||
});
|
||||
updatePhaseNav();
|
||||
updateMissingBadgeFromDom();
|
||||
list.scrollTop = prevScroll;
|
||||
list.querySelectorAll("input[type=range]").forEach((input) => {
|
||||
input.addEventListener("input", (e) => {
|
||||
if (state.votesFinal) return;
|
||||
@@ -734,6 +736,18 @@ export function openResultsRelockModal() {
|
||||
});
|
||||
}
|
||||
|
||||
export function openSuggestionsChangedModal(names) {
|
||||
const uniq = Array.from(new Set(names)).filter(Boolean);
|
||||
if (uniq.length === 0) return;
|
||||
openConfirmModal({
|
||||
title: t("vote.listUpdatedTitle"),
|
||||
body: t("vote.listUpdatedBody", { names: uniq.join(", ") }),
|
||||
confirmLabel: t("vote.listUpdatedConfirm"),
|
||||
cancelLabel: null,
|
||||
onConfirm: (close) => close(),
|
||||
});
|
||||
}
|
||||
|
||||
export function openConfirmModal({ title, body, confirmLabel, cancelLabel = t("modal.cancel"), onConfirm }) {
|
||||
const overlay = document.createElement("div");
|
||||
overlay.className = "edit-modal";
|
||||
|
||||
Reference in New Issue
Block a user