Panel: no stray 'null' text under the server buttons (and on Admins/Bans for non-admin panel users)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Nico Meister
2026-09-28 19:28:52 +02:00
co-authored by Claude Opus 5.5
parent 8df6cbcafc
commit 196d490813
+3 -3
View File
@@ -306,7 +306,7 @@ function renderControl(el, s) {
: h("button", { class: "btn small ghost", type: "button", onclick: () => go("console") }, "Open console"); : h("button", { class: "btn small ghost", type: "button", onclick: () => go("console") }, "Open console");
problem = h("div", { class: "notice " + (s.state === "error" ? "bad" : "") }, h("div", {}, h("b", {}, s.state === "error" ? "The server could not start" : "Note"), h("div", {}, s.lastError)), fix); problem = h("div", { class: "notice " + (s.state === "error" ? "bad" : "") }, h("div", {}, h("b", {}, s.state === "error" ? "The server could not start" : "Note"), h("div", {}, s.lastError)), fix);
} }
el.replaceChildren(buttons, problem); el.replaceChildren(buttons, problem ?? ""); // replaceChildren macht aus null den Text "null"
} }
// ------------------------------------------------------------------ Einstellungen // ------------------------------------------------------------------ Einstellungen
@@ -545,7 +545,7 @@ function renderAdmins(page) {
h("div", { class: "section-body row" }, id, h("button", { class: "btn primary", type: "button", onclick: add }, "Add admin")), h("div", { class: "section-body row" }, id, h("button", { class: "btn primary", type: "button", onclick: add }, "Add admin")),
h("div", { class: "section-body muted small-text" }, "Find a SteamID64 on the player's Steam profile or with ", h("div", { class: "section-body muted small-text" }, "Find a SteamID64 on the player's Steam profile or with ",
h("a", { href: "https://steamid.io", target: "_blank", rel: "noopener noreferrer" }, "steamid.io ↗"), h("a", { href: "https://steamid.io", target: "_blank", rel: "noopener noreferrer" }, "steamid.io ↗"),
". Online players can also be made admin on the Players page.")) : null, ". Online players can also be made admin on the Players page.")) : "",
h("div", { class: "section" }, h("div", { class: "section" },
h("div", { class: "section-head" }, h("h2", {}, "In-game admins"), h("span", { class: "muted" }, "can use /admin in the game: kick, ban, teleport, items, world")), h("div", { class: "section-head" }, h("h2", {}, "In-game admins"), h("span", { class: "muted" }, "can use /admin in the game: kick, ban, teleport, items, world")),
h("div", { class: "table-wrap" }, h("table", {}, h("thead", {}, h("tr", {}, h("th", {}, "SteamID"), h("th", {}, "Player"), h("th", {}, ""))), list)))); h("div", { class: "table-wrap" }, h("table", {}, h("thead", {}, h("tr", {}, h("th", {}, "SteamID"), h("th", {}, "Player"), h("th", {}, ""))), list))));
@@ -584,7 +584,7 @@ function renderBans(page) {
h("button", { class: "btn danger", type: "button", onclick: async () => { h("button", { class: "btn danger", type: "button", onclick: async () => {
if (!id.value.trim()) return; if (!id.value.trim()) return;
if (await act(api("POST", "bans/add", { id: id.value.trim() }))) { id.value = ""; load(); } if (await act(api("POST", "bans/add", { id: id.value.trim() }))) { id.value = ""; load(); }
} }, "Ban"))) : null, } }, "Ban"))) : "",
h("div", { class: "section" }, h("div", { class: "section" },
h("div", { class: "section-head" }, h("h2", {}, "Banned players")), h("div", { class: "section-head" }, h("h2", {}, "Banned players")),
h("div", { class: "table-wrap" }, h("table", {}, h("thead", {}, h("tr", {}, h("th", {}, "Identity"), h("th", {}, ""))), list)))); h("div", { class: "table-wrap" }, h("table", {}, h("thead", {}, h("tr", {}, h("th", {}, "Identity"), h("th", {}, ""))), list))));