fix: determine select border class by lowest seats across all servers, bump cache buster

This commit is contained in:
Oliver
2026-06-14 19:31:20 -03:00
parent 3b3cf8a17c
commit da598a8ead
2 changed files with 25 additions and 10 deletions
+13 -5
View File
@@ -656,6 +656,19 @@ async function initServerLocations() {
// Clear existing options
sel.innerHTML = "";
// Determine overall select styling based on lowest availability
var minAvail = Infinity;
servers.forEach(function (s) {
var a = parseInt(s["Seats Available"], 10) || 0;
if (a < minAvail) minAvail = a;
});
sel.classList.remove("low-seats", "no-seats");
if (minAvail <= 0) {
sel.classList.add("no-seats");
} else if (minAvail < 10) {
sel.classList.add("low-seats");
}
servers.forEach(function (s) {
const server = s.server || "";
const available = parseInt(s["Seats Available"], 10) || 0;
@@ -669,21 +682,16 @@ async function initServerLocations() {
opt.disabled = true;
opt.style.color = "#ff4444";
opt.style.fontWeight = "600";
sel.classList.remove("low-seats");
sel.classList.add("no-seats");
} else if (available < 10) {
// Low seats — orange with count
opt.textContent = label + " (available " + available + ")";
opt.style.color = "#ff9900";
opt.style.fontWeight = "600";
sel.classList.add("low-seats");
sel.classList.remove("no-seats");
} else {
// Plenty of seats
opt.textContent = label + " (available " + available + ")";
opt.style.color = "";
opt.style.fontWeight = "";
sel.classList.remove("low-seats", "no-seats");
}
sel.appendChild(opt);