A paragraph with links is stored as text pieces and typed route links, so the API can deliver it without HTML. On the about page, Andrea becomes a Person with her specialisations, linked both ways to the business that every page already describes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4.4 KiB
Business Logic Model — Unit 2: Over mij page
The page has no runtime decisions beyond rendering static content; the logic lives in the head (SEO) and in small pure functions.
Request Flow
sequenceDiagram
box rgba(33,150,243,0.3) Router
participant Root as Root route
participant Route as Over mij route
end
box rgba(255,152,0,0.3) Pure modules
participant Seo as seo.ts
participant Reg as sitePages.ts
end
box rgba(76,175,80,0.3) Data
participant Site as siteContent
participant About as aboutContent
end
Root->>Seo: siteHead with siteContent
Seo-->>Root: meta and ProfessionalService script with ids
Route->>Seo: pageHead for over-mij
Seo->>Reg: read title, description, indexed, ogImage
Seo-->>Route: meta and canonical
Route->>Seo: aboutPage with path, person content and siteContent
Seo-->>Route: AboutPage with Person
Route->>Seo: structuredDataScript
Seo-->>Route: escaped ld+json script
Route->>About: read static content
Route-->>Root: head tags and rendered page
Text alternative: the root route adds the site-wide head and business data; the Over mij route gets its meta tags from the registry, builds the AboutPage/Person data from its content and the site data, serialises it safely, and renders the page from static content.
Pure Functions and Properties (PBT-01)
| Function | Category | Property (fast-check) |
|---|---|---|
professionalService(site) |
Invariant | @id === businessId and founder['@id'] === personId for any SiteContent |
person(content, site, image) |
Invariant | sameAs equals visibleSocials(site.socials).map(href) (absent when empty) for any socials incl. invalid hrefs |
person(...) |
Invariant | worksFor['@id'] === businessId |
knowsAboutList(entries) (helper in lib/) |
Invariant | output ⊆ trimmed input, no empty strings, no duplicates, keeps first-seen order |
knowsAboutList |
Idempotency | f(f(x)) deep-equals f(x) |
aboutPage(path, ...) |
Invariant | serialised output never contains the assembled e-mail address, for any valid EmailAddress in siteContent |
aboutPage(path, ...) |
Invariant | @id/url equal canonicalUrl(path); name/description equal the registry entry |
jsonLdScript(x) |
Round-trip | already covered: JSON.parse(jsonLdScript(x)) deep-equals x; no </> in output |
Generators: reuse socialLink, validEmail/anyEmail from src/test/arbitraries.ts; add a siteContent arbitrary and a knowsAbout arbitrary (strings with surrounding spaces, empties and duplicates).
Example-based tests complement these: the real content produces the expected Person (name, job title, three specialisations, Instagram and Facebook), and the head of /over-mij contains no noindex, the new title, canonical and og:image.
Rendering Logic
graph TD
Route["Over mij route"] --> Head["PageIntro: eyebrow + h1"]
Route --> Intro["AboutIntro: MediaText with portrait"]
Intro --> Paras{"Paragraph piece is a link?"}
Paras -->|"yes"| Link["underlined RouterLink to route and hash"]
Paras -->|"no"| Txt["plain text"]
Route --> Bg["StorySection: background, tone alt"]
Route --> Duo["PhotoDuo: two photos, not a named region"]
Route --> Pers["StorySection: personal, flush top"]
Pers --> Btn["LinkButton accent: Boek je shoot"]
classDef route fill:#4CAF50,stroke:#2e7d32,color:#000;
classDef ui fill:#2196F3,stroke:#0d47a1,color:#000;
classDef decision fill:#FF9800,stroke:#e65100,color:#000;
class Route route;
class Head,Intro,Link,Txt,Bg,Duo,Pers,Btn ui;
class Paras decision;
Text alternative: the route renders the page head, the intro (whose paragraphs render text pieces as text and link pieces as underlined router links), the background story, the photo duo, and the personal story ending in the booking button.
Navigation to /#contact
Uses the existing mechanism of the price cards (RouterLink with to="/" and hash="contact"): the router navigates to the homepage and scrolls to #contact; PageSection gives that section a scroll margin of the sticky header height. No new logic; covered by a route test that the link targets /#contact.
Error Handling
- Static content only: no loading or error states. Invalid optional data degrades by omission (BR-SD-02, BR-SD-05), never by an error.
- A missing image file or a wrong route is a build/type error, not a runtime case.