package pages import ( "fmt" "reichard.io/antholume/ngtemplates/svgs" "strings" ) type Route string var ( RouteHome Route = "HOME" RouteDocuments Route = "DOCUMENTS" RouteProgress Route = "PROGRESS" RouteActivity Route = "ACTIVITY" RouteSearch Route = "SEARCH" RouteAdmin Route = "ADMIN" RouteAdminImport Route = "ADMIN_IMPORT" RouteAdminUsers Route = "ADMIN_USERS" RouteAdminLogs Route = "ADMIN_LOGS" ) func (r Route) IsAdmin() bool { return strings.HasPrefix("ADMIN", string(r)) } func (r Route) Name() string { var pathSplit []string for _, rawPath := range strings.Split(string(r), "_") { pathLoc := strings.ToUpper(rawPath[:1]) + strings.ToLower(rawPath[1:]) pathSplit = append(pathSplit, pathLoc) } return strings.Join(pathSplit, " - ") } func getNavigationLinkClass(isActive bool) string { defaultClass := "flex items-center justify-start w-full p-2 pl-6 my-2 transition-colors duration-200 border-l-4" if isActive { return fmt.Sprintf("%s border-purple-500 dark:text-white", defaultClass) } else { return fmt.Sprintf("%s border-transparent text-gray-400 hover:text-gray-800 dark:hover:text-gray-100", defaultClass) } } type Settings struct { Route Route User string Version string IsAdmin bool SearchEnabled bool } templ navigation(settings Settings, header templ.Component) {

@header

@svgs.UserSVG("size-5")
} templ layout(settings Settings, title string) { AnthoLume - { title } @navigation(settings)
{ children... }
}