Refreshes the shared reverse engineering docs, adds the requirements, application design and units for the homepage-sections feature, and updates the static design: live prices and form fields, the new Lieve woorden block and the coming-soon gate over the contact form. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
54 lines
3.4 KiB
Markdown
54 lines
3.4 KiB
Markdown
# Services — homepage-sections
|
|
|
|
The site has no back-end; "services" here are the front-end mechanisms that provide content, connect sections and will later talk to the API.
|
|
|
|
## 1. Content provisioning
|
|
- **Responsibility**: deliver section content to the components.
|
|
- **Today**: static modules `content/homeContent.ts`, `content/packages.ts`, `content/testimonials.ts` and the existing `content/siteContent.ts`, imported by `routes/index.tsx` and passed down as props. Images are imported from `web/src/assets` (Vite-hashed URLs, typed as `ContentImage`).
|
|
- **Later**: the same shapes come from the .NET API (`/api/pages`, `/api/packages`, testimonials and the Instagram feed server-side) through a route loader; components do not change.
|
|
- **Rule**: components never import content modules directly — only the route does. Keeps them testable with generated content.
|
|
|
|
## 2. Package handover (Prijzen → Contact)
|
|
- **Responsibility**: "Boek je shoot" brings the visitor to the form with the package chosen (design Q4 = A).
|
|
- **Flow**: `PriceCard` renders a router `Link` to `/` with `search={{ pakket: pkg.id }}` and `hash="contact"`. The `/` route's `validateSearch` keeps `pakket` as an optional string; the page resolves it with `packageFromSearch` against the package list (unknown values are ignored) and passes it to `ContactSection` → `ContactForm` as `initialShoot`. The router scrolls to `#contact`.
|
|
- **Properties**: survives a reload, shareable, no shared mutable state between sections.
|
|
|
|
## 3. Contact submission adapter
|
|
- **Responsibility**: the only place that sends a contact request.
|
|
- **Today**: `submitContactForm` rejects with a generic error; with `contactForm.enabled = false` it is never reached because the form is inert.
|
|
- **Later (API feature)**: `POST /api/contact` with `ContactPayload` plus the Friendly Captcha token; server-side validation, spam checks and rate limiting; CSP additions for Friendly Captcha.
|
|
- **Switch**: `siteContent.contactForm.enabled` (design Q5 = A) — can be turned on and off again; later deliverable by the CMS.
|
|
|
|
## 4. Spam filtering (browser side)
|
|
- **Responsibility**: drop obvious bot submissions before they reach the adapter.
|
|
- **Flow**: on submit, after validation, `isLikelySpam({ honeypot, shownAt, now })`; spam gets the normal success message and nothing is sent.
|
|
|
|
## 5. Scroll reveal
|
|
- **Responsibility**: fade sections in as they enter the viewport (`useReveal` + `Reveal`), disabled under reduced motion.
|
|
|
|
## Orchestration
|
|
|
|
```mermaid
|
|
sequenceDiagram
|
|
box rgba(246,224,94,0.4) Visitor
|
|
participant V as Visitor
|
|
end
|
|
box rgba(99,179,237,0.4) Homepage
|
|
participant P as PriceCard
|
|
participant R as Route /
|
|
participant C as ContactForm
|
|
participant A as submitContactForm
|
|
end
|
|
V->>P: Click Boek je shoot (Newborn)
|
|
P->>R: Navigate to /?pakket=newborn#contact
|
|
R->>R: packageFromSearch checks the id
|
|
R->>C: initialShoot newborn, scroll to contact
|
|
V->>C: Fill in and submit
|
|
C->>C: validateContact, isLikelySpam
|
|
C->>A: ContactPayload (only when enabled and not spam)
|
|
A-->>C: Resolved or generic error
|
|
C-->>V: Status message
|
|
```
|
|
|
|
Text alternative: clicking "Boek je shoot" navigates to the homepage with the package in the URL; the route checks it and preselects it in the form; on submit the form validates and filters spam before calling the single submission adapter and showing a status message.
|