flatter html

This commit is contained in:
bronkuu 2026-06-15 20:15:12 +02:00
parent cf2e217030
commit a74c276cd3
11 changed files with 84 additions and 107 deletions

View file

@ -74,7 +74,7 @@ func (h *Server) orders(r *http.Request) (templ.Component, int, error) {
if err != nil {
return nil, http.StatusInternalServerError, err
}
return templates.MainContent("Panel główny", templates.DateForm(firstStr, lastStr, today, tomorrow, specialFilter), templates.OrdersMain(counts, cakeCounts, orders, firstStr, lastStr, specialFilter)), http.StatusOK, nil
return templates.MainContent("Panel główny", templates.OrdersMain(counts, cakeCounts, orders, firstStr, lastStr, specialFilter, today, tomorrow)), http.StatusOK, nil
}
if r.Header.Get("HX-Request") == "true" {
@ -100,7 +100,7 @@ func (h *Server) cakes(r *http.Request) (templ.Component, int, error) {
}
if r.Header.Get("HX-Request") == "true" {
return templates.MainContent("Katalog", templ.NopComponent, templates.CakesMain(cakes, tags)), http.StatusOK, nil
return templates.MainContent("Katalog", templates.CakesMain(cakes, tags)), http.StatusOK, nil
}
return templates.CakesPage(cakes, tags), http.StatusOK, nil
@ -114,7 +114,7 @@ func (h *Server) cake(r *http.Request) (templ.Component, int, error) {
return nil, http.StatusInternalServerError, err
}
if r.Header.Get("HX-Request") == "true" {
return templates.MainContent("Ciasto nowe", templ.NopComponent, templates.CakeForm(models.Cake{}, tags)), http.StatusOK, nil
return templates.MainContent("Ciasto nowe", templates.CakeForm(models.Cake{}, tags)), http.StatusOK, nil
}
return templates.CakePage(models.Cake{}, tags), http.StatusOK, nil
}
@ -135,7 +135,7 @@ func (h *Server) cake(r *http.Request) (templ.Component, int, error) {
}
if r.Header.Get("HX-Request") == "true" {
return templates.MainContent(templates.CakeTitle(data), templ.NopComponent, templates.CakeForm(data, tags)), http.StatusOK, nil
return templates.MainContent(templates.CakeTitle(data), templates.CakeForm(data, tags)), http.StatusOK, nil
}
return templates.CakePage(data, tags), http.StatusOK, nil
@ -148,7 +148,7 @@ func (h *Server) blocked(r *http.Request) (templ.Component, int, error) {
}
if r.Header.Get("HX-Request") == "true" {
return templates.MainContent("Terminy zablokowane", templ.NopComponent, templates.BlockedMain(dates)), http.StatusOK, nil
return templates.MainContent("Terminy zablokowane", templates.BlockedMain(dates)), http.StatusOK, nil
}
return templates.BlockedPage(dates), http.StatusOK, nil
@ -171,7 +171,7 @@ func (h *Server) order(r *http.Request) (templ.Component, int, error) {
url := strings.Split(r.URL.Path, "/")
if len(url) < 3 || url[2] == "" {
if r.Header.Get("HX-Request") == "true" {
return templates.MainContent("Nowe zamówienie", templ.NopComponent, templates.OrderForm(models.Order{Date: time.Now()}, catalogue, tags, blockedDates)), http.StatusOK, nil
return templates.MainContent("Nowe zamówienie", templates.OrderForm(models.Order{Date: time.Now()}, catalogue, tags, blockedDates)), http.StatusOK, nil
}
return templates.OrderPage(models.Order{Date: time.Now()}, catalogue, tags, blockedDates), http.StatusOK, nil
}
@ -187,7 +187,7 @@ func (h *Server) order(r *http.Request) (templ.Component, int, error) {
}
if r.Header.Get("HX-Request") == "true" {
return templates.MainContent(templates.OrderTitle(order), templ.NopComponent, templates.OrderForm(order, catalogue, tags, blockedDates)), http.StatusOK, nil
return templates.MainContent(templates.OrderTitle(order), templates.OrderForm(order, catalogue, tags, blockedDates)), http.StatusOK, nil
}
return templates.OrderPage(order, catalogue, tags, blockedDates), http.StatusOK, nil