Add admin button to dashboard (visible only for admins)
This commit is contained in:
parent
2bc263773b
commit
b6461b3d62
@ -110,6 +110,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="userAvatar" class="w-10 h-10 rounded-full bg-gradient-to-br from-[#38BDF8] to-[#A5B4FC] flex items-center justify-center font-semibold text-slate-950"></div>
|
<div id="userAvatar" class="w-10 h-10 rounded-full bg-gradient-to-br from-[#38BDF8] to-[#A5B4FC] flex items-center justify-center font-semibold text-slate-950"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<a id="adminBtn" href="admin.html" class="hidden px-4 py-2 text-sm font-medium bg-gradient-to-r from-[#38BDF8] to-[#A5B4FC] text-slate-950 rounded-lg hover:opacity-90 transition-all">
|
||||||
|
Admin
|
||||||
|
</a>
|
||||||
<button onclick="logout()" class="px-4 py-2 text-sm font-medium text-slate-400 hover:text-white border border-slate-700 hover:border-slate-500 rounded-lg transition-all">
|
<button onclick="logout()" class="px-4 py-2 text-sm font-medium text-slate-400 hover:text-white border border-slate-700 hover:border-slate-500 rounded-lg transition-all">
|
||||||
Logout
|
Logout
|
||||||
</button>
|
</button>
|
||||||
@ -292,6 +295,11 @@
|
|||||||
document.getElementById('userEmail').textContent = user.email || '';
|
document.getElementById('userEmail').textContent = user.email || '';
|
||||||
document.getElementById('welcomeName').textContent = user.name || 'User';
|
document.getElementById('welcomeName').textContent = user.name || 'User';
|
||||||
|
|
||||||
|
// Show admin button if user is admin
|
||||||
|
if (user.role === 'admin') {
|
||||||
|
document.getElementById('adminBtn').classList.remove('hidden');
|
||||||
|
}
|
||||||
|
|
||||||
// Avatar
|
// Avatar
|
||||||
const avatar = document.getElementById('userAvatar');
|
const avatar = document.getElementById('userAvatar');
|
||||||
if (user.picture) {
|
if (user.picture) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user