Converted all inline onclick/onsubmit handlers to Alpine.js @click/@submit directives and added x-data attributes to template body tags. Templates updated: - admin.templ: Added x-data="admin", converted scan/hide buttons - analytics.templ: Added x-data, converted loadAnalytics button - api_explorer.templ: Added x-data for API explorer page - bookshelf.templ: Added x-data, converted library/pagination handlers - collection_modal.templ: Added x-data for modal components - collection_rules.templ: Added x-data, converted all rule handlers - collections.templ: Added x-data, converted navigation/book handlers - conflicts.templ: Added x-data, converted resolve/dismiss handlers - header.templ: Converted theme dropdown and user menu handlers - index.templ: Added x-data for theme/auth - login.templ: Added x-data for theme switching - profile.templ: Added x-data, converted delete account - profile_form.templ: Converted modal close handler - profile_modal.templ: Added x-data for modal - progress.templ: Removed script (uses header.logout) - queue.templ: Added x-data, converted queue handlers - register.templ: Added x-data for theme - restore_system_collection_modal.templ: Added x-data - toast.templ: Converted to x-init with Alpine - unlinked_books.templ: Added x-data for bulk operations Dynamic content in devices.templ uses event delegation via data attributes.
121 lines
5.2 KiB
Templ
121 lines
5.2 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>
|
|
<script src="/static/main.js"></script>
|
|
<link href="/static/style.css" rel="stylesheet"/>
|
|
</head>
|
|
<body class="theme-tokyo-night" x-data="admin">
|
|
@Header(user, "/admin")
|
|
<div class="flex min-h-screen" style="background-color: var(--bg-primary)">
|
|
@AdminSidebar(user, "/admin")
|
|
<main class="flex-1 p-8">
|
|
<div class="max-w-4xl">
|
|
<div class="mb-8">
|
|
<h1 class="text-3xl font-bold mb-2" style="color: var(--text-primary)">Dashboard</h1>
|
|
<p style="color: var(--text-secondary)">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 rounded-lg border" style="background-color: var(--bg-secondary); border-color: var(--border)">
|
|
<div class="flex items-center space-x-3">
|
|
<div class="text-3xl">📖</div>
|
|
<div>
|
|
<h3 class="font-semibold" style="color: var(--text-primary)">Library</h3>
|
|
<p style="color: var(--text-secondary)" class="text-sm">Manage your ebook collection</p>
|
|
</div>
|
|
</div>
|
|
<a href="/" class="mt-4 inline-block text-sm btn-secondary px-3 py-1 rounded">View Library</a>
|
|
</div>
|
|
<div class="card p-6 rounded-lg border" style="background-color: var(--bg-secondary); border-color: var(--border)">
|
|
<div class="flex items-center space-x-3">
|
|
<div class="text-3xl">👁️</div>
|
|
<div>
|
|
<h3 class="font-semibold" style="color: var(--text-primary)">Scan Watch Status</h3>
|
|
<p style="color: var(--text-secondary)" class="text-sm">Auto-detecting new files</p>
|
|
</div>
|
|
</div>
|
|
<div id="watch-status" class="mt-4 text-sm" style="color: var(--text-secondary)">
|
|
<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 rounded-lg border" style="background-color: var(--bg-secondary); border-color: var(--border)">
|
|
<h3 class="text-xl font-semibold mb-4" style="color: var(--text-primary)">Quick Actions</h3>
|
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
|
<button @click="scanAllLibraries()" class="btn-primary p-4 rounded-lg text-left">
|
|
<div class="font-medium">Rescan Library</div>
|
|
<div style="color: var(--text-secondary)" class="text-sm">Re-scan existing files and fix metadata</div>
|
|
</button>
|
|
<a href="/admin/library" class="btn-secondary p-4 rounded-lg text-left block">
|
|
<div class="font-medium">Manage Folders</div>
|
|
<div style="color: var(--text-secondary)" class="text-sm">Add or remove scan directories</div>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<!-- Scan Progress Section -->
|
|
<div id="scan-progress-container" class="hidden mt-6 p-6 rounded-lg border opacity-0 -translate-y-2.5 transition-all duration-300 ease-out" style="background-color: var(--bg-secondary); border-color: var(--border);">
|
|
<div class="flex justify-between items-center mb-4">
|
|
<h3 class="text-lg font-semibold" style="color: var(--text-primary)">
|
|
📚 Scanning Libraries
|
|
</h3>
|
|
<button @click="hideScanProgress()" class="p-2 hover:bg-gray-700 rounded">
|
|
✕
|
|
</button>
|
|
</div>
|
|
<!-- Overall Progress -->
|
|
<div class="mb-4">
|
|
<div class="flex justify-between text-sm mb-2">
|
|
<span style="color: var(--text-secondary)">Overall Progress</span>
|
|
<span id="scan-progress-text" style="color: var(--text-primary)">0%</span>
|
|
</div>
|
|
<div class="w-full bg-gray-700 rounded-full h-3">
|
|
<div
|
|
id="scan-progress-bar"
|
|
class="h-3 rounded-full transition-all duration-500"
|
|
style="width: 0%; background-color: var(--accent);"
|
|
></div>
|
|
</div>
|
|
<div id="scan-status" class="text-sm mt-2" style="color: var(--text-secondary)">
|
|
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" style="background-color: var(--bg-primary); border-color: var(--border);">
|
|
<h4 class="font-semibold mb-2" style="color: var(--text-primary)">✅ Scan Complete!</h4>
|
|
<div id="scan-results-content" style="color: var(--text-secondary)">
|
|
<!-- Results populated by JS -->
|
|
</div>
|
|
<div class="mt-4 flex gap-2">
|
|
<button
|
|
@click="window.location.reload()"
|
|
class="btn-primary px-4 py-2 rounded-lg"
|
|
>
|
|
Refresh to View Books
|
|
</button>
|
|
<button
|
|
@click="hideScanProgress()"
|
|
class="btn-secondary px-4 py-2 rounded-lg"
|
|
>
|
|
Dismiss
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
}
|
|
|