Files
bookhoard/templates/admin.templ
T
john-okeefe a075a5061f feat(ui): refresh auth, entry, admin, and secondary pages
Apply the new design-system primitives across the remaining pages so the
whole app shares one visual language:

- Auth/entry: redesigned index, login, register (centered card layout,
  SVG icons, semantic tokens)
- Admin: sidebar nav with icons, cohesive admin dashboard/users/library/
  processing-issues/settings (tables use border-line + hover states;
  scan/websocket attributes preserved)
- Secondary: analytics (stat cards), devices, progress, conflicts, queue,
  profile + form/modal all migrated to .card/.btn/.input primitives and
  SVG action icons
- Docs + API explorer + setup wizard + collection/rules/modals +
  unlinked books + book-detail modals: consistent chrome, modal scrims
  use --surface-overlay, close buttons use icon-btn
- reader.templ and error.templ intentionally left unchanged
2026-08-05 16:01:22 -04:00

120 lines
4.5 KiB
Templ

package templates
templ Admin(user User) {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>Admin Dashboard - Bookhoard</title>
<script src="/static/htmx.min.js"></script>
<link href="/static/style.css" rel="stylesheet"/>
</head>
<body x-data="admin" x-init="loadWatchStatus(); initializeScanWebSocket()" class="theme-tokyo-night">
@Header(user, "/admin")
<div class="flex min-h-screen bg-surface">
@AdminSidebar(user, "/admin")
<main class="flex-1 p-6 sm:p-8">
<div class="max-w-4xl">
<div class="mb-8">
<h1 class="text-2xl font-bold tracking-tight text-content mb-2">Dashboard</h1>
<p class="text-content-muted">Overview of your Bookhoard library and settings</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
<div class="card p-6">
<div class="flex items-center space-x-3">
<div class="text-content-muted">@Icon("library", "h-7 w-7")</div>
<div>
<h3 class="font-semibold text-content">Library</h3>
<p class="text-content-muted text-sm">Manage your ebook collection</p>
</div>
</div>
<a href="/" class="btn btn-secondary mt-4 text-sm">View Library</a>
</div>
<div class="card p-6">
<div class="flex items-center space-x-3">
<div class="text-content-muted">@Icon("sync", "h-7 w-7")</div>
<div>
<h3 class="font-semibold text-content">Scan Watch Status</h3>
<p class="text-content-muted text-sm">Auto-detecting new files</p>
</div>
</div>
<div id="watch-status" class="mt-4 text-sm text-content-muted">
<span class="inline-block w-2 h-2 rounded-full bg-green-500 mr-2"></span>
Watching <span id="watch-count">0</span> libraries
</div>
</div>
</div>
<div class="card p-6">
<h3 class="text-xl font-semibold mb-4 text-content">Quick Actions</h3>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<button @click="scanAllLibraries()" class="btn btn-primary p-4 text-left">
<div class="font-medium">Rescan Library</div>
<div class="text-content-muted text-sm">Re-scan existing files and fix metadata</div>
</button>
<a href="/admin/library" class="btn btn-secondary p-4 text-left block">
<div class="font-medium">Manage Libraries and Folders</div>
<div class="text-content-muted text-sm">Add or remove libraries and scan directories</div>
</a>
</div>
</div>
<!-- Scan Progress Section -->
<div id="scan-progress-container" class="card mt-6 opacity-0 -translate-y-2.5 transition-all duration-300 ease-out">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold text-content flex items-center gap-2">
@Icon("library", "h-5 w-5")
Scanning Libraries
</h3>
<button @click="hideScanProgress()" class="p-2 hover:bg-surface-hover rounded">
@Icon("close", "h-4 w-4")
</button>
</div>
<!-- Overall Progress -->
<div class="mb-4">
<div class="flex justify-between text-sm mb-2">
<span class="text-content-muted">Overall Progress</span>
<span id="scan-progress-text" class="text-content">0%</span>
</div>
<div class="w-full bg-surface-hover rounded-full h-3">
<div
id="scan-progress-bar"
class="h-3 rounded-full transition-all duration-500 bg-brand"
style="width: 0%;"
></div>
</div>
<div id="scan-status" class="text-sm mt-2 text-content-muted">
Starting scan...
</div>
</div>
<!-- Per-Library Progress -->
<div id="library-progress-list" class="space-y-3">
<!-- Dynamically populated -->
</div>
<!-- Results Summary -->
<div id="scan-results" class="hidden mt-6 p-4 rounded-lg border border-line bg-surface">
<h4 class="font-semibold mb-2 text-content flex items-center gap-2">@Icon("check-circle", "h-4 w-4") Scan Complete!</h4>
<div id="scan-results-content" class="text-content-muted">
<!-- Results populated by JS -->
</div>
<div class="mt-4 flex gap-2">
<button
@click="window.location.reload()"
class="btn btn-primary"
>
Refresh to View Books
</button>
<button
@click="hideScanProgress()"
class="btn btn-secondary"
>
Dismiss
</button>
</div>
</div>
</div>
</div>
</main>
</div>
</body>
</html>
}