Skip to content

Commit 16d36ad

Browse files
committed
Added Sparkles
1 parent 6cf3196 commit 16d36ad

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

  • cornwallcore/administration/dashboard

cornwallcore/administration/dashboard/app.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
const DEFAULT_LOCAL_API_BASE = "http://127.0.0.1:5056";
2+
const PERMISSION_LABELS = {
3+
4: "Developer",
4+
3: "General Staff",
5+
2: "Regimental Command",
6+
1: "NCO/Officer"
7+
};
28

39
function isLocalHost(hostname) {
410
return hostname === "localhost" || hostname === "127.0.0.1";
@@ -170,6 +176,10 @@ function setMessage(el, text, isError = false) {
170176
el.style.color = isError ? "#ff8f8f" : "#9ab0c2";
171177
}
172178

179+
function getPermissionLabel(level) {
180+
return PERMISSION_LABELS[level] || "Unknown";
181+
}
182+
173183
function showDashboard() {
174184
els.loginView.classList.add("hidden");
175185
els.dashboardView.classList.remove("hidden");
@@ -184,7 +194,7 @@ function applyUser(user) {
184194
state.user = user;
185195
els.profileAvatar.src = user.avatarUrl || "https://cdn.discordapp.com/embed/avatars/0.png";
186196
els.profileName.textContent = user.username;
187-
els.profilePermission.textContent = `Permissão ${user.permissionLevel}`;
197+
els.profilePermission.textContent = `${getPermissionLabel(user.permissionLevel)} (${user.permissionLevel})`;
188198

189199
if (user.permissionLevel < 3) {
190200
els.addRoleBtn.disabled = true;

0 commit comments

Comments
 (0)