Skip to content

Commit 20c26ce

Browse files
committed
feat: add admin Settings tab with 'Soon' placeholder
1 parent 3d48390 commit 20c26ce

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

public/js/admin.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ function adminNavigateTo(page) {
8181
} else if (basePage === 'activity') {
8282
renderAdminActivity();
8383
history.pushState({ adminPage: 'activity' }, '', '/admin/activity');
84+
} else if (basePage === 'settings') {
85+
renderAdminSettings();
86+
history.pushState({ adminPage: 'settings' }, '', '/admin/settings');
8487
} else {
8588
renderAdminServers();
8689
history.pushState({ adminPage: 'servers' }, '', '/admin/servers');
@@ -193,6 +196,10 @@ function renderAdminLayout() {
193196
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 12h-4l-3 9L9 3l-3 9H2"/></svg>
194197
Activity
195198
</a>
199+
<a class="admin-nav-link" data-page="settings" href="/admin/settings">
200+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>
201+
Settings
202+
</a>
196203
</div>
197204
<div class="admin-navbar-right">
198205
<span class="admin-navbar-user">${adminState.user?.username || 'Admin'}</span>
@@ -210,6 +217,7 @@ function renderAdminLayout() {
210217
<div class="admin-page" id="admin-page-users"></div>
211218
<div class="admin-page" id="admin-page-user-detail"></div>
212219
<div class="admin-page" id="admin-page-activity"></div>
220+
<div class="admin-page" id="admin-page-settings"></div>
213221
</main>
214222
</div>
215223
`;
@@ -259,6 +267,10 @@ function renderAdminLayout() {
259267
adminState.currentPage = 'activity';
260268
updateAdminNav();
261269
renderAdminActivity();
270+
} else if (basePage === 'settings') {
271+
adminState.currentPage = 'settings';
272+
updateAdminNav();
273+
renderAdminSettings();
262274
} else {
263275
adminState.currentPage = 'servers';
264276
updateAdminNav();
@@ -913,6 +925,24 @@ async function renderAdminActivity() {
913925
}
914926
}
915927

928+
// ─── Settings ───────────────────────────────────────────
929+
async function renderAdminSettings() {
930+
document.querySelectorAll('.admin-page').forEach(p => p.classList.remove('active'));
931+
const el = $a('#admin-page-settings');
932+
if (!el) return;
933+
el.classList.add('active');
934+
el.innerHTML = ahtml`
935+
<div class="page-header">
936+
<h1 class="page-title">Settings</h1>
937+
<p class="page-subtitle">Admin panel configuration</p>
938+
</div>
939+
<div class="empty-state">
940+
<div class="empty-state-title">Soon</div>
941+
<div class="empty-state-desc">Settings are coming in a future update.</div>
942+
</div>
943+
`;
944+
}
945+
916946
// ─── Common ─────────────────────────────────────────────
917947
function formatDate(d) {
918948
if (!d) return 'N/A';
@@ -946,6 +976,8 @@ window.addEventListener('popstate', () => {
946976
adminNavigateTo('dashboard');
947977
} else if (basePage === 'activity') {
948978
adminNavigateTo('activity');
979+
} else if (basePage === 'settings') {
980+
adminNavigateTo('settings');
949981
} else {
950982
adminNavigateTo('servers');
951983
}
@@ -990,6 +1022,8 @@ function initAdmin() {
9901022
renderAdminLayout();
9911023
} else if (basePage === 'user' && param) {
9921024
renderAdminLayout();
1025+
} else if (basePage === 'settings') {
1026+
renderAdminLayout();
9931027
} else {
9941028
renderAdminLayout();
9951029
}

0 commit comments

Comments
 (0)