From 8531164ef0faa67eaa7125580e05e8d18fbbebed Mon Sep 17 00:00:00 2001 From: singharaj usai Date: Tue, 1 Oct 2024 00:23:24 -0400 Subject: [PATCH] better admin users panel --- client/js/admin/users.js | 60 +++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/client/js/admin/users.js b/client/js/admin/users.js index 971629f..4429fad 100644 --- a/client/js/admin/users.js +++ b/client/js/admin/users.js @@ -1,6 +1,6 @@ function loadUsers() { const contentArea = $('#content-area'); - contentArea.html('

User Management

'); + contentArea.html('

User Management

'); $.ajax({ url: '/api/admin/users', @@ -24,40 +24,36 @@ function displayUsers(users) { const currentAdminId = localStorage.getItem('userId'); users.forEach(user => { const panel = $(` -
-
-

${escapeHtml(user.username)}

-
-
-
-
-

Email: ${escapeHtml(user.email)}

-

Signup Date: ${new Date(user.signupDate).toLocaleString()}

-

Status: +

+
+
+

${escapeHtml(user.username)}

+
+
+ -
-
- - ${user.isAdmin ? - (user._id !== currentAdminId ? - `` : - '' - ) : - `` - } - -
+
@@ -104,7 +100,7 @@ function showBanModal(userId) {
@@ -243,6 +239,6 @@ function showAlert(type, message) { ${message}
`); - $('#user-management').prepend(alertDiv); + $('#user-management').before(alertDiv); setTimeout(() => alertDiv.alert('close'), 5000); } \ No newline at end of file