Files
vctp2/components/views/snapshots.templ
Nathan Coad 8df1d145f8
All checks were successful
continuous-integration/drone/push Build is passing
add record size to hourly snapshot page
2026-01-14 19:43:32 +11:00

64 lines
2.0 KiB
Plaintext

package views
import (
"vctp/components/core"
)
type SnapshotEntry struct {
Label string
Link string
Count int64
}
templ SnapshotHourlyList(entries []SnapshotEntry) {
@SnapshotListPage("Hourly Inventory Snapshots", "inventory snapshots captured hourly", entries)
}
templ SnapshotDailyList(entries []SnapshotEntry) {
@SnapshotListPage("Daily Inventory Snapshots", "daily summaries of hourly inventory snapshots", entries)
}
templ SnapshotMonthlyList(entries []SnapshotEntry) {
@SnapshotListPage("Monthly Inventory Snapshots", "monthly summary aggregated from daily snapshots", entries)
}
templ SnapshotListPage(title string, subtitle string, entries []SnapshotEntry) {
<!DOCTYPE html>
<html lang="en">
@core.Header()
<body class="flex flex-col min-h-screen web2-bg">
<main class="flex-grow web2-shell space-y-8">
<section class="web2-header">
<div class="flex flex-col gap-4 md:flex-row md:items-center md:justify-between">
<div>
<div class="web2-pill">Snapshot Library</div>
<h1 class="mt-3 text-4xl font-bold">{title}</h1>
<p class="mt-2 text-sm text-slate-600">{subtitle}</p>
</div>
<a class="web2-button" href="/">Back to Dashboard</a>
</div>
</section>
<section class="web2-card">
<div class="flex items-center justify-between gap-3">
<h2 class="text-lg font-semibold">Available Exports&nbsp;</h2>
<span class="text-xs uppercase tracking-[0.2em] text-slate-400">{len(entries)} files</span>
</div>
<ul class="mt-6 space-y-3 web2-list">
for _, entry := range entries {
<li class="flex items-center justify-between gap-4">
<div class="flex flex-col">
<span class="text-sm font-semibold text-slate-700">{entry.Label}</span>
<span class="text-xs text-slate-500">{entry.Count} records</span>
</div>
<a class="web2-link" href={entry.Link}>Download XLSX</a>
</li>
}
</ul>
</section>
</main>
</body>
@core.Footer()
</html>
}