Apply the sidebar shell and bold primitives across the rest of the app so the whole experience shares one visual language: - Browse/organize: series (keeps stacked-covers/series-card CSS), collections (keeps wood-paneling + carousel classes), browse_detail. - Account/stats: profile + form + modal, progress, analytics (stat-card tiles), devices, conflicts (status semantics), queue (status/priority badges). - Admin: admin sidebar restyled with icons, dashboard/users/library/ processing-issues/settings migrated to .card/.btn/.input primitives. - Docs/setup/misc: docs (keeps prose/highlight.js), api_explorer, setup wizard, unlinked_books, custom_section builder. - Modals/fragments: collection_modal, collection_rules, restore_system_collection_modal, filter_item, book_detail_modals — all overlays use --surface-overlay + --shadow-pop. Every Alpine handler, HTMX attribute, id, name, and data-* is preserved; only presentation changes.
194 lines
8.8 KiB
Templ
194 lines
8.8 KiB
Templ
package templates
|
|
|
|
templ AdminLibrary(user User, libraries []LibraryData, users []User) {
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8"/>
|
|
<title>Library Management - Bookhoard</title>
|
|
<link href="/static/style.css" rel="stylesheet"/>
|
|
</head>
|
|
<body x-data="library" x-init="initializeLibraryAdmin" class="theme-{ user.Theme }">
|
|
@Header(user, "/admin/library")
|
|
<div class="flex">
|
|
@AdminSidebar(user, "/admin/library")
|
|
<main class="flex-1 p-8">
|
|
<div class="max-w-5xl">
|
|
<div class="mb-8">
|
|
<div class="flex items-center justify-between gap-4 flex-wrap mb-4">
|
|
<a href="/admin" class="btn btn-secondary">
|
|
@Icon("arrow-left", "h-4 w-4")
|
|
Back to Dashboard
|
|
</a>
|
|
<button data-action="show-create-modal" class="btn btn-primary">
|
|
@Icon("plus", "h-4 w-4")
|
|
Create Library
|
|
</button>
|
|
</div>
|
|
<div class="flex items-center gap-3 mb-1">
|
|
<span class="grid place-items-center h-10 w-10 rounded-xl" style="background-color: var(--accent-muted); color: var(--accent);">
|
|
@Icon("library", "h-5 w-5")
|
|
</span>
|
|
<h1 class="text-2xl font-bold tracking-tight" style="color: var(--text-primary)">Library Management</h1>
|
|
</div>
|
|
<p class="text-sm" style="color: var(--text-secondary)">Manage libraries and configure media scanning</p>
|
|
</div>
|
|
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
|
<!-- Libraries Section -->
|
|
<div class="card p-6">
|
|
<div class="flex items-center gap-2 mb-1">
|
|
@Icon("library", "h-5 w-5 shrink-0")
|
|
<h3 class="text-lg font-semibold" style="color: var(--text-primary)">Libraries</h3>
|
|
</div>
|
|
<p class="text-sm mb-4" style="color: var(--text-secondary)">Manage media libraries and their folders</p>
|
|
<div id="libraries-list" class="space-y-3 mb-2">
|
|
if len(libraries) == 0 {
|
|
<p class="text-center py-8 text-sm" style="color: var(--text-secondary)">
|
|
No libraries yet. Create your first library to get started.
|
|
</p>
|
|
} else {
|
|
for _, library := range libraries {
|
|
<div class="p-4 rounded-xl border transition-colors hover:bg-surface-hover" style="background-color: var(--bg-primary); border-color: var(--border)">
|
|
<div class="flex justify-between items-start gap-3 mb-2">
|
|
<div class="min-w-0">
|
|
<h4 class="font-semibold" style="color: var(--text-primary)">{ library.Name }</h4>
|
|
if library.Description != "" {
|
|
<p class="text-sm" style="color: var(--text-secondary)">{ library.Description }</p>
|
|
}
|
|
<span class="chip mt-1">
|
|
@Icon("tag", "h-3 w-3")
|
|
{ library.TypeName }
|
|
</span>
|
|
</div>
|
|
<div class="flex flex-wrap gap-1 shrink-0">
|
|
<button data-library-id={ library.ID } data-action="show-folders" class="btn btn-secondary text-xs px-2.5 py-1">
|
|
@Icon("folder", "h-4 w-4")
|
|
Folders
|
|
</button>
|
|
<button data-library-id={ library.ID } data-action="edit" class="btn btn-primary text-xs px-2.5 py-1">
|
|
@Icon("edit", "h-4 w-4")
|
|
Edit
|
|
</button>
|
|
<button data-library-id={ library.ID } data-action="delete" class="btn btn-danger text-xs px-2.5 py-1">
|
|
@Icon("trash", "h-4 w-4")
|
|
Delete
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div id={ "library-folders-" + library.ID } class="hidden mt-3 space-y-2"></div>
|
|
</div>
|
|
}
|
|
}
|
|
</div>
|
|
</div>
|
|
<!-- User Library Visibility Section -->
|
|
<div class="card p-6">
|
|
<div class="flex items-center gap-2 mb-1">
|
|
@Icon("check-circle", "h-5 w-5 shrink-0")
|
|
<h3 class="text-lg font-semibold" style="color: var(--text-primary)">Library Visibility</h3>
|
|
</div>
|
|
<p class="text-sm mb-4" style="color: var(--text-secondary)">Control which libraries are visible to users</p>
|
|
<div id="visibility-controls" class="space-y-4">
|
|
<!-- Visibility controls will be loaded here -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- User Visibility Management -->
|
|
<div class="mt-6 card p-6">
|
|
<div class="flex items-center gap-2 mb-1">
|
|
@Icon("users", "h-5 w-5 shrink-0")
|
|
<h3 class="text-lg font-semibold" style="color: var(--text-primary)">User Library Access</h3>
|
|
</div>
|
|
<p class="text-sm mb-4" style="color: var(--text-secondary)">Manage individual user access to specific libraries</p>
|
|
<div class="mb-4">
|
|
<select id="user-select" onchange="loadUserVisibility()" class="input w-auto">
|
|
<option value="">Select a user...</option>
|
|
for _, user := range users {
|
|
<option value="{ user.ID }">{ user.Username } ({ user.Email })</option>
|
|
}
|
|
</select>
|
|
</div>
|
|
<div id="user-libraries" class="space-y-3">
|
|
<!-- User library checkboxes will be loaded here -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</div>
|
|
<!-- Create Library Modal -->
|
|
<div id="create-library-modal" class="hidden fixed inset-0 z-50 flex items-center justify-center p-4" style="background-color: var(--surface-overlay);">
|
|
<div class="card p-6 w-full max-w-md mx-4" style="box-shadow: var(--shadow-pop);">
|
|
<div class="flex justify-between items-center mb-6">
|
|
<h2 class="text-xl font-bold" style="color: var(--text-primary)">Create Library</h2>
|
|
<button type="button" data-action="hide-create-modal" class="icon-btn" aria-label="Close">
|
|
@Icon("close", "h-5 w-5")
|
|
</button>
|
|
</div>
|
|
<form id="create-library-form">
|
|
<input type="hidden" id="library-id" name="id"/>
|
|
<div class="mb-4">
|
|
<label class="block text-xs font-semibold uppercase tracking-wide mb-2" style="color: var(--text-secondary)">Library Name</label>
|
|
<input type="text" name="name" placeholder="My Ebook Library" class="input" required/>
|
|
</div>
|
|
<div class="mb-4">
|
|
<label class="block text-xs font-semibold uppercase tracking-wide mb-2" style="color: var(--text-secondary)">Description</label>
|
|
<textarea name="description" placeholder="Optional description" rows="3" class="input"></textarea>
|
|
</div>
|
|
<div class="mb-6">
|
|
<label class="block text-xs font-semibold uppercase tracking-wide mb-2" style="color: var(--text-secondary)">Library Type</label>
|
|
<select name="type" class="input" required>
|
|
<option value="ebooks">Ebooks</option>
|
|
<option value="comics">Comics</option>
|
|
<option value="manga">Manga</option>
|
|
</select>
|
|
</div>
|
|
<div class="flex justify-end space-x-3">
|
|
<button type="button" data-action="hide-create-modal" class="btn btn-secondary">Cancel</button>
|
|
<button type="submit" class="btn btn-primary">
|
|
@Icon("plus", "h-4 w-4")
|
|
Create
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<!-- Folder Browser Modal -->
|
|
<div id="folder-browser-modal" class="hidden fixed inset-0 z-50 flex items-center justify-center p-4" style="background-color: var(--surface-overlay);">
|
|
<div class="card p-6 w-full max-w-md mx-4" style="box-shadow: var(--shadow-pop);">
|
|
<div class="flex justify-between items-center mb-4">
|
|
<h2 class="text-xl font-bold" style="color: var(--text-primary)">Browse Folders</h2>
|
|
<button type="button" data-action="browse-cancel" class="icon-btn" aria-label="Close">
|
|
@Icon("close", "h-5 w-5")
|
|
</button>
|
|
</div>
|
|
<div id="folder-browser-content">
|
|
<!-- Directory listings will be rendered here -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Delete Library Confirmation Modal -->
|
|
<div id="delete-library-modal" class="hidden fixed inset-0 z-50 flex items-center justify-center p-4" style="background-color: var(--surface-overlay);">
|
|
<div class="card p-6 w-full max-w-md mx-4" style="box-shadow: var(--shadow-pop);">
|
|
<div class="flex justify-between items-center mb-4">
|
|
<h2 class="text-xl font-bold" style="color: var(--text-primary)">Delete Library</h2>
|
|
<button type="button" data-action="hide-delete-modal" class="icon-btn" aria-label="Close">
|
|
@Icon("close", "h-5 w-5")
|
|
</button>
|
|
</div>
|
|
<div id="delete-modal-content" class="mb-6" style="color: var(--text-primary)">
|
|
<!-- Dynamic content will be injected here -->
|
|
</div>
|
|
<div class="flex justify-end space-x-3">
|
|
<button type="button" data-action="hide-delete-modal" class="btn btn-secondary">Cancel</button>
|
|
<button type="button" data-action="confirm-delete" class="btn btn-danger">
|
|
@Icon("trash", "h-4 w-4")
|
|
Delete
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script src="/static/htmx.min.js"></script>
|
|
</body>
|
|
</html>
|
|
}
|