package baseview import ( "context" "git.haelnorr.com/h/oslstats/internal/contexts" "git.haelnorr.com/h/oslstats/internal/db" ) type NavItem struct { Name string Href string } type ProfileItem struct { Name string Href string } // Main navigation items (centralized) func getNavItems() []NavItem { return []NavItem{ {Name: "Seasons", Href: "/seasons"}, } } // Profile dropdown items (context-aware for admin) func getProfileItems(ctx context.Context) []ProfileItem { items := []ProfileItem{ {Name: "Profile", Href: "/profile"}, {Name: "Account", Href: "/account"}, } cache := contexts.Permissions(ctx) if cache != nil && cache.Roles["admin"] { items = append(items, ProfileItem{ Name: "Admin Panel", Href: "/admin", }) } return items } // Main navbar component templ Navbar() { {{ navItems := getNavItems() }} {{ user := db.CurrentUser(ctx) }} {{ profileItems := getProfileItems(ctx) }}