52 lines
1.5 KiB
Plaintext
52 lines
1.5 KiB
Plaintext
package adminview
|
|
|
|
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">
|
|
<!-- 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>
|
|
}
|
|
}
|
|
|
|
templ navItem(section string, label string, activeSection string) {
|
|
{{
|
|
isActive := section == activeSection
|
|
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 class="inline-block">
|
|
<a
|
|
href={ templ.SafeURL("/admin/" + section) }
|
|
hx-post={ "/admin/" + section }
|
|
hx-target="#admin-content"
|
|
hx-swap="innerHTML"
|
|
hx-push-url={ "/admin/" + section }
|
|
class={ baseClasses, templ.KV(activeClasses, isActive), templ.KV(inactiveClasses, !isActive) }
|
|
>
|
|
{ label }
|
|
</a>
|
|
</li>
|
|
}
|