diff --git a/internal/handler/space.go b/internal/handler/space.go index 9d75cab..b0b519a 100644 --- a/internal/handler/space.go +++ b/internal/handler/space.go @@ -146,6 +146,7 @@ func (h *spaceHandler) SpaceOverviewPage(w http.ResponseWriter, r *http.Request) accountCards := make([]blocks.AccountCardInfo, 0, len(accounts)) for _, a := range accounts { accountCards = append(accountCards, blocks.AccountCardInfo{ + SpaceID: space.ID, ID: a.ID, Name: a.Name, Balance: a.Balance, @@ -158,3 +159,17 @@ func (h *spaceHandler) SpaceOverviewPage(w http.ResponseWriter, r *http.Request) Accounts: accountCards, })) } + +func (h *spaceHandler) SpaceAccountPage(w http.ResponseWriter, r *http.Request) { + spaceID := r.PathValue("spaceID") + accountID := r.PathValue("accountID") + + ui.Render(w, r, pages.SpaceAccountPage(pages.SpaceAccountPageProps{ + SpaceID: spaceID, + AccountID: accountID, + AccountName: "Money Account", + AccountDescription: "Vault Infinite Priority", + AccountNumber: "4492", + AccountBalance: decimal.NewFromFloat(32093.11), + })) +} diff --git a/internal/routes/routes.go b/internal/routes/routes.go index b119788..4855051 100644 --- a/internal/routes/routes.go +++ b/internal/routes/routes.go @@ -92,6 +92,10 @@ func SetupRoutes(a *app.App) http.Handler { spaceAccessMw := middleware.RequireSpaceAccess(a.SpaceService) g.Use(spaceAccessMw) g.Get("/overview", spaceH.SpaceOverviewPage).Name("page.app.spaces.space.overview") + + g.SubGroup("/accounts/{accountID}", func(g *router.Group) { + g.Get("/overview", spaceH.SpaceAccountPage).Name("page.app.spaces.space.accounts.account.overview") + }) }) }) diff --git a/internal/ui/blocks/account_card.templ b/internal/ui/blocks/account_card.templ index c9a8ca3..b0b64b9 100644 --- a/internal/ui/blocks/account_card.templ +++ b/internal/ui/blocks/account_card.templ @@ -3,15 +3,17 @@ package blocks import "github.com/shopspring/decimal" import "strings" import "git.juancwu.dev/juancwu/budgit/internal/ui/components/icon" +import "git.juancwu.dev/juancwu/budgit/internal/routeurl" type AccountCardInfo struct { + SpaceID string ID string Name string Balance decimal.Decimal } templ AccountCard(info AccountCardInfo) { -