# Business Rules — Unit 2: Shared contact blocks Answers: [shared-contact-blocks-fd-questions.md](../../plans/shared-contact-blocks-fd-questions.md) (Q1 A, Q2 A, Q3 B, Q4 A). ## Contact channels (`ContactDetails`) | Id | Rule | |---|---| | BR-CD-01 | The card lists the e-mail channel first, then the social links in the order of the content. *Q1 = A* | | BR-CD-02 | The e-mail channel exists only when `emailAddress()` gives a valid address. Its link text is the address; its link is `mailto:` with the subject "Vraag via andreaslop.nl" (`mailSubject()`). The address is assembled in the browser only. | | BR-CD-03 | A social channel exists only for links that `visibleSocials()` keeps (valid https). Invalid links are skipped; the order of the rest is kept. | | BR-CD-04 | A social channel's link text is its `label` after trimming; an empty or missing label falls back to the platform name ("Instagram", "Facebook"). *Q2 = A* | | BR-CD-05 | Social channels open in a new tab with `rel="noopener noreferrer"` and the visually hidden text "(opent in nieuw tabblad)", as in the footer. The e-mail channel opens in the same tab. | | BR-CD-06 | No valid channel → the card is not rendered at all (no empty heading). | | BR-CD-07 | Each channel shows its icon (platform icon or mail icon), hidden from assistive technology. | | BR-CD-08 | Hover: the link text turns to the accent colour; the icon keeps its own colour; no underline. Keyboard focus: the theme focus ring. Each row is at least 44 px high. *Q4 = A* | ```mermaid graph TD Start(["Site content"]) --> E{"Valid e-mail address?"} E -->|"yes"| AddE["Add e-mail channel first"] E -->|"no"| S AddE --> S["Take social links in content order"] S --> V{"Valid https link?"} V -->|"no"| Skip["Skip it"] V -->|"yes"| L{"Non-empty label?"} L -->|"yes"| UseL["Link text = label"] L -->|"no"| UseN["Link text = platform name"] UseL --> Next["Next link"] UseN --> Next Skip --> Next Next --> Any{"Any channel?"} Any -->|"no"| None(["Render nothing"]) Any -->|"yes"| Card(["Render the card"]) classDef start fill:#CE93D8,stroke:#6A1B9A,stroke-width:1px,color:#000; classDef decision fill:#FFF59D,stroke:#F57F17,stroke-width:1px,color:#000; classDef step fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000; class Start,None,Card start; class E,V,L,Any decision; class AddE,S,Skip,UseL,UseN,Next step; ``` Text alternative: a valid e-mail address becomes the first channel; each social link in content order is skipped when its link is invalid, otherwise it becomes a channel with its label or the platform name; the card is rendered only when at least one channel exists. ## Privacy line | Id | Rule | |---|---| | BR-PR-01 | The text "Lees in de privacyverklaring wat ik met je gegevens doe." with "privacyverklaring" as an underlined router link to `/privacyverklaring`. | | BR-PR-02 | Shown under the submit button inside `ContactForm` (every form that uses it). | | BR-PR-03 | While the form is gated, the same line is also shown under the "Binnenkort" notice, so it can be read and followed now. *Q3 = B* | | BR-PR-04 | One shared component renders the line in both places, so the text and link never drift apart. | ## Reply time | Id | Rule | |---|---| | BR-RT-01 | The thank-you message is "Bedankt voor je bericht! Ik reageer binnen {replyTime}." with `replyTime` from `siteContent.contactForm.replyTime`. | | BR-RT-02 | No other place hard-codes a reply time. | ## `ContactPanel` — behaviour kept from the homepage | Id | Rule | |---|---| | BR-CPN-01 | Shoot options = the shown packages in their order, then "Overig" (`shootOptions`). | | BR-CPN-02 | A raw `pakket` value is validated with `packageFromSearch` against the shown packages; only a known id preselects. A new valid value (also the same one again) re-applies the preselect (`key` increments); an invalid value changes nothing. | | BR-CPN-03 | The mail subject is "Aanvraag fotoshoot: {package name}" after a valid preselect, otherwise "Vraag via andreaslop.nl". It is used by the gate's mail button and the form's failure message. | | BR-CPN-04 | `load="lazy"`: the form loads when its spot comes near the screen (`DEFERRED_LOAD_MARGIN`) or immediately when a `pakket` value arrives; until then a placeholder keeps its height (604 px on phones, 502 px from `sm`); once loaded it stays loaded. | | BR-CPN-05 | `load="eager"`: the form is part of the page and renders right away, without a placeholder. | | BR-CPN-06 | The gate is shown whenever `enabled` is false, with the mail button (subject per BR-CPN-03) and the privacy line (BR-PR-03). | | BR-CPN-07 | Not the panel's job: heading, URL clean-up, scrolling and focus. On the homepage `ContactSection` keeps doing these exactly as today. |