admin page updates
This commit is contained in:
@@ -5,48 +5,25 @@ import "git.haelnorr.com/h/oslstats/internal/view/baseview"
|
||||
templ DashboardLayout(activeSection string) {
|
||||
@baseview.Layout("Admin Dashboard") {
|
||||
<div class="max-w-screen-2xl mx-auto px-2">
|
||||
<div class="flex flex-col md:flex-row gap-4">
|
||||
<!-- Sidebar Navigation -->
|
||||
<aside
|
||||
class="w-full md:w-64 flex-shrink-0"
|
||||
x-data="{ mobileOpen: false }"
|
||||
>
|
||||
<!-- Mobile toggle button -->
|
||||
<button
|
||||
@click="mobileOpen = !mobileOpen"
|
||||
class="md:hidden w-full bg-surface0 border border-surface1 rounded-lg px-4 py-3 mb-2 flex items-center justify-between hover:bg-surface1 transition"
|
||||
>
|
||||
<span class="font-semibold text-text">Admin Menu</span>
|
||||
<svg
|
||||
class="w-5 h-5 transition-transform"
|
||||
:class="mobileOpen ? 'rotate-180' : ''"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
|
||||
</svg>
|
||||
</button>
|
||||
<!-- Navigation links -->
|
||||
<nav
|
||||
class="bg-surface0 border border-surface1 rounded-lg p-4"
|
||||
:class="mobileOpen ? 'block' : 'hidden md:block'"
|
||||
@click.away="mobileOpen = false"
|
||||
>
|
||||
<h2 class="text-lg font-bold text-text mb-4 px-2">Admin Dashboard</h2>
|
||||
<ul class="space-y-1">
|
||||
@navItem("users", "Users", activeSection)
|
||||
@navItem("roles", "Roles", activeSection)
|
||||
@navItem("permissions", "Permissions", activeSection)
|
||||
@navItem("audit", "Audit Logs", activeSection)
|
||||
</ul>
|
||||
</nav>
|
||||
</aside>
|
||||
<!-- Main content area -->
|
||||
<main class="flex-1 min-w-0" id="admin-content">
|
||||
{ children... }
|
||||
</main>
|
||||
</div>
|
||||
<!-- Page Title -->
|
||||
<h1 class="text-2xl font-bold text-text mb-4">Admin Dashboard</h1>
|
||||
|
||||
<!-- Single cohesive panel with tabs and content -->
|
||||
<div class="border border-surface1 rounded-lg overflow-hidden">
|
||||
<!-- Tab Navigation -->
|
||||
<nav class="bg-surface0 border-b border-surface1">
|
||||
<ul class="flex flex-wrap">
|
||||
@navItem("users", "Users", activeSection)
|
||||
@navItem("roles", "Roles", activeSection)
|
||||
@navItem("audit", "Audit Logs", activeSection)
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<!-- Content Area -->
|
||||
<main class="bg-crust p-6" id="admin-content">
|
||||
{ children... }
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/static/js/admin.js"></script>
|
||||
}
|
||||
@@ -55,11 +32,11 @@ templ DashboardLayout(activeSection string) {
|
||||
templ navItem(section string, label string, activeSection string) {
|
||||
{{
|
||||
isActive := section == activeSection
|
||||
baseClasses := "block px-4 py-2 rounded-lg transition-colors cursor-pointer"
|
||||
activeClasses := "bg-blue text-mantle font-semibold"
|
||||
inactiveClasses := "text-subtext0 hover:bg-surface1 hover:text-text"
|
||||
baseClasses := "inline-block px-6 py-3 transition-colors cursor-pointer border-b-2"
|
||||
activeClasses := "border-blue text-blue font-semibold"
|
||||
inactiveClasses := "border-transparent text-subtext0 hover:text-text hover:border-surface2"
|
||||
}}
|
||||
<li>
|
||||
<li class="inline-block">
|
||||
<a
|
||||
href={ templ.SafeURL("/admin/" + section) }
|
||||
hx-post={ "/admin/" + section }
|
||||
@@ -67,7 +44,6 @@ templ navItem(section string, label string, activeSection string) {
|
||||
hx-swap="innerHTML"
|
||||
hx-push-url={ "/admin/" + section }
|
||||
class={ baseClasses, templ.KV(activeClasses, isActive), templ.KV(inactiveClasses, !isActive) }
|
||||
@click="if (window.innerWidth < 768) mobileOpen = false"
|
||||
>
|
||||
{ label }
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user