Files
AndreaSlopFotografie/aidlc-docs/features/contact-page/inception/application-design/component-methods.md
T
SluijsensandClaude Opus 5.5 4c257b7ac0 Plans the Contact page and records unit 1 as generated
Workspace detection, a reverse engineering delta, requirements with the
approved layout mockups, the execution plan and the application design
for the Contact page, plus the code generation plan and summary of the
webPage helper. Corrects the contact payload in the shared API notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 16:59:38 +01:00

3.6 KiB

Component Methods — Contact Page

Signatures and props only; business rules follow in Functional Design (units 2 and 3).

seo.ts

export type WebPageType =
    | 'WebPage'
    | 'AboutPage'
    | 'ContactPage'
    | 'ImageGallery'
    | 'CollectionPage';

// Unit 1. @id = url = canonicalUrl(path); name/description from sitePages[path];
// inLanguage 'nl-NL'; extra spread last.
export function webPage(
    type: WebPageType,
    path: RoutePath,
    extra?: Record<string, unknown>,
): Record<string, unknown>;

// Unit 1. Signature unchanged; output identical to today.
export function aboutPage(
    path: RoutePath,
    content: AboutPageContent['person'],
    site: SiteContent,
): Record<string, unknown>;

// Unit 3. webPage('ContactPage', path, { about: { '@id': businessId } })
export function contactPage(path: RoutePath): Record<string, unknown>;

ContactPanel (unit 2)

type ContactPanelProps = {
    // Prefix for the form's field ids (unique per page)
    idPrefix: string;
    packages: PricingPackage[];
    enabled: boolean;          // siteContent.contactForm.enabled
    email: EmailAddress;
    replyTime: string;         // siteContent.contactForm.replyTime
    // Raw ?pakket= value from the page; validated inside (packageFromSearch)
    pakket?: string;
    // 'lazy': load the form near the screen, with a placeholder (homepage)
    // 'eager': load it with the page (contact page)
    load: 'lazy' | 'eager';
};

ContactForm (changed, unit 2)

type ContactFormProps = {
    idPrefix: string;
    options: ShootOption[];
    preselect?: { shoot: string; key: number };
    mailSubject: string;
    email: EmailAddress;
    replyTime: string;         // new: used in the thank-you message
    submit?: (payload: ContactPayload) => Promise<void>;
};

home/ContactSection (changed, unit 2)

Props unchanged: { content, packages, enabled, email, pakket? }, plus replyTime passed through to ContactPanel.

ContactDetails (unit 2)

type ContactDetailsProps = {
    // Id of the h2, unique on the page (the card can appear twice)
    titleId: string;
    title: string;             // "Direct contact"
    email: EmailAddress;
    socials: SocialLink[];
    // Small round portrait next to the heading (narrow screens)
    portrait?: ContentImage;
    'data-testid'?: string;
};
// Renders null when no channel is valid.

contact/ContactAside (unit 3)

type ContactAsideProps = {
    image: ContentImage;       // the 4:5 contact photo
    children: ReactNode;       // the card that overlaps the photo
};

Content types (content/types.ts)

export interface SocialLink {
    platform: SocialPlatform;
    href: string;
    label?: string;            // new (unit 2), e.g. '@andreaslopfotografie'
}

export interface SiteContent {
    // ...
    contactForm: { enabled: boolean; replyTime: string }; // replyTime new (unit 2)
}

// Unit 3
export interface ContactPageContent {
    head: { eyebrow: string; title: string; intro: string };
    formTitle: string;         // "Stuur me een bericht" (visually hidden h2)
    detailsTitle: string;      // "Direct contact"
    image: ContentImage;       // 4:5 photo (wide screens)
    portrait: ContentImage;    // small round face crop (narrow screens, decorative)
}

The intro and the reply time are combined in Functional Design (unit 3), so the reply time stays a single value.

Route routes/contact.tsx (unit 3)

type ContactSearch = { pakket?: string };
// validateSearch: keeps pakket only when it is a string (same as routes/index.tsx)
// head: pageHead('/contact') + structuredDataScript(contactPage('/contact'))