Added Support for User Access Level in Account Page

This commit is contained in:
BloxerHD 2025-10-11 11:35:21 +01:00
commit 1161727520
3 changed files with 24 additions and 0 deletions

View file

@ -52,6 +52,7 @@
<img src="/res/img/mii-placeholder.png" id="mii-img" style="width: 100%">
<h3 id="display-name" style="margin: 2px;">Display Name</h3>
<p id="sfid" style="margin: 2px;">SFID: Username</p>
<p id="access-level" class="access-level-base">Member</p>
<button style="font-size: 24px; width: 160px;" onclick="logOut()">Log Out</button>
</div>
<div id="user-details" class="info-container" style="flex: 1;">

View file

@ -283,6 +283,15 @@ code {
margin: 0 16px;
}
.access-level-base {
background-color: #047205;
border-style: solid;
border-color: #00a003;
border-radius: 8px;
border-width: 2px;
width: 90%;
}
.active {
background-color: #a00b0b;
border-color: #6d0606;

View file

@ -1,3 +1,13 @@
let userAccessLevels = { // Name | Text Colour | Background Colour | Border Colour
"-3": ["Banned", "#fff", "#2e2e2e", "#727272"],
"-2": ["Banned", "#fff", "#2e2e2e", "#727272"],
"-1": ["Banned", "#fff", "#2e2e2e", "#727272"],
"0": ["Member", "#fff", "#047205", "#00a003"],
"1": ["Tester", "#fff", "#0c98a2", "#01c9d7"],
"2": ["Moderator", "#000", "#00dc04", "#067708"],
"3": ["Admin", "#fff", "#920606", "#c80404"],
}
function loginError(message, code = null) {
let errorStr;
if (code) {
@ -82,6 +92,10 @@ function updateUserDataDisplay(data) {
let miiLink = `https://mii.spfn.net/${data["pid"]}/main.png`
document.getElementById("mii-img").src = miiLink;
let level = userAccessLevels[data["account_level"]];
document.getElementById("access-level").textContent = level[0];
document.getElementById("access-level").style = `color: ${level[1]}; background-color: ${level[2]}; border-color: ${level[3]}`;
}
function logOut() {