Requirements, execution plan, functional design, code summaries, build and test results and the audit log; the reverse-engineering notes and the feature registry are updated. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
4.3 KiB
Domain Entities: testimonials (unit 2)
Entity relationships
graph TD
Testimonial["Testimonial"]
ContentImage["ContentImage"]
ImagePosition["ImagePosition, normalised"]
ShownList["Shown reviews"]
Counter["Counter text"]
SlideLabel["Slide label"]
CarouselState["Carousel state, owned by Chakra"]
Testimonial -->|"has one"| ContentImage
Testimonial -->|"may carry raw value for"| ImagePosition
Testimonial -->|"filtered into"| ShownList
ShownList -->|"sets the count of"| CarouselState
CarouselState -->|"index and count give"| Counter
CarouselState -->|"index and count give"| SlideLabel
classDef entity fill:#2196F3,stroke:#0d47a1,stroke-width:1px,color:#000;
classDef value fill:#FF9800,stroke:#e65100,stroke-width:1px,color:#000;
classDef external fill:#e9d5ff,stroke:#6b21a8,stroke-width:1px,color:#000;
class Testimonial,ContentImage,ShownList entity;
class ImagePosition,Counter,SlideLabel value;
class CarouselState external;
Text alternative: a Testimonial has one ContentImage and may carry a raw crop value that is normalised into an ImagePosition; the valid reviews form the shown list, which sets the count of Chakra's carousel state, and from that state's index and count come the counter text and the slide label (blue = entities, orange = derived values, purple = state owned by the library).
Testimonial (changed: one optional field)
| Field | Type | Required | Notes |
|---|---|---|---|
id |
string | yes | Unique among shown reviews (first wins, BR-REV-01) |
shoot |
string | yes | Shoot type shown above the quote |
quote |
string | yes | Plain text without quotation marks; the design adds none |
author |
string | yes | Names under the quote |
image |
ContentImage |
yes | src, width > 0, height > 0, alt |
imagePosition |
string | no (new) | Raw CSS object-position as two percentages, e.g. "50% 42%". Never trusted as given: it is passed through normalizeImagePosition before it reaches a style |
Invariants (isValidTestimonial, unchanged): id, shoot, quote, author and image.src are not blank; image.width and image.height are above zero. imagePosition is not part of validity: a missing, empty or garbled value never hides a review, it only falls back to the centre.
Content values: trouwshoot "50% 42%", newbornshoot not set (centre).
ImagePosition (derived value)
The normalised crop position, always of the form "X% Y%".
| Property | Rule |
|---|---|
| Accepted input | Two numbers, each followed by %, separated by whitespace; optional surrounding whitespace; digits with an optional decimal part; no sign, no exponent |
| Range | Each number from 0 up to and including 100 |
| Output | "X% Y%" where X and Y are the numbers rounded to at most two decimals and written without trailing zeros ("050.0% 42%" becomes "50% 42%"; "0.0000001%" becomes "0%", so no exponent form can appear), one space between. The range check is on the number as given ("100.001%" is out of range) |
| Fallback | Anything else (missing, empty, one number, no %, out of range, negative, extra parts, text): the centre, "50% 50%" (owner's answer A, question 4) |
| Idempotence | Normalising a normalised value gives the same value |
Counter text (derived value)
"X / Y" with X the current review (counted from 1) and Y the number of reviews.
| Property | Rule |
|---|---|
| Input | index (zero-based) and count (number of shown reviews) |
| Valid input | count is a whole number of at least 1 and index is a whole number from 0 up to count - 1 |
| Output | `${index + 1} / ${count}` |
| Invalid input | Never throws and never reads wrong: a count below 1 or not a finite number counts as 1; an index outside the range, or not a finite number, is moved to the nearest end (0 or count - 1); fractions are cut off. The result always has 1 <= X <= Y |
Slide label (unchanged)
slideLabel(index, count) gives "Review n van m" and names each slide and the announcement (BR-REV-08, BR-REV-09). The old dot labels "Review n" are removed together with the dots.
Carousel state
Owned by Chakra's carousel (page, pageSnapPoints, loop, scroll position). The unit does not keep its own copy of the current review: the counter and the announcement read the carousel's page and the shown count.