Files
AndreaSlopFotografie/aidlc-docs/features/homepage-sections/construction/lieve-woorden/functional-design/business-logic-model.md
T
SluijsensandClaude Opus 5.5 cb6a9b07f9 Adds the Lieve woorden section to the homepage
Shows client reviews one at a time with the framed photo, a large
quotation mark, the shoot type and the names. Uses Chakra's carousel for
paging, looping and swiping with our own controls, so visitors who
prefer reduced motion get instant changes, and loads the carousel only
when the section comes near the screen so the hero does not wait for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 01:52:41 +02:00

2.4 KiB

Business Logic Model — Unit 4: Lieve woorden

Navigation flow

sequenceDiagram
    box rgba(246,224,94,0.4) Visitor
      participant V as Visitor
    end
    box rgba(99,179,237,0.4) Testimonials
      participant C as Carousel
      participant L as LiveRegion
    end
    V->>C: Next button, dot, arrow key or swipe
    C->>C: Compute target page, looping at the ends
    C->>C: Scroll to the target slide, instantly under reduced motion
    C->>L: Page changed to n
    L-->>V: Announces Review n van m

Text alternative: a navigation action makes the carousel compute the target page (looping), scroll to it (instantly under reduced motion) and report the new page to a polite live region, which announces "Review n van m".

The carousel state (current page, scrolling, dragging, looping) is Chakra's Carousel (Ark UI); this unit does not reimplement it. Our own logic is limited to the pure functions below and wiring onPageChange to the live region.

Pure functions (web/src/lib/)

Function Input → output Rules
visibleTestimonials(items: Testimonial[]): Testimonial[] raw list → shown list BR-REV-01
slideLabel(index: number, count: number): string (1, 2) → 'Review 2 van 2' (index is zero-based) BR-REV-08/09

Testable properties (PBT-01)

Function Category Property
visibleTestimonials Invariant Every result meets the invariants; ids unique
visibleTestimonials Invariant Result is a subsequence of the input
visibleTestimonials Idempotency Applying it twice equals applying it once
visibleTestimonials Oracle Valid, unique input comes back unchanged
slideLabel Round-trip The two numbers parsed back from the label are index + 1 and count
slideLabel Invariant For 0 ≤ index < count the label has the form Review n van m with 1 ≤ n ≤ m

The looping and paging itself is Chakra's (tested upstream); our component tests cover the behaviour at our boundary: loop from last to first, announcement text, controls hidden for one review, nothing rendered for none. PBT-06 (stateful) is N/A because the state machine is not ours.

Generators (PBT-07) in src/test/arbitraries.ts: testimonial (valid; slug ids, non-blank texts, image with positive size), uniqueTestimonials, anyTestimonial (incl. blank quote/author/shoot, empty src, zero size, duplicate ids).