From 89b1ce85d6b13ce96b2431bbdf7af00be2f23495 Mon Sep 17 00:00:00 2001 From: Henrique Miranda Date: Sun, 8 Sep 2024 20:33:44 -0300 Subject: [PATCH] display active path --- cmd/main.go | 2 +- web/handler/client.go | 2 +- web/handler/home.go | 2 +- web/view/client/clients.templ | 4 +-- web/view/employee/employee_create.templ | 2 +- web/view/employee/employee_list.templ | 38 ++++++++++++++++++++++++- web/view/home/homepage.templ | 6 ++-- web/view/layout/dashboard.templ | 35 ++++++++++++----------- 8 files changed, 64 insertions(+), 27 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index e569949..5aea004 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -27,7 +27,7 @@ func main() { server := http.NewServeMux() homeHandler := handler.NewHomeHandler() - server.HandleFunc("/", homeHandler.HomePage) + server.HandleFunc("/dashboard", homeHandler.HomePage) clientHandler := handler.NewClientHandler() server.HandleFunc("GET /clients", clientHandler.ClientsPage) diff --git a/web/handler/client.go b/web/handler/client.go index b766bbd..d85a44d 100644 --- a/web/handler/client.go +++ b/web/handler/client.go @@ -14,5 +14,5 @@ func NewClientHandler() ClientHandler { } func (h ClientHandler) ClientsPage(w http.ResponseWriter, r *http.Request) { - web.Render(w, r, http.StatusOK, client.ClientsPage()) + web.RenderPage(w, r, client.ClientsPage) } diff --git a/web/handler/home.go b/web/handler/home.go index fd82e4a..7d59ac8 100644 --- a/web/handler/home.go +++ b/web/handler/home.go @@ -14,5 +14,5 @@ func NewHomeHandler() HomeHandler { } func (h HomeHandler) HomePage(w http.ResponseWriter, r *http.Request) { - web.Render(w, r, http.StatusOK, home.HomePage()) + web.RenderPage(w, r, home.HomePage) } diff --git a/web/view/client/clients.templ b/web/view/client/clients.templ index 195cd32..c44e29b 100644 --- a/web/view/client/clients.templ +++ b/web/view/client/clients.templ @@ -5,8 +5,8 @@ import ( "github.com/henriquepw/imperium-tattoo/web/view/ui" ) -templ ClientsPage() { - @layout.Dashbaord("Painel", "clients", false) { +templ ClientsPage(boosted bool) { + @layout.Dashbaord("Painel", boosted) { @layout.PageHeader( "Clientes", []ui.BreadcrumbItem{ diff --git a/web/view/employee/employee_create.templ b/web/view/employee/employee_create.templ index 23237a3..e6a75a6 100644 --- a/web/view/employee/employee_create.templ +++ b/web/view/employee/employee_create.templ @@ -7,7 +7,7 @@ import ( ) templ EmployeeCreatePage(boosted bool) { - @layout.Dashbaord("Novo Profissional", "employees", boosted) { + @layout.Dashbaord("Novo Profissional", boosted) {
@layout.PageHeader( "Novo Profissional", diff --git a/web/view/employee/employee_list.templ b/web/view/employee/employee_list.templ index 7157e9c..b40c405 100644 --- a/web/view/employee/employee_list.templ +++ b/web/view/employee/employee_list.templ @@ -12,8 +12,44 @@ templ badge(role string, classname ...string) { } +templ EmployeesLoading(boosted bool) { + @layout.Dashbaord("Funcionários", boosted) { +
+ @layout.PageHeader("Funcionários", []ui.BreadcrumbItem{ + {Label: "Funcionários", Href: "/employees"}, + }) { + + @ui.Icon("plus") + + } +
+ + + + + + + + + + + + for range 4 { + + + + } + +
Funcionário
+
+
+
+
+ } +} + templ EmployeesPage(boosted bool, items []types.Employee) { - @layout.Dashbaord("Funcionários", "employees", boosted) { + @layout.Dashbaord("Funcionários", boosted) {
@layout.PageHeader("Funcionários", []ui.BreadcrumbItem{ {Label: "Funcionários", Href: "/employees"}, diff --git a/web/view/home/homepage.templ b/web/view/home/homepage.templ index 20a5620..04a7fce 100644 --- a/web/view/home/homepage.templ +++ b/web/view/home/homepage.templ @@ -5,12 +5,12 @@ import ( "github.com/henriquepw/imperium-tattoo/web/view/ui" ) -templ HomePage() { - @layout.Dashbaord("Painel", "home", false) { +templ HomePage(boosted bool) { + @layout.Dashbaord("Painel", boosted) { @layout.PageHeader( "Painel", []ui.BreadcrumbItem{ - {Label: "Painel", Href: "/"}, + {Label: "Painel", Href: "/dashboard"}, }, )
diff --git a/web/view/layout/dashboard.templ b/web/view/layout/dashboard.templ index 295f5ac..687837a 100644 --- a/web/view/layout/dashboard.templ +++ b/web/view/layout/dashboard.templ @@ -1,14 +1,17 @@ package layout -import "github.com/henriquepw/imperium-tattoo/web/view/ui" +import ( + "fmt" + "github.com/henriquepw/imperium-tattoo/web/view/ui" +) -templ Dashbaord(title, route string, boosted bool) { +templ Dashbaord(title string, boosted bool) { if boosted { { children... } } else { @Base(title) {
} } } -templ item(label, icon, href string, active bool) { +templ item(label, icon, href string) { { label } @@ -65,7 +66,7 @@ templ PageHeader(title string, breadcrumb []ui.BreadcrumbItem) {