flattening

This commit is contained in:
bronkuu 2026-06-16 11:19:43 +02:00
parent e829562062
commit 5610b28254
3 changed files with 95 additions and 128 deletions

View file

@ -82,7 +82,7 @@ func (h *Server) orders(r *http.Request) (templ.Component, int, error) {
}
if r.Header.Get("HX-Request") == "true" {
return templates.OrdersContent(orders, cakeCounts, specialCakes, firstStr, lastStr, specialFilter), http.StatusOK, nil
return templates.MainContent("Panel główny", templates.OrdersContent(orders, cakeCounts, specialCakes, firstStr, lastStr, specialFilter)), http.StatusOK, nil
}
counts, err := h.s.GetOrderCounts()

View file

@ -2,28 +2,20 @@ body {
display: grid;
grid-template-rows: var(--topnav-h) 1fr;
height: 100dvh;
}
.topnav {
> header {
display: flex;
align-items: center;
justify-content: end;
gap: var(--space-md);
padding: 0 var(--space-lg);
border-bottom: 1px solid var(--outline-dim);
background: var(--surface);
z-index: 30;
}
.topnav > h1 {
margin-right: auto;
}
.topnav > nav {
> nav {
display: flex;
gap: var(--space-xs);
}
.topnav > nav > a {
a {
display: flex;
align-items: center;
gap: var(--space-sm);
@ -33,15 +25,14 @@ body {
font-weight: 500;
color: var(--on-surface-dim);
text-decoration: none;
}
.topnav > nav > a.active {
&.active {
background: var(--primary-container);
color: var(--primary);
font-weight: 700;
}
.topnav > .cta {
}
}
}
> .cta {
display: flex;
align-items: center;
gap: var(--space-sm);
@ -56,6 +47,8 @@ body {
cursor: pointer;
text-decoration: none;
flex-shrink: 0;
}
}
}
main {

View file

@ -6,7 +6,7 @@ templ Layout(title string, main templ.Component) {
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>{ title } — Zamówienia ciast</title>
<title>Zamówienia ciast</title>
<link rel="stylesheet" href="/static/fonts/inter.css"/>
<link rel="stylesheet" href="/static/fonts/material.css"/>
<link rel="stylesheet" href="/static/style.css"/>
@ -14,62 +14,36 @@ templ Layout(title string, main templ.Component) {
<script src="/static/order.js"></script>
</head>
<body>
<header class="topnav">
<h1>{ title }</h1>
<header>
<nav>
<a href="/orders" hx-get="/orders" hx-target="#main" hx-swap="outerHTML" hx-push-url="true">
<a href="/orders" hx-boost="true" hx-target="main" hx-select="main" hx-select-oob="title" hx-swap="outerHTML">
<span class="material-symbols-outlined">dashboard</span>
<span>Panel główny</span>
</a>
<a href="/cakes" hx-get="/cakes" hx-target="#main" hx-swap="outerHTML" hx-push-url="true">
<a href="/cakes" hx-boost="true" hx-target="main" hx-select="main" hx-select-oob="title" hx-swap="outerHTML">
<span class="material-symbols-outlined">inventory_2</span>
<span>Katalog</span>
</a>
<a href="/blocked" hx-get="/blocked" hx-target="#main" hx-swap="outerHTML" hx-push-url="true">
<a href="/blocked" hx-boost="true" hx-target="main" hx-select="main" hx-select-oob="title" hx-swap="outerHTML">
<span class="material-symbols-outlined">event_busy</span>
<span>Terminy zablokowane</span>
</a>
</nav>
<a href="/order" class="cta" hx-get="/order" hx-target="#main" hx-swap="outerHTML" hx-push-url="true">
<a href="/order" class="cta" hx-boost="true" hx-target="main" hx-select="main" hx-select-oob="title" hx-swap="outerHTML">
<span class="material-symbols-outlined">add</span>
<span>Nowe zamówienie</span>
</a>
</header>
<main id="main">
<div class="main-content">
<main>
@main
</div>
</main>
</body>
</html>
}
templ MainContent(title string, main templ.Component) {
<header class="topnav" hx-swap-oob="true">
<h1>{ title }</h1>
<nav>
<a href="/orders" hx-get="/orders" hx-target="#main" hx-swap="outerHTML" hx-push-url="true">
<span class="material-symbols-outlined">dashboard</span>
<span>Panel główny</span>
</a>
<a href="/cakes" hx-get="/cakes" hx-target="#main" hx-swap="outerHTML" hx-push-url="true">
<span class="material-symbols-outlined">inventory_2</span>
<span>Katalog</span>
</a>
<a href="/blocked" hx-get="/blocked" hx-target="#main" hx-swap="outerHTML" hx-push-url="true">
<span class="material-symbols-outlined">event_busy</span>
<span>Terminy zablokowane</span>
</a>
</nav>
<a href="/order" class="cta" hx-get="/order" hx-target="#main" hx-swap="outerHTML" hx-push-url="true">
<span class="material-symbols-outlined">add</span>
<span>Nowe zamówienie</span>
</a>
</header>
<main id="main">
<title hx-swap-oob="true">{ title } — Zamówienia ciast</title>
<div class="main-content">
<title>{ title }</title>
<main>
@main
</div>
</main>
}