feat: replace overview with reports page

This commit is contained in:
juancwu 2026-02-15 23:00:58 +00:00
commit a7d5f21fe8
5 changed files with 12 additions and 200 deletions

View file

@ -1,119 +0,0 @@
package pages
import (
"fmt"
"git.juancwu.dev/juancwu/budgit/internal/model"
"git.juancwu.dev/juancwu/budgit/internal/ui/components/badge"
"git.juancwu.dev/juancwu/budgit/internal/ui/components/button"
"git.juancwu.dev/juancwu/budgit/internal/ui/components/dialog"
"git.juancwu.dev/juancwu/budgit/internal/ui/components/expense"
"git.juancwu.dev/juancwu/budgit/internal/ui/layouts"
)
templ SpaceOverviewPage(space *model.Space, lists []*model.ShoppingList, tags []*model.Tag, listsWithItems []model.ListWithUncheckedItems, accounts []model.MoneyAccountWithBalance) {
@layouts.Space("Overview", space) {
<div class="space-y-4">
<div class="flex justify-between items-center">
<h1 class="text-2xl font-bold">Welcome to { space.Name }!</h1>
@dialog.Dialog(dialog.Props{ID: "add-expense-overview-dialog"}) {
@dialog.Trigger() {
@button.Button() {
Add Expense
}
}
@dialog.Content() {
@dialog.Header() {
@dialog.Title() {
Add Transaction
}
@dialog.Description() {
Add a new expense or top-up to your space.
}
}
@expense.AddExpenseForm(expense.AddExpenseFormProps{
Space: space,
Tags: tags,
ListsWithItems: listsWithItems,
DialogID: "add-expense-overview-dialog",
FromOverview: true,
})
}
}
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
// Shopping Lists section
<div class="border rounded-lg p-4">
<h2 class="text-lg font-semibold mb-2">Shopping Lists</h2>
if len(lists) > 0 {
<ul class="space-y-1">
for i, list := range lists {
if i < 5 {
<li>
<a
href={ templ.URL("/app/spaces/" + space.ID + "/lists/" + list.ID) }
class="block px-3 py-2 rounded-md hover:bg-muted transition-colors text-sm"
>
{ list.Name }
</a>
</li>
}
}
</ul>
<a
href={ templ.URL("/app/spaces/" + space.ID + "/lists") }
class="block text-sm text-muted-foreground hover:text-foreground transition-colors mt-2 px-3"
>
View all shopping lists
</a>
} else {
<p class="text-sm text-muted-foreground">No shopping lists yet.</p>
}
</div>
// Tags section
<div class="border rounded-lg p-4">
<h2 class="text-lg font-semibold mb-2">Tags</h2>
if len(tags) > 0 {
<div class="flex flex-wrap gap-2">
for _, tag := range tags {
@badge.Badge(badge.Props{Variant: badge.VariantSecondary}) {
{ tag.Name }
}
}
</div>
} else {
<p class="text-sm text-muted-foreground">No tags yet.</p>
}
</div>
// Money Accounts section
<div class="border rounded-lg p-4">
<h2 class="text-lg font-semibold mb-2">Money Accounts</h2>
if len(accounts) > 0 {
<ul class="space-y-1">
for i, account := range accounts {
if i < 5 {
<li>
<a
href={ templ.URL("/app/spaces/" + space.ID + "/accounts") }
class="block px-3 py-2 rounded-md hover:bg-muted transition-colors text-sm flex justify-between"
>
<span>{ account.Name }</span>
<span class="text-muted-foreground">{ fmt.Sprintf("$%.2f", float64(account.BalanceCents)/100) }</span>
</a>
</li>
}
}
</ul>
<a
href={ templ.URL("/app/spaces/" + space.ID + "/accounts") }
class="block text-sm text-muted-foreground hover:text-foreground transition-colors mt-2 px-3"
>
View all accounts
</a>
} else {
<p class="text-sm text-muted-foreground">No accounts yet.</p>
}
</div>
</div>
</div>
}
}