From 1f537ccb0635e8c9f1a8def3a5bcf95dafda2716 Mon Sep 17 00:00:00 2001 From: Marco Date: Tue, 25 Aug 2026 13:45:52 +0000 Subject: [PATCH] PasstDazu driven by Products.relatedProduct; circle back on Focus icons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - PasstDazu.tsx now takes a productSlug prop and reads its cross-sell target from the product's own relatedProduct field (Payload) instead of hardcoding "todo-karten" — reusable on any product page now. - payload.ts: Product/PayloadProduct gained relatedProduct, resolved via a bounded-recursion mapPayloadProduct call (safe — the fetch's depth:2 means the nested relation's own relatedProduct is never populated). - Focus.tsx icons: added the black stroked circle back around each glyph (matches icon-step-3.png exactly) — dropped in the previous pass by mistake while fixing the color/fill. --- app/der-eine/components/Focus.tsx | 26 ++++++++++++++------------ app/der-eine/components/PasstDazu.tsx | 24 +++++++++++++----------- app/der-eine/page.tsx | 2 +- app/lib/__tests__/cartTotals.test.ts | 1 + app/lib/payload.ts | 11 +++++++++++ 5 files changed, 40 insertions(+), 24 deletions(-) diff --git a/app/der-eine/components/Focus.tsx b/app/der-eine/components/Focus.tsx index 2db5a9a..193e5f0 100644 --- a/app/der-eine/components/Focus.tsx +++ b/app/der-eine/components/Focus.tsx @@ -1,14 +1,16 @@ import type { ReactNode } from "react"; import { Reveal, RevealGroup, RevealItem } from "../../components/Reveal"; -// Bold black outline, no fill, no container — matching /todo-cards' own -// icon language (tool-icon-todo-karten.png, icon-step-2.png/icon-step-3.png: -// thick uniform-weight black stroke, no color fill, no circle/badge -// wrapper), not the thinner colored-badge treatment tried first. +// Bold black outline, no fill, circled — matching /todo-cards' +// icon-step-3.png exactly (a stroked circle around the glyph, same +// uniform-weight black stroke as the glyph itself), not the plain +// uncircled version tried right before this, nor the orange-badge version +// tried before that. function IconBadge({ children }: { children: ReactNode }) { return ( - - {children} + + + {children} ); } @@ -16,8 +18,8 @@ function IconBadge({ children }: { children: ReactNode }) { function IconPencil() { return ( - - + + ); } @@ -25,8 +27,8 @@ function IconPencil() { function IconPen() { return ( - - + + ); } @@ -34,7 +36,7 @@ function IconPen() { function IconSparkle() { return ( - + ); } @@ -42,7 +44,7 @@ function IconSparkle() { function IconShield() { return ( - + ); } diff --git a/app/der-eine/components/PasstDazu.tsx b/app/der-eine/components/PasstDazu.tsx index 94f86cd..e9709bd 100644 --- a/app/der-eine/components/PasstDazu.tsx +++ b/app/der-eine/components/PasstDazu.tsx @@ -6,23 +6,25 @@ import { getProductBySlug } from "../../lib/payload"; // Replaces the page's final price/buy bar entirely (explicit choice — // Hero.tsx already has the primary buy CTA, this page doesn't need a // second one at the very bottom too). Same "Passend dazu" card markup as -// blog/[slug]/page.tsx's own related-product card (that one is driven by -// Posts.relatedProduct, a per-post CMS field; this page hardcodes -// "todo-karten" directly, same as Hero.tsx already hardcodes -// "stift-kugelschreiber" — a fixed cross-sell, not a general relation). -export async function PasstDazu() { - const product = await getProductBySlug("todo-karten"); - if (!product?.href) return null; +// blog/[slug]/page.tsx's own related-product card. Driven by +// Products.relatedProduct (2026-08-25, same field/pattern as +// Posts.relatedProduct, just product->product instead of post->product) — +// reusable on any product page by passing that page's own product slug, +// not hardcoded to "todo-karten" like the first version of this component. +export async function PasstDazu({ productSlug }: { productSlug: string }) { + const product = await getProductBySlug(productSlug); + const related = product?.relatedProduct; + if (!related?.href) return null; return (
- +

Passt dazu:

@@ -32,9 +34,9 @@ export async function PasstDazu() { className="font-semibold text-[1.375rem] text-text-primary sm:whitespace-nowrap" style={{ fontFamily: "var(--font-lora)" }} > - {product.name} + {related.name}

-

{product.description}

+

{related.description}

Entdecken diff --git a/app/der-eine/page.tsx b/app/der-eine/page.tsx index 965107c..9eb1dde 100644 --- a/app/der-eine/page.tsx +++ b/app/der-eine/page.tsx @@ -44,7 +44,7 @@ export default async function DerEinePage() {
- +