Pure logica (splitsen, chips, filter, labels), useSwipeRow en usePackageFilter, ContactPreselect voor het formulier, kaarten in stijl B en tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2.4 KiB
2.4 KiB
Domain Entities — packages-block (U3)
graph TD
API[GET api v1 offerings] -->|"array of"| PK[PackageCardData]
PK -->|"optional"| CAT[category name or null]
PK -->|"flag"| FEA[featured]
CFG[Site settings bannerSlugs] -->|"selects"| BAN[Banner package]
PK -->|"split by settings"| CARDS[Card packages]
PK -->|"split by settings"| BAN
CARDS -->|"derives"| CHIPS[FilterChip list]
CHIPS -->|"active id"| VIS[Visible cards]
VIS --> ROW[Grid or swipe row]
ROW -->|"CTA click"| PRE[Preselect subject and key]
classDef data fill:#63b3ed,stroke:#2b6cb0,color:#000;
classDef derived fill:#9ae6b4,stroke:#2f855a,color:#000;
classDef cfg fill:#f6e05e,stroke:#c05621,color:#000;
class API,PK,CAT,FEA data;
class CARDS,BAN,CHIPS,VIS,ROW,PRE derived;
class CFG cfg;
Text alternative: offerings from the API are split into card packages and banner packages by a site setting; the cards produce filter chips, the active chip selects the visible cards shown in a grid or swipe row; a card button creates a preselect for the contact form.
PackageCardData (extended)
| Field | Type | Notes |
|---|---|---|
id, slug, title, description, price, priceNote, features[], ctaLabel, featured? |
as before | price is rendered verbatim |
category? |
string | null |
category name from the CMS (CMS-U1); null/absent = no chip |
categoryId?, displayOrder? |
additive CMS fields | ignored by the UI |
Site settings (content.ts)
| Setting | Type | Default | Meaning |
|---|---|---|---|
packagesSettings.bannerSlugs |
string[] |
[] |
packages shown as the black "Past er niets bij?" banner instead of a card. SLP: empty (Maatwerk is a card); Andrea-style sites may list maatwerk |
packagesSettings.chipThreshold |
number |
4 |
chips appear when the number of card packages is at least this (FR-8) |
packagesSettings.bannerFallback |
{ title, text, priceLabel, priceNote, ctaLabel } |
design texts | used only when bannerSlugs is non-empty and no package matches |
FilterChip (derived)
{ id: 'all' | categoryName, label, count }; "Alles" first; categories in order of first appearance among card packages; counts only count card packages; packages without category appear only under "Alles".
Preselect (shared with U4)
ContactPreselect { subject: string | null; key: number }: subject = package slug; key increments on every CTA click.