Merge branch 'feat/list-accounts'
This commit is contained in:
commit
858b8cd364
6 changed files with 155 additions and 44 deletions
|
|
@ -1,9 +0,0 @@
|
|||
package pages
|
||||
|
||||
import "git.juancwu.dev/juancwu/budgit/internal/ui/layouts"
|
||||
|
||||
templ SpaceOverview(spaceName string) {
|
||||
@layouts.App("Space Overview") {
|
||||
<div>space overview: { spaceName }</div>
|
||||
}
|
||||
}
|
||||
58
internal/ui/pages/space_overview.templ
Normal file
58
internal/ui/pages/space_overview.templ
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
package pages
|
||||
|
||||
import "git.juancwu.dev/juancwu/budgit/internal/ui/layouts"
|
||||
import "git.juancwu.dev/juancwu/budgit/internal/ui/blocks"
|
||||
import "git.juancwu.dev/juancwu/budgit/internal/ui/components/sidebar"
|
||||
|
||||
import "git.juancwu.dev/juancwu/budgit/internal/routeurl"
|
||||
import "git.juancwu.dev/juancwu/budgit/internal/ctxkeys"
|
||||
import "git.juancwu.dev/juancwu/budgit/internal/ui/components/icon"
|
||||
|
||||
type SpaceOverviewProps struct {
|
||||
SpaceID string
|
||||
SpaceName string
|
||||
Accounts []blocks.AccountCardInfo
|
||||
}
|
||||
|
||||
templ SpaceOverview(props SpaceOverviewProps) {
|
||||
@layouts.App("Space Overview", spaceOverviewSidebarContent(), spaceSpecificSidebarContent(props.SpaceID)) {
|
||||
<div class="container px-6 py-8 mx-auto">
|
||||
<div class="mb-8">
|
||||
<h1 class="text-3xl font-bold">{ props.SpaceName }</h1>
|
||||
<p class="text-muted-foreground mt-2">Space overview</p>
|
||||
</div>
|
||||
<div class="mb-8">
|
||||
<h2 class="text-xl font-semibold mb-4">Accounts</h2>
|
||||
if len(props.Accounts) == 0 {
|
||||
<p class="text-muted-foreground text-sm">No accounts yet.</p>
|
||||
} else {
|
||||
<div>
|
||||
for _, account := range props.Accounts {
|
||||
@blocks.AccountCard(account)
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
templ spaceSpecificSidebarContent(spaceID string) {
|
||||
@sidebar.Group() {
|
||||
@sidebar.GroupLabel() {
|
||||
Space
|
||||
}
|
||||
@sidebar.Menu() {
|
||||
@sidebar.MenuItem() {
|
||||
@sidebar.MenuButton(sidebar.MenuButtonProps{
|
||||
Href: routeurl.URL("page.app.spaces.space.overview", "spaceID", spaceID),
|
||||
IsActive: ctxkeys.URLPath(ctx) == routeurl.URL("page.app.spaces.space.overview", "spaceID", spaceID),
|
||||
Tooltip: "Space Overview",
|
||||
}) {
|
||||
@icon.LayoutDashboard()
|
||||
<span>Space Overview</span>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +1,17 @@
|
|||
package pages
|
||||
|
||||
import "git.juancwu.dev/juancwu/budgit/internal/ui/layouts"
|
||||
import "git.juancwu.dev/juancwu/budgit/internal/ui/blocks"
|
||||
import "git.juancwu.dev/juancwu/budgit/internal/ui/components/button"
|
||||
import "git.juancwu.dev/juancwu/budgit/internal/ui/components/icon"
|
||||
import "git.juancwu.dev/juancwu/budgit/internal/routeurl"
|
||||
import (
|
||||
"git.juancwu.dev/juancwu/budgit/internal/ctxkeys"
|
||||
"git.juancwu.dev/juancwu/budgit/internal/routeurl"
|
||||
"git.juancwu.dev/juancwu/budgit/internal/ui/blocks"
|
||||
"git.juancwu.dev/juancwu/budgit/internal/ui/components/button"
|
||||
"git.juancwu.dev/juancwu/budgit/internal/ui/components/icon"
|
||||
"git.juancwu.dev/juancwu/budgit/internal/ui/components/sidebar"
|
||||
"git.juancwu.dev/juancwu/budgit/internal/ui/layouts"
|
||||
)
|
||||
|
||||
templ Spaces(spaces []blocks.SpaceCardInfo) {
|
||||
@layouts.App("Spaces") {
|
||||
@layouts.App("Spaces", spaceOverviewSidebarContent()) {
|
||||
<div class="container px-6 py-8 mx-auto">
|
||||
<div class="mb-8 w-full flex justify-between items-center">
|
||||
<div>
|
||||
|
|
@ -48,3 +52,33 @@ templ SharedSpaces(spaces []blocks.SpaceCardInfo) {
|
|||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
templ spaceOverviewSidebarContent() {
|
||||
@sidebar.Group() {
|
||||
@sidebar.GroupLabel() {
|
||||
Overview
|
||||
}
|
||||
@sidebar.Menu() {
|
||||
@sidebar.MenuItem() {
|
||||
@sidebar.MenuButton(sidebar.MenuButtonProps{
|
||||
Href: routeurl.URL("page.app.spaces"),
|
||||
IsActive: ctxkeys.URLPath(ctx) == routeurl.URL("page.app.spaces"),
|
||||
Tooltip: "My spaces",
|
||||
}) {
|
||||
@icon.User()
|
||||
<span>My spaces</span>
|
||||
}
|
||||
}
|
||||
@sidebar.MenuItem() {
|
||||
@sidebar.MenuButton(sidebar.MenuButtonProps{
|
||||
Href: routeurl.URL("page.app.shared-with-me"),
|
||||
IsActive: ctxkeys.URLPath(ctx) == routeurl.URL("page.app.shared-with-me"),
|
||||
Tooltip: "Shared with me",
|
||||
}) {
|
||||
@icon.Users()
|
||||
<span>Shared with me</span>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue