diff --git a/components/core/header.templ b/components/core/header.templ index f41470d..db86675 100644 --- a/components/core/header.templ +++ b/components/core/header.templ @@ -92,6 +92,45 @@ templ Header() { padding: 0.75rem 1rem; box-shadow: none; } + .web2-table { + width: 100%; + border-collapse: collapse; + font-size: 0.95rem; + } + .web2-table thead th { + text-align: left; + padding: 0.75rem 0.5rem; + font-weight: 700; + color: var(--web2-muted); + border-bottom: 1px solid var(--web2-border); + } + .web2-table tbody td { + padding: 0.9rem 0.5rem; + border-bottom: 1px solid var(--web2-border); + } + .web2-table tbody tr:nth-child(odd) { + background: #f8fafc; + } + .web2-table tbody tr:nth-child(even) { + background: #ffffff; + } + .web2-group-row td { + background: #e8eef5; + color: #0f172a; + border-bottom: 1px solid var(--web2-border); + padding: 0.65rem 0.5rem; + } + .web2-badge { + display: inline-flex; + align-items: center; + gap: 0.25rem; + border: 1px solid var(--web2-border); + padding: 0.15rem 0.45rem; + border-radius: 3px; + font-size: 0.8rem; + color: var(--web2-muted); + background: #f8fafc; + } } diff --git a/components/core/header_templ.go b/components/core/header_templ.go index 8aa0189..d7f9f35 100644 --- a/components/core/header_templ.go +++ b/components/core/header_templ.go @@ -44,7 +44,7 @@ func Header() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\" rel=\"stylesheet\">") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\" rel=\"stylesheet\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/components/views/snapshots.templ b/components/views/snapshots.templ index a87cc5b..322b44c 100644 --- a/components/views/snapshots.templ +++ b/components/views/snapshots.templ @@ -8,6 +8,7 @@ type SnapshotEntry struct { Label string Link string Count int64 + Group string } templ SnapshotHourlyList(entries []SnapshotEntry) { @@ -40,21 +41,43 @@ templ SnapshotListPage(title string, subtitle string, entries []SnapshotEntry) {
-
-

Available Exports 

- {len(entries)} files +
+

Available Exports

+ {len(entries)} files +
+
+ + + + + + + + + + for i, entry := range entries { + if entry.Group != "" && (i == 0 || entries[i-1].Group != entry.Group) { + + + + } + + + + + + } + +
SnapshotRecordsDownload
{entry.Group}
+
+ {entry.Label} +
+
+ {entry.Count} records + + Download XLSX +
-
diff --git a/components/views/snapshots_templ.go b/components/views/snapshots_templ.go index e804f8f..f93a643 100644 --- a/components/views/snapshots_templ.go +++ b/components/views/snapshots_templ.go @@ -16,6 +16,7 @@ type SnapshotEntry struct { Label string Link string Count int64 + Group string } func SnapshotHourlyList(entries []SnapshotEntry) templ.Component { @@ -141,7 +142,7 @@ func SnapshotListPage(title string, subtitle string, entries []SnapshotEntry) te var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/snapshots.templ`, Line: 35, Col: 49} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/snapshots.templ`, Line: 36, Col: 49} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { @@ -154,75 +155,94 @@ func SnapshotListPage(title string, subtitle string, entries []SnapshotEntry) te var templ_7745c5c3_Var6 string templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(subtitle) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/snapshots.templ`, Line: 36, Col: 55} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/snapshots.templ`, Line: 37, Col: 55} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "

Back to Dashboard

Available Exports 

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "

Back to Dashboard

Available Exports

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(len(entries)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/snapshots.templ`, Line: 45, Col: 83} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views/snapshots.templ`, Line: 46, Col: 44} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, " files
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -230,7 +250,7 @@ func SnapshotListPage(title string, subtitle string, entries []SnapshotEntry) te if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/server/handler/snapshots.go b/server/handler/snapshots.go index 63c5d1d..a50eec6 100644 --- a/server/handler/snapshots.go +++ b/server/handler/snapshots.go @@ -109,10 +109,20 @@ func (h *Handler) renderSnapshotList(w http.ResponseWriter, r *http.Request, sna entries := make([]views.SnapshotEntry, 0, len(records)) for _, record := range records { label := report.FormatSnapshotLabel(snapshotType, record.SnapshotTime, record.TableName) + group := "" + switch snapshotType { + case "hourly": + group = record.SnapshotTime.Format("2006-01-02") + case "daily": + group = record.SnapshotTime.Format("January 2006") + case "monthly": + group = record.SnapshotTime.Format("2006") + } entries = append(entries, views.SnapshotEntry{ Label: label, Link: "/reports/" + url.PathEscape(record.TableName) + ".xlsx", Count: record.SnapshotCount, + Group: group, }) }