From ee64d5e456550663e78f6e97b5248e5802db95c0 Mon Sep 17 00:00:00 2001 From: juancwu Date: Mon, 9 Feb 2026 13:59:20 +0000 Subject: [PATCH] fix: remove balance from dashboard --- internal/handler/dashboard.go | 12 +----------- internal/ui/pages/app_dashboard.templ | 21 +++++++-------------- 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/internal/handler/dashboard.go b/internal/handler/dashboard.go index 4c2d479..5a4ebd2 100644 --- a/internal/handler/dashboard.go +++ b/internal/handler/dashboard.go @@ -32,17 +32,7 @@ func (h *dashboardHandler) DashboardPage(w http.ResponseWriter, r *http.Request) return } - var totalBalance int - for _, space := range spaces { - balance, err := h.expenseService.GetBalanceForSpace(space.ID) - if err != nil { - slog.Error("failed to get balance for space", "error", err, "space_id", space.ID) - continue - } - totalBalance += balance - } - - ui.Render(w, r, pages.Dashboard(spaces, totalBalance)) + ui.Render(w, r, pages.Dashboard(spaces)) } func (h *dashboardHandler) CreateSpace(w http.ResponseWriter, r *http.Request) { diff --git a/internal/ui/pages/app_dashboard.templ b/internal/ui/pages/app_dashboard.templ index 8144972..8d1ba90 100644 --- a/internal/ui/pages/app_dashboard.templ +++ b/internal/ui/pages/app_dashboard.templ @@ -1,7 +1,6 @@ package pages import ( - "fmt" "git.juancwu.dev/juancwu/budgit/internal/model" "git.juancwu.dev/juancwu/budgit/internal/ui/layouts" "git.juancwu.dev/juancwu/budgit/internal/ui/components/button" @@ -13,7 +12,7 @@ import ( "git.juancwu.dev/juancwu/budgit/internal/ui/components/label" ) -templ Dashboard(spaces []*model.Space, totalBalance int) { +templ Dashboard(spaces []*model.Space) { @layouts.App("Dashboard") {
@@ -23,20 +22,15 @@ templ Dashboard(spaces []*model.Space, totalBalance int) { Welcome back! Here's an overview of your spaces.

-
-

Total Balance

-

- { fmt.Sprintf("$%.2f", float64(totalBalance)/100.0) } -

-
-
for _, space := range spaces { - @card.Card(card.Props{ Class: "h-full transition-colors group-hover:border-primary" }) { + @card.Card(card.Props{Class: "h-full transition-colors group-hover:border-primary"}) { @card.Header() { - @card.Title() { { space.Name } } + @card.Title() { + { space.Name } + } @card.Description() { Manage expenses and shopping lists in this space. } @@ -47,12 +41,11 @@ templ Dashboard(spaces []*model.Space, totalBalance int) { } } - // Option to create a new space @dialog.Dialog(dialog.Props{ID: "create-space-dialog"}) { @dialog.Trigger() { - @card.Card(card.Props{ Class: "h-full border-dashed cursor-pointer transition-colors hover:border-primary" }) { - @card.Content(card.ContentProps{ Class: "h-full flex flex-col items-center justify-center py-12" }) { + @card.Card(card.Props{Class: "h-full border-dashed cursor-pointer transition-colors hover:border-primary"}) { + @card.Content(card.ContentProps{Class: "h-full flex flex-col items-center justify-center py-12"}) { @icon.Plus(icon.Props{Class: "h-8 w-8 text-muted-foreground mb-2"})

Create a new space

}