Gate the Staff & ranks page behind @zio/webpanel
Staff without @zio/webpanel (or @css/root) no longer see the page: the API refuses it and the panel leaves it out of the sidebar. The flag is offered in the rank editor.
This commit is contained in:
parent
dc7a1e42bd
commit
b2b4698776
3 changed files with 11 additions and 3 deletions
|
|
@ -6,7 +6,7 @@ const PAGES = [
|
|||
{ id: "players", label: "Players" },
|
||||
{ id: "bans", label: "Bans" },
|
||||
{ id: "comms", label: "Gags & mutes" },
|
||||
{ id: "staff", label: "Staff & ranks" },
|
||||
{ id: "staff", label: "Staff & ranks", flag: "@zio/webpanel" },
|
||||
{ id: "settings", label: "Server settings" },
|
||||
];
|
||||
|
||||
|
|
@ -645,7 +645,7 @@ const RENDER = { overview, players, bans, comms, staff, settings };
|
|||
function renderNav() {
|
||||
const c = state.counts;
|
||||
const count = { players: c.players, bans: c.bans, comms: c.comms, staff: c.staff };
|
||||
$("#nav-links").innerHTML = PAGES.map((p) => `<li><a class="link" href="#${p.id}" ${p.id === state.page ? 'aria-current="page"' : ""}>${p.label}${count[p.id] !== undefined && count[p.id] !== "" ? `<span class="count">${esc(count[p.id])}</span>` : ""}</a></li>`).join("");
|
||||
$("#nav-links").innerHTML = PAGES.filter((p) => !p.flag || can(p.flag)).map((p) => `<li><a class="link" href="#${p.id}" ${p.id === state.page ? 'aria-current="page"' : ""}>${p.label}${count[p.id] !== undefined && count[p.id] !== "" ? `<span class="count">${esc(count[p.id])}</span>` : ""}</a></li>`).join("");
|
||||
}
|
||||
|
||||
// The mobile sidebar covers the Menu button, so it closes from its own Close button, the
|
||||
|
|
@ -657,7 +657,8 @@ function setNav(open) {
|
|||
|
||||
function route() {
|
||||
const page = location.hash.slice(1);
|
||||
state.page = RENDER[page] ? page : "overview";
|
||||
const def = PAGES.find((p) => p.id === page);
|
||||
state.page = def && (!def.flag || can(def.flag)) ? page : "overview";
|
||||
renderNav();
|
||||
setNav(false);
|
||||
if (!$("#view").innerHTML) $("#view").innerHTML = loading();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue