feat: list accounts in space overview
This commit is contained in:
parent
071f6c5855
commit
11ac016e44
6 changed files with 155 additions and 44 deletions
|
|
@ -115,5 +115,25 @@ func (h *spaceHandler) SpaceOverviewPage(w http.ResponseWriter, r *http.Request)
|
|||
return
|
||||
}
|
||||
|
||||
ui.Render(w, r, pages.SpaceOverview(space.Name))
|
||||
accounts, err := h.accountService.GetAccountsForSpace(spaceID)
|
||||
if err != nil {
|
||||
slog.Error("failed to fetch accounts for space", "error", err, "spaceID", spaceID)
|
||||
ui.RenderError(w, r, "Failed to load accounts", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
accountCards := make([]blocks.AccountCardInfo, 0, len(accounts))
|
||||
for _, a := range accounts {
|
||||
accountCards = append(accountCards, blocks.AccountCardInfo{
|
||||
ID: a.ID,
|
||||
Name: a.Name,
|
||||
Balance: a.Balance,
|
||||
})
|
||||
}
|
||||
|
||||
ui.Render(w, r, pages.SpaceOverview(pages.SpaceOverviewProps{
|
||||
SpaceID: space.ID,
|
||||
SpaceName: space.Name,
|
||||
Accounts: accountCards,
|
||||
}))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue