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
118 lines
4.1 KiB
Templ
118 lines
4.1 KiB
Templ
package templates
|
|
|
|
import (
|
|
"bookhoard/internal/handlers"
|
|
"fmt"
|
|
)
|
|
|
|
templ Progress(user User, progressData []handlers.ProgressWithMedia, errorMessage string) {
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
<title>Reading Progress - Bookhoard</title>
|
|
<script src="/static/htmx.min.js"></script>
|
|
<link href="/static/style.css" rel="stylesheet"/>
|
|
</head>
|
|
<body class="theme-{ user.Theme }">
|
|
@Header(user, "/progress")
|
|
<div class="w-full px-4 sm:px-6 lg:px-8 py-8">
|
|
<div class="mb-8">
|
|
<h1 class="text-2xl font-bold tracking-tight text-content">Reading Progress</h1>
|
|
<p class="text-content-muted">Track your reading progress across all devices</p>
|
|
</div>
|
|
<div id="progress-container" class="space-y-6">
|
|
if len(progressData) == 0 {
|
|
<div class="text-center py-16 text-content-muted">
|
|
<div class="mb-4 flex justify-center">@Icon("book-open", "h-12 w-12")</div>
|
|
<h3 class="text-xl font-semibold mb-2 text-content">No Progress Yet</h3>
|
|
<p>Start reading a book to track your progress</p>
|
|
</div>
|
|
}
|
|
for _, item := range progressData {
|
|
<div class="card p-6">
|
|
<div class="flex gap-6">
|
|
<div class="flex-shrink-0">
|
|
<img
|
|
src="{ item.CoverImagePath }"
|
|
alt="Cover"
|
|
class="w-24 h-32 object-cover rounded"
|
|
onerror="this.src='/static/placeholder-book.svg'"
|
|
/>
|
|
</div>
|
|
<div class="flex-1">
|
|
<div class="flex justify-between items-start mb-2">
|
|
<div>
|
|
<a
|
|
href={ "/media/" + item.MediaItemID.String() }
|
|
class="text-content no-underline"
|
|
>
|
|
<h3 class="font-semibold text-lg hover:opacity-80">{ item.Title }</h3>
|
|
</a>
|
|
if item.Author != "" {
|
|
<p class="text-sm text-content-muted">by { item.Author }</p>
|
|
}
|
|
</div>
|
|
<div class="text-right">
|
|
<span class="text-2xl font-bold text-brand">{ item.ProgressPercentage }%</span>
|
|
</div>
|
|
</div>
|
|
<div class="mb-4">
|
|
<div class="w-full bg-surface rounded-full h-3">
|
|
<div class="h-3 rounded-full transition-all bg-brand" style={ "width: " + fmt.Sprintf("%.1f", item.ProgressPercentage) + "%" }></div>
|
|
</div>
|
|
</div>
|
|
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 text-sm">
|
|
<div>
|
|
<p class="text-content-muted">Current Position</p>
|
|
<p class="text-content">
|
|
if item.FormatGroup == "reflowable" {
|
|
if item.EstimatedPages > 0 {
|
|
{ fmt.Sprintf("Page %d of %d (est.)", item.CurrentPage, item.EstimatedPages) }
|
|
} else {
|
|
{ fmt.Sprintf("%.1f%%", item.ProgressPercentage) }
|
|
}
|
|
} else {
|
|
{ fmt.Sprintf("%d / %d", item.CurrentPage, item.TotalPages) }
|
|
}
|
|
</p>
|
|
</div>
|
|
<div>
|
|
<p class="text-content-muted">Last Updated</p>
|
|
<p class="text-content">{ item.LastUpdated }</p>
|
|
</div>
|
|
<div>
|
|
<p class="text-content-muted">Synced From</p>
|
|
<div class="flex items-center gap-2">
|
|
<span class="text-xl">{ item.DeviceIcon }</span>
|
|
<span class="text-content">{ item.DeviceName }</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
if item.DeviceIcon != "" {
|
|
<div class="mt-3 pt-3 border-t border-line">
|
|
<div class="flex items-center gap-2 text-xs text-content-muted">
|
|
@Icon("sync", "h-4 w-4")
|
|
<span>Last sync from <strong>{ item.DeviceName }</strong></span>
|
|
<span>({ item.DeviceType })</span>
|
|
</div>
|
|
</div>
|
|
}
|
|
if item.EpubCFI != "" {
|
|
<div class="mt-2 text-xs text-content-muted">
|
|
@Icon("bookmark", "h-4 w-4")
|
|
<span>CFI: { item.EpubCFI }</span>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
@ErrorToast(errorMessage)
|
|
</body>
|
|
</html>
|
|
}
|