almost all ready

This commit is contained in:
2026-05-14 01:48:15 +02:00
parent 1b53c1c199
commit 2e1bec0e8b
29 changed files with 5442 additions and 642 deletions
+28 -25
View File
@@ -7,14 +7,14 @@ import (
)
templ CategoryPage(data viewmodel.CategoryPageData, cssPath string, jsPath string) {
@Layout(data.Category.Name, cssPath, jsPath, data.Menu, data.Locale) {
@Layout(data.Category.Name, cssPath, jsPath, data.Menu, data.Locale, layoutCartItems(data.CartSummary)) {
<main class="min-h-screen bg-[radial-gradient(circle_at_top_left,_rgba(34,197,94,0.18),_transparent_35%),linear-gradient(180deg,#0b1020,#111827)]">
<div class="mx-auto flex max-w-7xl flex-col gap-10 px-6 py-10 lg:px-8">
<div class="mx-auto flex w-full max-w-[104rem] flex-col gap-10 px-6 py-10 lg:px-8">
<header class="rounded-[2rem] border border-emerald-500/20 bg-white/5 p-8 backdrop-blur">
<p class="text-xs uppercase tracking-[0.32em] text-emerald-300">Category</p>
<h1 class="mt-4 font-serif text-4xl text-white">{ data.Category.Name }</h1>
<div class="mt-4 flex items-center justify-between gap-6 text-sm text-slate-300">
<p>{ fmt.Sprintf("Products loaded: %d", len(data.Category.Products)) }</p>
<p>{ fmt.Sprintf("Products %d-%d of %d", categoryPageStart(data.Pagination), categoryPageEnd(data.Pagination, len(data.Category.Products)), data.Pagination.TotalItems) }</p>
if data.Customer != nil {
<p>{ fmt.Sprintf("%s %s", data.Customer.FirstName, data.Customer.LastName) }</p>
} else {
@@ -28,14 +28,22 @@ templ CategoryPage(data viewmodel.CategoryPageData, cssPath string, jsPath strin
}
</header>
<section class="grid gap-5 md:grid-cols-2 xl:grid-cols-3">
<section class="grid gap-5 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4">
for _, product := range data.Category.Products {
<article class="group rounded-[1.75rem] border border-white/10 bg-slate-900/70 p-6 shadow-[0_24px_80px_rgba(0,0,0,0.35)] transition hover:-translate-y-1 hover:border-emerald-400/40">
if product.ImageURL != "" {
<a class="mb-5 block overflow-hidden rounded-[1.25rem] border border-white/10 bg-slate-950/70 shadow-[0_16px_40px_rgba(0,0,0,0.24)]" href={ product.URL }>
<img class="block h-64 w-full object-cover transition duration-500 group-hover:scale-[1.03]" src={ product.ImageURL } alt={ product.Name }/>
</a>
}
<p class="text-xs uppercase tracking-[0.28em] text-emerald-300">Product</p>
<h2 class="mt-3 text-2xl font-semibold text-white">{ product.Name }</h2>
<p class="mt-4 text-sm leading-7 text-slate-300">{ product.Description }</p>
<p class="mt-4 text-sm leading-7 text-slate-300">{ truncatedPlainTextHTML(product.ShortDescription, 220) }</p>
<div class="mt-8 flex items-center justify-between gap-4">
<p class="text-2xl font-semibold text-white">{ fmt.Sprintf("%.2f", product.Price) }</p>
<div>
<p class="text-2xl font-semibold text-white">{ moneyWithCurrency(product.PriceTaxIncl, product.CurrencySign, product.CurrencyCode) }</p>
<p class="mt-1 text-xs uppercase tracking-[0.2em] text-slate-400">{ taxLabel(product.TaxRate) } · { conversionRateLabel(product.ConversionRate, product.CurrencyCode) }</p>
</div>
<a class="rounded-full border border-emerald-400/40 px-4 py-2 text-xs font-semibold uppercase tracking-[0.22em] text-emerald-200 transition hover:bg-emerald-300 hover:text-slate-950" href={ product.URL }>
View Product
</a>
@@ -43,26 +51,21 @@ templ CategoryPage(data viewmodel.CategoryPageData, cssPath string, jsPath strin
</article>
}
</section>
if data.Session != nil {
<section class="rounded-[2rem] border border-white/10 bg-slate-950/70 p-8">
<p class="text-xs uppercase tracking-[0.28em] text-emerald-300">Go Cookie Debug</p>
<div class="mt-6 grid gap-6 lg:grid-cols-2">
<div>
<p class="text-sm font-semibold text-white">Raw Cookie</p>
<pre class="mt-3 overflow-x-auto rounded-2xl bg-black/30 p-4 text-xs leading-6 text-slate-300">{ data.Session.RawCookie }</pre>
</div>
<div>
<p class="text-sm font-semibold text-white">Decoded Values</p>
<pre class="mt-3 overflow-x-auto rounded-2xl bg-black/30 p-4 text-xs leading-6 text-slate-300">
for _, line := range sessionCookieLines(data.Session) {
{ line }
{"\n"}
}
</pre>
</div>
if data.Pagination.TotalPages > 1 {
<nav class="flex flex-col items-center justify-between gap-4 rounded-[1.75rem] border border-white/10 bg-slate-950/50 px-6 py-5 text-sm text-slate-300 md:flex-row">
<div>
<p class="text-xs uppercase tracking-[0.24em] text-emerald-300">Page</p>
<p class="mt-1">{ fmt.Sprintf("%d of %d", data.Pagination.Page, data.Pagination.TotalPages) }</p>
</div>
</section>
<div class="flex items-center gap-3">
if data.Pagination.PrevURL != "" {
<a class="rounded-full border border-white/10 px-4 py-2 font-semibold uppercase tracking-[0.2em] text-slate-200 transition hover:border-emerald-400/40 hover:text-white" href={ data.Pagination.PrevURL }>Previous</a>
}
if data.Pagination.NextURL != "" {
<a class="rounded-full border border-emerald-400/40 px-4 py-2 font-semibold uppercase tracking-[0.2em] text-emerald-200 transition hover:bg-emerald-300 hover:text-slate-950" href={ data.Pagination.NextURL }>Next</a>
}
</div>
</nav>
}
</div>
</main>