feat: show shopping list items in cards
This commit is contained in:
parent
f596a923d9
commit
6c704828ce
14 changed files with 396 additions and 85 deletions
|
|
@ -9,7 +9,7 @@ import (
|
|||
"git.juancwu.dev/juancwu/budgit/internal/ui/layouts"
|
||||
)
|
||||
|
||||
templ SpaceListsPage(space *model.Space, lists []*model.ShoppingList) {
|
||||
templ SpaceListsPage(space *model.Space, cards []model.ListCardData) {
|
||||
@layouts.Space("Shopping Lists", space) {
|
||||
<div class="space-y-4">
|
||||
<div class="flex justify-between items-center">
|
||||
|
|
@ -40,14 +40,14 @@ templ SpaceListsPage(space *model.Space, lists []*model.ShoppingList) {
|
|||
hx-trigger="sse:list_created, sse:list_deleted"
|
||||
hx-swap="innerHTML"
|
||||
>
|
||||
@ListsContainer(lists)
|
||||
@ListsContainer(space.ID, cards)
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
templ ListsContainer(lists []*model.ShoppingList) {
|
||||
for _, list := range lists {
|
||||
@shoppinglist.ListItem(list)
|
||||
templ ListsContainer(spaceID string, cards []model.ListCardData) {
|
||||
for _, card := range cards {
|
||||
@shoppinglist.ListCard(spaceID, card.List, card.Items, card.CurrentPage, card.TotalPages)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,14 +72,12 @@ templ SpaceOverviewPage(space *model.Space, lists []*model.ShoppingList, tags []
|
|||
}
|
||||
}
|
||||
</ul>
|
||||
if len(lists) > 5 {
|
||||
<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>
|
||||
}
|
||||
<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>
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue