package templates import ( "fmt" "time" "veola/internal/db" "veola/internal/models" ) type DashboardData struct { Page Stats *db.DashboardStats RecentResults []ResultRow RecentAlerts []AlertRow } type ResultRow struct { ItemID int64 ItemName string Title string Price *float64 Currency string Source string URL string FoundAt time.Time Alerted bool } type AlertRow struct { ItemName string Price *float64 Currency string FoundAt time.Time } // DashboardBody is the self-refreshing inner block. It is both the initial // render target (inside Layout) and the response to /dashboard/refresh, so the // hx-swap="outerHTML" on its root div replaces it with a fresh copy of itself. // GetDashboardRefresh must render THIS, not Dashboard — rendering the full // Layout would inject a nested page (and a duplicate sidebar) into the div. templ DashboardBody(d DashboardData) {
| Item | Price | Source | Found |
|---|---|---|---|
| { r.ItemName } | { fmtPrice(r.Price, r.Currency) } | { r.Source } | { humanTime(r.FoundAt) } |