chore: use routeurl to get urls on the sidebar
This commit is contained in:
parent
28f990624d
commit
c639f9800e
1 changed files with 10 additions and 5 deletions
|
|
@ -11,13 +11,14 @@ import (
|
||||||
"git.juancwu.dev/juancwu/budgit/internal/ui/components/icon"
|
"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/components/sidebar"
|
||||||
"strings"
|
"strings"
|
||||||
|
"git.juancwu.dev/juancwu/budgit/internal/routeurl"
|
||||||
)
|
)
|
||||||
|
|
||||||
templ App(title string) {
|
templ App(title string) {
|
||||||
{{ cfg := ctxkeys.Config(ctx) }}
|
{{ cfg := ctxkeys.Config(ctx) }}
|
||||||
@Base(SEOProps{
|
@Base(SEOProps{
|
||||||
Title: title,
|
Title: title,
|
||||||
Description: "Application Dashboard",
|
Description: "List of Spaces",
|
||||||
Path: ctxkeys.URLPath(ctx),
|
Path: ctxkeys.URLPath(ctx),
|
||||||
}) {
|
}) {
|
||||||
@sidebar.Layout() {
|
@sidebar.Layout() {
|
||||||
|
|
@ -27,7 +28,7 @@ templ App(title string) {
|
||||||
@sidebar.MenuItem() {
|
@sidebar.MenuItem() {
|
||||||
@sidebar.MenuButton(sidebar.MenuButtonProps{
|
@sidebar.MenuButton(sidebar.MenuButtonProps{
|
||||||
Size: sidebar.MenuButtonSizeLg,
|
Size: sidebar.MenuButtonSizeLg,
|
||||||
Href: "/app/spaces",
|
Href: routeurl.URL("page.app.spaces"),
|
||||||
}) {
|
}) {
|
||||||
@icon.LayoutDashboard()
|
@icon.LayoutDashboard()
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
|
|
@ -45,8 +46,8 @@ templ App(title string) {
|
||||||
@sidebar.Menu() {
|
@sidebar.Menu() {
|
||||||
@sidebar.MenuItem() {
|
@sidebar.MenuItem() {
|
||||||
@sidebar.MenuButton(sidebar.MenuButtonProps{
|
@sidebar.MenuButton(sidebar.MenuButtonProps{
|
||||||
Href: "/app/spaces",
|
Href: routeurl.URL("page.app.spaces"),
|
||||||
IsActive: ctxkeys.URLPath(ctx) == "/app/spaces",
|
IsActive: ctxkeys.URLPath(ctx) == routeurl.URL("page.app.spaces"),
|
||||||
Tooltip: "Spaces",
|
Tooltip: "Spaces",
|
||||||
}) {
|
}) {
|
||||||
@icon.House(icon.Props{Class: "size-4"})
|
@icon.House(icon.Props{Class: "size-4"})
|
||||||
|
|
@ -114,7 +115,11 @@ templ App(title string) {
|
||||||
|
|
||||||
templ AppSidebarDropdown(user *model.User) {
|
templ AppSidebarDropdown(user *model.User) {
|
||||||
{{ displayName := user.Email }}
|
{{ displayName := user.Email }}
|
||||||
{{ if user.Name != nil && *user.Name != "" { displayName = *user.Name } }}
|
{{
|
||||||
|
if user.Name != nil && *user.Name != "" {
|
||||||
|
displayName = *user.Name
|
||||||
|
}
|
||||||
|
}}
|
||||||
@dropdown.Dropdown() {
|
@dropdown.Dropdown() {
|
||||||
@dropdown.Trigger() {
|
@dropdown.Trigger() {
|
||||||
@sidebar.MenuButton(sidebar.MenuButtonProps{
|
@sidebar.MenuButton(sidebar.MenuButtonProps{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue