refactor: spaces page header with greeting and handler-computed total

Why: Move per-page balance summation out of the template (business logic
belongs in the handler) and dedupe the pluralised summary copy while
preserving the styled dollar span.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
juancwu 2026-04-24 00:26:23 +00:00
commit 0e3b8159ff
2 changed files with 35 additions and 7 deletions

View file

@ -50,7 +50,13 @@ func (h *spaceHandler) SpacesPage(w http.ResponseWriter, r *http.Request) {
}
cards := h.buildSpaceCards(spaces)
ui.Render(w, r, pages.Spaces(cards))
total := decimal.Zero
for _, c := range cards {
total = total.Add(c.TotalBalance)
}
ui.Render(w, r, pages.Spaces(cards, total))
}
func (h *spaceHandler) SharedSpacesPage(w http.ResponseWriter, r *http.Request) {