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
+12 -5
View File
@@ -553,6 +553,18 @@
const list = raw && Array.isArray(raw.data) ? raw.data : Array.isArray(raw) ? raw : [raw].filter(Boolean); const list = raw && Array.isArray(raw.data) ? raw.data : Array.isArray(raw) ? raw : [raw].filter(Boolean);
const servers = list.filter(function(s) { return s && s.server; }); const servers = list.filter(function(s) { return s && s.server; });
sel.innerHTML = ''; 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) { servers.forEach(function(s) {
const server = s.server || ''; const server = s.server || '';
const available = parseInt(s['Seats Available'], 10) || 0; const available = parseInt(s['Seats Available'], 10) || 0;
@@ -564,19 +576,14 @@
opt.disabled = true; opt.disabled = true;
opt.style.color = '#ff4444'; opt.style.color = '#ff4444';
opt.style.fontWeight = '600'; opt.style.fontWeight = '600';
sel.classList.remove('low-seats');
sel.classList.add('no-seats');
} else if (available < 10) { } else if (available < 10) {
opt.textContent = label + ' (available ' + available + ')'; opt.textContent = label + ' (available ' + available + ')';
opt.style.color = '#ff9900'; opt.style.color = '#ff9900';
opt.style.fontWeight = '600'; opt.style.fontWeight = '600';
sel.classList.add('low-seats');
sel.classList.remove('no-seats');
} else { } else {
opt.textContent = label + ' (available ' + available + ')'; opt.textContent = label + ' (available ' + available + ')';
opt.style.color = ''; opt.style.color = '';
opt.style.fontWeight = ''; opt.style.fontWeight = '';
sel.classList.remove('low-seats', 'no-seats');
} }
sel.appendChild(opt); sel.appendChild(opt);
}); });
+13 -5
View File
@@ -656,6 +656,19 @@ async function initServerLocations() {
// Clear existing options // Clear existing options
sel.innerHTML = ""; 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) { servers.forEach(function (s) {
const server = s.server || ""; const server = s.server || "";
const available = parseInt(s["Seats Available"], 10) || 0; const available = parseInt(s["Seats Available"], 10) || 0;
@@ -669,21 +682,16 @@ async function initServerLocations() {
opt.disabled = true; opt.disabled = true;
opt.style.color = "#ff4444"; opt.style.color = "#ff4444";
opt.style.fontWeight = "600"; opt.style.fontWeight = "600";
sel.classList.remove("low-seats");
sel.classList.add("no-seats");
} else if (available < 10) { } else if (available < 10) {
// Low seats — orange with count // Low seats — orange with count
opt.textContent = label + " (available " + available + ")"; opt.textContent = label + " (available " + available + ")";
opt.style.color = "#ff9900"; opt.style.color = "#ff9900";
opt.style.fontWeight = "600"; opt.style.fontWeight = "600";
sel.classList.add("low-seats");
sel.classList.remove("no-seats");
} else { } else {
// Plenty of seats // Plenty of seats
opt.textContent = label + " (available " + available + ")"; opt.textContent = label + " (available " + available + ")";
opt.style.color = ""; opt.style.color = "";
opt.style.fontWeight = ""; opt.style.fontWeight = "";
sel.classList.remove("low-seats", "no-seats");
} }
sel.appendChild(opt); sel.appendChild(opt);