Adds the shoot-type pages content and SEO foundation
Five pages under /soorten-fotoshoots/<id> with draft copy awaiting Andrea's approval (DRAFT markers), structured data (Service, BreadcrumbList, FAQPage), sitemap and Lighthouse entries. The overview route moves to soorten-fotoshoots/index.tsx. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+132
-32
@@ -1,20 +1,16 @@
|
||||
import { ChakraProvider } from '@chakra-ui/react';
|
||||
import {
|
||||
createMemoryHistory,
|
||||
createRouter,
|
||||
RouterProvider,
|
||||
} from '@tanstack/react-router';
|
||||
import { render, screen, waitFor, within } from '@testing-library/react';
|
||||
import { screen, waitFor, within } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import lighthouseConfig from '../lighthouserc.cjs';
|
||||
import ErrorPage from './components/StatusPage/ErrorPage';
|
||||
import shootTypes from './content/shootTypes';
|
||||
import { shootPagePath } from './lib/shootPages';
|
||||
import { siteUrl } from './seo';
|
||||
import { sitemapXml } from './sitemap';
|
||||
import { FakeIntersectionObserver } from './test/fakeIntersectionObserver';
|
||||
import { routeTree } from './routeTree.gen';
|
||||
import sitePages from './sitePages';
|
||||
import { axeResults } from './test/axe';
|
||||
import { expectShell, renderApp } from './test/renderApp';
|
||||
import type { SocialLink } from './content/types';
|
||||
import system from './theme';
|
||||
|
||||
// Laat PageIntro op verzoek crashen, om de foutpagina binnen de shell te testen
|
||||
const crash = vi.hoisted(() => ({ enabled: false }));
|
||||
@@ -65,28 +61,6 @@ afterEach(() => {
|
||||
delete Element.prototype.scrollTo;
|
||||
});
|
||||
|
||||
// De echte app: route tree, router-opties en thema zoals in main.tsx
|
||||
async function renderApp(path: string) {
|
||||
const router = createRouter({
|
||||
routeTree,
|
||||
history: createMemoryHistory({ initialEntries: [path] }),
|
||||
scrollRestoration: true,
|
||||
defaultErrorComponent: ErrorPage,
|
||||
});
|
||||
await router.load();
|
||||
const result = render(
|
||||
<ChakraProvider value={system}>
|
||||
<RouterProvider router={router} />
|
||||
</ChakraProvider>,
|
||||
);
|
||||
return { ...result, router };
|
||||
}
|
||||
|
||||
const expectShell = () => {
|
||||
expect(screen.getByRole('banner')).toBeInTheDocument();
|
||||
expect(screen.getByRole('contentinfo')).toBeInTheDocument();
|
||||
};
|
||||
|
||||
describe('app', () => {
|
||||
it.each(Object.keys(sitePages))(
|
||||
'%s rendert binnen de shell met een h1 en zonder axe-fouten',
|
||||
@@ -520,7 +494,133 @@ describe('homepage ?pakket=', () => {
|
||||
);
|
||||
});
|
||||
|
||||
// The JSON-LD objects in the page, in document order
|
||||
const structuredData = () =>
|
||||
[...document.querySelectorAll('script[type="application/ld+json"]')].map(
|
||||
(script) => JSON.parse(script.textContent!),
|
||||
);
|
||||
|
||||
const shootIds = shootTypes.map((shoot) => shoot.id);
|
||||
|
||||
describe('shoot pages', () => {
|
||||
it.each(shootIds)('%s has its own head and structured data', async (id) => {
|
||||
const path = shootPagePath(id);
|
||||
await renderApp(path);
|
||||
await screen.findByRole('heading', { level: 1 });
|
||||
expect(document.title).toBe(
|
||||
`${sitePages[path].title} | Andrea Slop Fotografie`,
|
||||
);
|
||||
expect(
|
||||
document.head.querySelector('meta[name="description"]'),
|
||||
).toHaveAttribute('content', sitePages[path].description);
|
||||
expect(
|
||||
document.head.querySelector('link[rel="canonical"]'),
|
||||
).toHaveAttribute('href', `${siteUrl}${path}`);
|
||||
// The default image until unit 2 gives the pages their own
|
||||
expect(
|
||||
document.head.querySelector('meta[property="og:image"]'),
|
||||
).toHaveAttribute('content', `${siteUrl}/og-image.jpg`);
|
||||
expect(document.head.querySelector('meta[name="robots"]')).toBeNull();
|
||||
|
||||
const data = structuredData();
|
||||
expect(data.map((item) => item['@type']).sort()).toEqual([
|
||||
'FAQPage',
|
||||
'ProfessionalService',
|
||||
'WebPage',
|
||||
]);
|
||||
const page = data.find((item) => item['@type'] === 'WebPage');
|
||||
expect(page.mainEntity['@id']).toBe(`${siteUrl}${path}#service`);
|
||||
expect('offers' in page.mainEntity).toBe(
|
||||
['newborn', 'zwangerschap', 'gezin'].includes(id),
|
||||
);
|
||||
});
|
||||
|
||||
it('gives the overview the Service ids of the shoot pages and renders no shoot page', async () => {
|
||||
await renderApp('/soorten-fotoshoots');
|
||||
await screen.findByRole('heading', {
|
||||
level: 1,
|
||||
name: 'Soorten fotoshoots',
|
||||
});
|
||||
const page = structuredData().find(
|
||||
(item) => item['@type'] === 'WebPage',
|
||||
);
|
||||
expect(
|
||||
page.mainEntity.itemListElement.map(
|
||||
(entry: { item: { '@id': string } }) => entry.item['@id'],
|
||||
),
|
||||
).toEqual(
|
||||
shootIds.map((id) => `${siteUrl}${shootPagePath(id)}#service`),
|
||||
);
|
||||
// No layout route: nothing of a shoot page on the overview
|
||||
expect(
|
||||
document.querySelector('script[type="application/ld+json"]'),
|
||||
).not.toBeNull();
|
||||
expect(
|
||||
structuredData().some((item) => item['@type'] === 'FAQPage'),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it.each(['/soorten-fotoshoots/onzin', '/soorten-fotoshoots/newborn/extra'])(
|
||||
'shows the 404 within the shell for %s',
|
||||
async (path) => {
|
||||
await renderApp(path);
|
||||
expect(
|
||||
await screen.findByRole('heading', {
|
||||
level: 1,
|
||||
name: 'Pagina niet gevonden',
|
||||
}),
|
||||
).toBeInTheDocument();
|
||||
expectShell();
|
||||
},
|
||||
);
|
||||
|
||||
// The router matches paths case-insensitively (default), so this is not
|
||||
// a 404; the canonical URL stays the lowercase one
|
||||
it('serves /soorten-fotoshoots/Newborn as the newborn page with the lowercase canonical', async () => {
|
||||
await renderApp('/soorten-fotoshoots/Newborn');
|
||||
await screen.findByRole('heading', { level: 1 });
|
||||
expect(
|
||||
document.head.querySelector('link[rel="canonical"]'),
|
||||
).toHaveAttribute('href', `${siteUrl}/soorten-fotoshoots/newborn`);
|
||||
});
|
||||
});
|
||||
|
||||
describe('pagina-register', () => {
|
||||
// Finite sets, so example-based: every shoot page is registered
|
||||
// everywhere, and nothing else lives under /soorten-fotoshoots/
|
||||
it('has every shoot page in the router, registry, sitemap and Lighthouse lists', async () => {
|
||||
const { router } = await renderApp('/');
|
||||
const sitemap = sitemapXml(
|
||||
Object.entries(sitePages).map(([path, page]) => ({
|
||||
path,
|
||||
indexed: page.indexed,
|
||||
})) as Parameters<typeof sitemapXml>[0],
|
||||
siteUrl,
|
||||
);
|
||||
const prefix = '/soorten-fotoshoots/';
|
||||
const expected = shootIds.map(shootPagePath).sort();
|
||||
const underPrefix = (paths: string[]) =>
|
||||
paths.filter((path) => path.startsWith(prefix)).sort();
|
||||
|
||||
for (const path of expected) {
|
||||
expect(router.routesByPath).toHaveProperty([path]);
|
||||
expect(sitePages[path as keyof typeof sitePages].indexed).toBe(
|
||||
true,
|
||||
);
|
||||
expect(sitemap).toContain(`<loc>${siteUrl}${path}</loc>`);
|
||||
expect(lighthouseConfig.indexedPaths).toContain(path);
|
||||
expect(lighthouseConfig.photoPagePaths).toContain(path);
|
||||
}
|
||||
expect(underPrefix(Object.keys(router.routesByPath))).toEqual(expected);
|
||||
expect(underPrefix(Object.keys(sitePages))).toEqual(expected);
|
||||
expect(underPrefix(lighthouseConfig.indexedPaths)).toEqual(expected);
|
||||
expect(underPrefix(lighthouseConfig.photoPagePaths)).toEqual(expected);
|
||||
const sitemapPaths = [...sitemap.matchAll(/<loc>([^<]*)<\/loc>/g)].map(
|
||||
(match) => match[1].replace(siteUrl, ''),
|
||||
);
|
||||
expect(underPrefix(sitemapPaths)).toEqual(expected);
|
||||
});
|
||||
|
||||
it('bevat precies de routes van de route tree', async () => {
|
||||
const { router } = await renderApp('/');
|
||||
const routePaths = Object.keys(router.routesByPath).sort();
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import { render } from '@testing-library/react';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import StructuredData from './StructuredData';
|
||||
|
||||
const scripts = (container: HTMLElement) =>
|
||||
container.querySelectorAll('script[type="application/ld+json"]');
|
||||
|
||||
describe('StructuredData', () => {
|
||||
it('renders the data as one ld+json script that parses back to it', () => {
|
||||
const data = {
|
||||
'@type': 'FAQPage',
|
||||
name: 'Vragen & antwoorden',
|
||||
items: [1, 'twee'],
|
||||
};
|
||||
const { container } = render(<StructuredData data={data} />);
|
||||
expect(scripts(container)).toHaveLength(1);
|
||||
expect(JSON.parse(scripts(container)[0].textContent ?? '')).toEqual(
|
||||
data,
|
||||
);
|
||||
});
|
||||
|
||||
it('does not let </script> in the data end the element', () => {
|
||||
const data = {
|
||||
name: '</script><img src=x onerror="alert(1)">',
|
||||
text: '<!-- & -->',
|
||||
};
|
||||
const { container } = render(<StructuredData data={data} />);
|
||||
const text = scripts(container)[0].textContent ?? '';
|
||||
expect(text).not.toMatch(/[<>&]/);
|
||||
expect(JSON.parse(text)).toEqual(data);
|
||||
// The serialised page parsed again as HTML: still one script, and
|
||||
// nothing from the data became an element
|
||||
const page = new DOMParser().parseFromString(
|
||||
container.innerHTML,
|
||||
'text/html',
|
||||
);
|
||||
expect(page.querySelectorAll('script')).toHaveLength(1);
|
||||
expect(page.querySelector('img')).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
import { jsonLdScript } from '@/seo';
|
||||
|
||||
type StructuredDataProps = {
|
||||
data: unknown;
|
||||
};
|
||||
|
||||
// One object of structured data as an ld+json script in the page. This is
|
||||
// the only place the shoot pages use dangerouslySetInnerHTML, and only with
|
||||
// jsonLdScript's output: it escapes <, > and &, so content can never close
|
||||
// the script element (SECURITY-04, SECURITY-11).
|
||||
export default function StructuredData({ data }: StructuredDataProps) {
|
||||
return (
|
||||
<script
|
||||
type="application/ld+json"
|
||||
dangerouslySetInnerHTML={{ __html: jsonLdScript(data) }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import { screen } from '@testing-library/react';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import newbornPage from '@/content/shootPages/newborn';
|
||||
import shootPageShared from '@/content/shootPageShared';
|
||||
import packages from '@/content/packages';
|
||||
import shootTypes from '@/content/shootTypes';
|
||||
import siteContent from '@/content/siteContent';
|
||||
import { shootPageView } from '@/lib/shootPageView';
|
||||
import { axeResults } from '@/test/axe';
|
||||
import { renderWithProviders } from '@/test/renderWithProviders';
|
||||
import ShootPage from './ShootPage';
|
||||
|
||||
const view = shootPageView('newborn', newbornPage, {
|
||||
shootTypes,
|
||||
packages,
|
||||
shared: shootPageShared,
|
||||
site: siteContent,
|
||||
portfolioShoots: [],
|
||||
});
|
||||
|
||||
describe('ShootPage', () => {
|
||||
it('toont label, de enige h1 en de intro', async () => {
|
||||
if (view === undefined) throw new Error('no view for newborn');
|
||||
const { container } = await renderWithProviders(
|
||||
<ShootPage view={view} />,
|
||||
);
|
||||
expect(screen.getAllByRole('heading', { level: 1 })).toHaveLength(1);
|
||||
expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent(
|
||||
view.intro.title,
|
||||
);
|
||||
expect(screen.getByText(view.intro.eyebrow)).toBeInTheDocument();
|
||||
expect(screen.getByText(view.intro.text)).toBeInTheDocument();
|
||||
expect(await axeResults(container)).toHaveNoViolations();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,17 @@
|
||||
import PageIntro from '@/components/PageIntro/PageIntro';
|
||||
import type { ShootPageView } from '@/lib/shootPageView';
|
||||
|
||||
type ShootPageProps = {
|
||||
view: ShootPageView;
|
||||
};
|
||||
|
||||
// One shoot page. For now only the page head with the h1; unit 2 adds the
|
||||
// sections in the order of the page structure.
|
||||
export default function ShootPage({ view }: ShootPageProps) {
|
||||
const { intro } = view;
|
||||
return (
|
||||
<PageIntro eyebrow={intro.eyebrow} title={intro.title}>
|
||||
{intro.text}
|
||||
</PageIntro>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
import type { FaqItem, ShootPageShared } from './types';
|
||||
|
||||
// The general questions every shoot page may include in its own FAQ list
|
||||
// (D7). The placeholders are filled in per shoot, see ShootPageShared.
|
||||
|
||||
// "Wanneer krijg ik de foto's?"
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
export const deliveryFaq: FaqItem = {
|
||||
id: 'fotos-ontvangen',
|
||||
question: "Wanneer krijg ik de foto's?",
|
||||
answer: [
|
||||
"Reken op {opleverduur} na de shoot. In die tijd selecteer en bewerk ik de mooiste foto's.",
|
||||
],
|
||||
};
|
||||
|
||||
// "Hoe leg ik de datum vast?"
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
// OPEN(CON-ST-04): does the deposit also apply to Loveshoot and Portret, and when exactly is the remainder paid after the shoot (before delivery)?
|
||||
export const bookingFaq: FaqItem = {
|
||||
id: 'datum-vastleggen',
|
||||
question: 'Hoe leg ik de datum vast?',
|
||||
answer: [
|
||||
{ text: 'Stuur een berichtje', to: '/contact' },
|
||||
', dan kiezen we samen een moment. Met een aanbetaling van {aanbetaling} staat je datum vast. De aanbetaling wordt verrekend met het totaalbedrag; het restbedrag betaal je na de shoot.',
|
||||
],
|
||||
};
|
||||
|
||||
// "Hoe snel hoor ik iets van je?"
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
export const replyFaq: FaqItem = {
|
||||
id: 'reactie',
|
||||
question: 'Hoe snel hoor ik iets van je?',
|
||||
answer: ['Ik reageer binnen {reactietermijn} op je berichtje.'],
|
||||
};
|
||||
|
||||
// The texts that are the same on every shoot page, until the CMS API exists.
|
||||
// Step titles, the deposit amount and the breadcrumb labels are fixed by the
|
||||
// requirements (FR-ST-02, FR-ST-04, CON-ST-01); the other texts are drafts.
|
||||
const shootPageShared: ShootPageShared = {
|
||||
breadcrumb: {
|
||||
label: 'Kruimelpad',
|
||||
home: 'Home',
|
||||
overview: 'Soorten fotoshoots',
|
||||
},
|
||||
process: {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
eyebrow: 'Zo werkt het',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
title: 'Van aanvraag tot online galerij',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
lead: 'Elke shoot volgt dezelfde zes stappen, zodat je precies weet waar je aan toe bent.',
|
||||
steps: {
|
||||
aanvragen: {
|
||||
title: 'Aanvragen',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
text: 'Stuur een berichtje. Ik reageer binnen {reactietermijn}.',
|
||||
},
|
||||
datum: {
|
||||
title: 'Datum & locatie kiezen',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
text: 'We kiezen samen een moment. {locatie}',
|
||||
},
|
||||
aanbetaling: {
|
||||
title: 'Aanbetaling',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
text: 'Met een aanbetaling van {aanbetaling} staat je datum vast.',
|
||||
},
|
||||
shoot: {
|
||||
title: 'De shoot',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
text: '{duur}',
|
||||
},
|
||||
bewerking: {
|
||||
title: 'Bewerking',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
text: "Ik selecteer en bewerk de mooiste foto's. Opleverduur: {opleverduur}.",
|
||||
},
|
||||
oplevering: {
|
||||
title: 'Oplevering',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
// OPEN(CON-ST-04): is there an online gallery for Loveshoot and Portret too (confirmed only for the three packages)?
|
||||
text: "Je foto's staan klaar in je persoonlijke online fotogalerij.",
|
||||
},
|
||||
},
|
||||
},
|
||||
deposit: {
|
||||
// Whole euros, settled against the total (CON-ST-01)
|
||||
amount: 50,
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
// OPEN(CON-ST-04): does the deposit also apply to Loveshoot and Portret, and when exactly is the remainder paid after the shoot (before delivery)?
|
||||
note: 'Aanbetaling {aanbetaling}, restbedrag na de shoot.',
|
||||
},
|
||||
photos: {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
eyebrow: 'Impressie',
|
||||
},
|
||||
faq: {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
eyebrow: 'Veelgestelde vragen',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
lead: [
|
||||
'Staat je vraag er niet tussen? ',
|
||||
{ text: 'Stuur gerust een berichtje', to: '/contact' },
|
||||
'.',
|
||||
],
|
||||
},
|
||||
offer: {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
bookLabel: 'Boek dit pakket',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
askLabel: 'Eerst een vraag stellen',
|
||||
// Shown for a shoot without a visible package; no figures, the
|
||||
// variant is decided by the data (FR-ST-07)
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
onRequest: {
|
||||
price: 'Prijs op aanvraag',
|
||||
text: 'Stuur me een berichtje met wat je in gedachten hebt, dan vertel ik je graag meer over de mogelijkheden en de prijs.',
|
||||
linkLabel: 'Vraag naar de mogelijkheden',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default shootPageShared;
|
||||
@@ -0,0 +1,147 @@
|
||||
import type { ShootPageContent } from '../types';
|
||||
import { bookingFaq, deliveryFaq } from '../shootPageShared';
|
||||
|
||||
// Images: the shoot's main photo and the family photos from the portfolio,
|
||||
// with the descriptions they have there. Provisional selection per slot;
|
||||
// unit 2 finalises it in its functional design. Note: the shoots/gezin*
|
||||
// photos show newborn families (CON-ST-05). The detail photo is shown by
|
||||
// the package block, so it is not used here.
|
||||
import gezin from '../../assets/shoots/gezin.jpg';
|
||||
import f41a1579 from '../../assets/portfolio/f41a1579.jpg';
|
||||
import f41a7138 from '../../assets/portfolio/f41a7138.jpg';
|
||||
|
||||
const bigBrother = {
|
||||
src: f41a1579,
|
||||
alt: 'Grote broer kust zijn pasgeboren broertje of zusje op een wit bed',
|
||||
width: 800,
|
||||
height: 534,
|
||||
};
|
||||
const parents = {
|
||||
src: f41a7138,
|
||||
alt: 'Jonge ouders kijken samen naar hun slapende pasgeboren baby',
|
||||
width: 800,
|
||||
height: 1200,
|
||||
};
|
||||
|
||||
// The family page (/soorten-fotoshoots/gezin) until the CMS API exists.
|
||||
// Drafted from the texts in shootTypes.ts and packages.ts; no facts beyond
|
||||
// them (CON-ST-04).
|
||||
const gezinPage: ShootPageContent = {
|
||||
id: 'gezin',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
intro: {
|
||||
eyebrow: 'Gezinsfotograaf in Huizen',
|
||||
title: 'Gezinsshoot vol echte momenten',
|
||||
text: 'Met een gezinsshoot leggen we vast hoe jullie nu samen zijn. Ik fotografeer in Huizen, Bussum, Hilversum en omgeving, bij jullie thuis of buiten in de natuur.',
|
||||
},
|
||||
stories: [
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'verwachten',
|
||||
eyebrow: 'Wat kun je verwachten',
|
||||
title: 'Spelen, knuffelen en lachen',
|
||||
paragraphs: [
|
||||
[
|
||||
'Met een gezinsshoot leggen we vast hoe jullie nu samen zijn: spelen, knuffelen en lachen. Geen stijve poses, maar echte momenten die je later met plezier terugkijkt.',
|
||||
],
|
||||
],
|
||||
image: {
|
||||
src: gezin,
|
||||
alt: 'Vader en moeder kijken samen naar hun pasgeboren baby in de armen van de vader',
|
||||
width: 848,
|
||||
height: 1060,
|
||||
},
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'samen',
|
||||
eyebrow: 'Het hele gezin',
|
||||
title: 'Iedereen hoort erbij',
|
||||
paragraphs: [
|
||||
[
|
||||
'Papa, mama, broertjes en zusjes: op een gezinsshoot hoort iedereen erbij. Ook als jullie gezin net een kleintje rijker is.',
|
||||
],
|
||||
],
|
||||
image: bigBrother,
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'locatie',
|
||||
eyebrow: 'Thuis of buiten',
|
||||
title: 'Een plek die bij jullie past',
|
||||
paragraphs: [
|
||||
[
|
||||
'We kiezen samen een plek die bij jullie past, bij jullie thuis of buiten in de natuur.',
|
||||
],
|
||||
],
|
||||
image: parents,
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'duur',
|
||||
eyebrow: 'Hoe lang duurt het',
|
||||
title: 'Rustig de tijd',
|
||||
paragraphs: [
|
||||
[
|
||||
'We nemen de tijd, zodat iedereen zich op zijn gemak voelt. Ook de kleinsten: is er even een pauze nodig, dan is daar gewoon ruimte voor.',
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
process: {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
location:
|
||||
'En een plek die bij jullie past: bij jullie thuis of buiten in de natuur.',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
duration: '1 uur fotografie, zonder haast.',
|
||||
// The same for every shoot (CON-ST-01)
|
||||
deliveryTime: '2–3 weken',
|
||||
},
|
||||
photos: {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
title: 'Uit eerdere gezinsshoots',
|
||||
// Both photos are used by the story blocks, so the page view leaves
|
||||
// the mosaic out (D14, D15) until Andrea delivers more photos; adding
|
||||
// them here is then a data-only change
|
||||
images: [bigBrother, parents],
|
||||
},
|
||||
faq: {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
title: 'Vragen over de gezinsshoot',
|
||||
items: [
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'wie',
|
||||
question: 'Wie mogen er op de foto?',
|
||||
answer: [
|
||||
'Het hele gezin: papa, mama, broertjes en zusjes. Geen stijve poses, maar echte momenten met elkaar.',
|
||||
],
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'locatie',
|
||||
question: 'Fotograferen we bij ons thuis of buiten?',
|
||||
answer: [
|
||||
'Allebei kan. We kiezen samen een plek die bij jullie past, bij jullie thuis of buiten in de natuur.',
|
||||
],
|
||||
},
|
||||
bookingFaq,
|
||||
deliveryFaq,
|
||||
],
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
offer: {
|
||||
eyebrow: 'Pakket gezin',
|
||||
title: 'Wat zit er in een gezinsshoot',
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
closing: {
|
||||
title: 'Op zoek naar een gezinsfotograaf in Huizen?',
|
||||
lead: [
|
||||
'Stuur gerust een berichtje voor de mogelijkheden. Ik denk graag mee over een plek die bij jullie past.',
|
||||
],
|
||||
buttonLabel: 'Boek je gezinsshoot',
|
||||
},
|
||||
};
|
||||
|
||||
export default gezinPage;
|
||||
@@ -0,0 +1,140 @@
|
||||
import type { ShootPageContent } from '../types';
|
||||
import { bookingFaq, deliveryFaq } from '../shootPageShared';
|
||||
|
||||
// Images: for now only the shoot's main photo and detail photo exist, with
|
||||
// the descriptions they have in shootTypes.ts (CON-ST-05)
|
||||
import loveshoot from '../../assets/shoots/loveshoot.jpg';
|
||||
import loveshootDetail from '../../assets/shoots/loveshoot-detail.jpg';
|
||||
|
||||
const mainPhoto = {
|
||||
src: loveshoot,
|
||||
alt: 'Een stel ligt in de zon op een plaid in het gras, met de hoofden tegen elkaar',
|
||||
width: 848,
|
||||
height: 1060,
|
||||
};
|
||||
|
||||
// The loveshoot page (/soorten-fotoshoots/loveshoot) until the CMS API
|
||||
// exists. Drafted from the text in shootTypes.ts. Duration, number of
|
||||
// photos, best period and locations are not known, so the texts do not
|
||||
// name them (CON-ST-04). No package, so no price: the page shows "Prijs op
|
||||
// aanvraag", decided by the data (FR-ST-07).
|
||||
const loveshootPage: ShootPageContent = {
|
||||
id: 'loveshoot',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
intro: {
|
||||
eyebrow: 'Loveshoot in Huizen',
|
||||
title: 'Loveshoot voor jullie twee',
|
||||
text: 'Een loveshoot is een prachtige manier om jullie liefde vast te leggen. Ik fotografeer in Huizen, Bussum, Hilversum en omgeving.',
|
||||
},
|
||||
stories: [
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'verwachten',
|
||||
eyebrow: 'Wat kun je verwachten',
|
||||
title: 'Jullie liefde, vastgelegd',
|
||||
paragraphs: [
|
||||
[
|
||||
'Een loveshoot is een prachtige manier om jullie liefde vast te leggen. Mijn stijl is natuurlijk en ongedwongen: geen ongemakkelijke poses, maar spontane momenten van jullie samen.',
|
||||
],
|
||||
],
|
||||
image: mainPhoto,
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'trouwkaart',
|
||||
eyebrow: 'Verloofd?',
|
||||
title: 'Voor jullie trouwkaart',
|
||||
paragraphs: [
|
||||
[
|
||||
"Zijn jullie verloofd? Dan kan je de foto's gebruiken voor de trouwkaart. Vertel het me gerust bij je aanvraag, dan houden we daar rekening mee.",
|
||||
],
|
||||
],
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'locatie',
|
||||
eyebrow: 'De locatie',
|
||||
title: 'Samen een plek kiezen',
|
||||
paragraphs: [
|
||||
[
|
||||
'We kiezen samen een plek die bij jullie past. Vertel me gerust wat jullie mooi vinden of waar jullie graag samen komen.',
|
||||
],
|
||||
],
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'ontspannen',
|
||||
eyebrow: 'Gewoon jullie zelf',
|
||||
title: 'Ontspannen voor de camera',
|
||||
paragraphs: [
|
||||
[
|
||||
'Spannend om samen voor de camera te staan? Dat hoeft niet. We nemen de tijd, zodat jullie je op je gemak voelen en ik jullie kan vastleggen zoals jullie zijn.',
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
process: {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
location: 'En een plek die bij jullie past.',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
// OPEN(CON-ST-04): shoot duration for the loveshoot
|
||||
duration: 'We stemmen de duur samen af.',
|
||||
// The same for every shoot (CON-ST-01)
|
||||
deliveryTime: '2–3 weken',
|
||||
},
|
||||
photos: {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
title: 'Uit eerdere loveshoots',
|
||||
// Only the main and the detail photo for now. Story 1 and the package
|
||||
// block use them, so the page view leaves the mosaic out (D14, D15);
|
||||
// they are listed so that adding photos later is a data-only change.
|
||||
images: [
|
||||
mainPhoto,
|
||||
{
|
||||
src: loveshootDetail,
|
||||
alt: 'Een man schuift een ring om de vinger van zijn partner, met paarse heide op de achtergrond',
|
||||
width: 480,
|
||||
height: 480,
|
||||
},
|
||||
],
|
||||
},
|
||||
faq: {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
title: 'Vragen over de loveshoot',
|
||||
items: [
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'trouwkaart',
|
||||
question: "Kunnen we de foto's gebruiken voor onze trouwkaart?",
|
||||
answer: [
|
||||
"Ja, zeker. Zijn jullie verloofd? Dan kan je de foto's van jullie loveshoot gebruiken voor de trouwkaart.",
|
||||
],
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'ontspannen',
|
||||
question: 'We staan niet graag op de foto. Is dat erg?',
|
||||
answer: [
|
||||
'Helemaal niet. We nemen de tijd, zodat jullie je op je gemak voelen. Geen ongemakkelijke poses, maar spontane momenten van jullie samen.',
|
||||
],
|
||||
},
|
||||
bookingFaq,
|
||||
deliveryFaq,
|
||||
],
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
offer: {
|
||||
eyebrow: 'Loveshoot boeken',
|
||||
title: 'Benieuwd naar de mogelijkheden?',
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
closing: {
|
||||
title: 'Op zoek naar een fotograaf voor jullie loveshoot?',
|
||||
lead: [
|
||||
'Stuur gerust een berichtje voor de mogelijkheden. Ik denk graag mee over een plek die bij jullie past.',
|
||||
],
|
||||
buttonLabel: 'Boek je loveshoot',
|
||||
},
|
||||
};
|
||||
|
||||
export default loveshootPage;
|
||||
@@ -0,0 +1,195 @@
|
||||
import type { ShootPageContent } from '../types';
|
||||
import { deliveryFaq } from '../shootPageShared';
|
||||
|
||||
// Images: the shoot's main photo and newborn photos from the portfolio, with
|
||||
// the descriptions they have there. Provisional selection per slot; unit 2
|
||||
// finalises it in its functional design (CON-ST-05).
|
||||
import newborn from '../../assets/shoots/newborn.jpg';
|
||||
import f41a1916 from '../../assets/portfolio/f41a1916.jpg';
|
||||
import f41a1922 from '../../assets/portfolio/f41a1922.jpg';
|
||||
import f41a4650 from '../../assets/portfolio/f41a4650.jpg';
|
||||
import f41a7176 from '../../assets/portfolio/f41a7176.jpg';
|
||||
import f41a7284 from '../../assets/portfolio/f41a7284.jpg';
|
||||
import f41a8700 from '../../assets/portfolio/f41a8700.jpg';
|
||||
|
||||
const sleepingBaby = {
|
||||
src: f41a8700,
|
||||
alt: 'Slapende pasgeboren baby in een bruin-wit gestreept pakje',
|
||||
width: 800,
|
||||
height: 534,
|
||||
};
|
||||
|
||||
// The newborn page (/soorten-fotoshoots/newborn) until the CMS API exists.
|
||||
// Texts from design E, without its bracketed placeholders and without facts
|
||||
// that are not confirmed (CON-ST-04).
|
||||
const newbornPage: ShootPageContent = {
|
||||
id: 'newborn',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
intro: {
|
||||
eyebrow: 'Newbornfotograaf in Huizen',
|
||||
title: 'Newbornshoot bij jou thuis',
|
||||
text: "Ben je in verwachting? Boek een newbornshoot om de 'kleinste' momenten voor altijd te bewaren. Ik fotografeer bij jou thuis in Huizen, Bussum, Hilversum en omgeving, in het rustige ritme van jullie baby.",
|
||||
},
|
||||
stories: [
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'verwachten',
|
||||
eyebrow: 'Wat kun je verwachten',
|
||||
title: 'De kleinste momenten, voor altijd bewaard',
|
||||
paragraphs: [
|
||||
[
|
||||
'Een newbornshoot is rustig en ontspannen. Ik fotografeer jullie baby in de eerste weken, slapend en wakker, alleen en in jullie armen. Geen haast en geen ingewikkelde opstellingen: de kleine details en de warmte van jullie eerste weken staan centraal.',
|
||||
],
|
||||
],
|
||||
image: {
|
||||
src: newborn,
|
||||
alt: 'Een pasgeboren baby in een gestreept pakje slaapt met het hoofdje opzij',
|
||||
width: 848,
|
||||
height: 1060,
|
||||
},
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'periode',
|
||||
eyebrow: 'De beste periode',
|
||||
title: 'Tot 12 weken na de geboorte',
|
||||
paragraphs: [
|
||||
[
|
||||
"De ideale periode voor een newbornshoot is tot 12 weken na de geboorte van je baby. In die eerste weken slapen baby's veel en zijn ze nog heerlijk klein.",
|
||||
],
|
||||
// Newborn only: the date depends on the birth (CON-ST-01)
|
||||
[
|
||||
'Boek je shoot het liefst al tijdens je zwangerschap. Dan zetten we een voorlopige datum rond je uitgerekende datum en schuiven we mee als jullie baby eerder of later komt.',
|
||||
],
|
||||
],
|
||||
image: sleepingBaby,
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'locatie',
|
||||
eyebrow: 'Bij jou thuis',
|
||||
title: 'In jullie eigen vertrouwde omgeving',
|
||||
paragraphs: [
|
||||
[
|
||||
"De fotoshoot vindt bij jou thuis plaats. Je hoeft nergens heen met een baby van een paar weken oud, en jullie huis maakt de foto's persoonlijk.",
|
||||
],
|
||||
[
|
||||
'Je kunt tussendoor gewoon je baby voeden en verschonen als dat nodig is.',
|
||||
],
|
||||
],
|
||||
image: {
|
||||
src: f41a7176,
|
||||
alt: 'Moeder drukt haar gezicht tegen het hoofdje van haar pasgeboren baby',
|
||||
width: 800,
|
||||
height: 1200,
|
||||
},
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'duur',
|
||||
eyebrow: 'Hoe lang duurt het',
|
||||
title: '1 tot 2 uur, op het ritme van je baby',
|
||||
paragraphs: [
|
||||
[
|
||||
'We nemen alle tijd en volgen het ritme van jullie baby. Reken op 1 tot 2 uur fotografie, inclusief pauzes om te voeden, te troosten of even te knuffelen.',
|
||||
],
|
||||
[
|
||||
'Wil je broertjes, zusjes of jezelf ook op de foto? Dat plannen we gewoon in.',
|
||||
],
|
||||
],
|
||||
image: {
|
||||
src: f41a1916,
|
||||
alt: 'Pasgeboren baby in een wit pakje ligt op de onderarm van een ouder en kijkt in de camera',
|
||||
width: 800,
|
||||
height: 1200,
|
||||
},
|
||||
},
|
||||
],
|
||||
process: {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
location: 'Een newbornshoot is bij jou thuis.',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
duration: '1-2 uur fotografie, in het tempo van jullie baby.',
|
||||
// The same for every shoot (CON-ST-01)
|
||||
deliveryTime: '2–3 weken',
|
||||
},
|
||||
photos: {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
title: 'Uit eerdere newbornshoots',
|
||||
// The sleeping baby is also in story 2, as in design E; the page view
|
||||
// leaves it out of the mosaic (D14)
|
||||
images: [
|
||||
{
|
||||
src: f41a1922,
|
||||
alt: 'Vader kust zijn pasgeboren baby op het hoofd',
|
||||
width: 800,
|
||||
height: 1200,
|
||||
},
|
||||
{
|
||||
src: f41a4650,
|
||||
alt: 'Babyvuistje tussen een gebreide deken en een geruite doek',
|
||||
width: 800,
|
||||
height: 533,
|
||||
},
|
||||
{
|
||||
src: f41a7284,
|
||||
alt: 'Blote babyvoetjes in een gestreept gebreid broekje',
|
||||
width: 800,
|
||||
height: 1200,
|
||||
},
|
||||
sleepingBaby,
|
||||
],
|
||||
},
|
||||
faq: {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
title: 'Vragen over de newbornshoot',
|
||||
items: [
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'boeken',
|
||||
question: 'Wanneer boek ik de newbornshoot het beste?',
|
||||
answer: [
|
||||
'Het liefst al tijdens je zwangerschap. We zetten een voorlopige datum rond je uitgerekende datum en schuiven mee als jullie baby eerder of later komt. De shoot vindt plaats binnen 12 weken na de geboorte.',
|
||||
],
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'slapen',
|
||||
question: 'Wat als mijn baby niet wil slapen?',
|
||||
answer: [
|
||||
"Geen probleem. We volgen het ritme van jullie baby en nemen pauzes om te voeden, te verschonen of te troosten. Wakkere momenten leveren ook prachtige foto's op.",
|
||||
],
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'familie',
|
||||
question: 'Mogen wij en broertjes of zusjes ook op de foto?',
|
||||
answer: [
|
||||
"Ja, heel graag. Foto's met papa, mama en broertjes of zusjes horen er wat mij betreft gewoon bij.",
|
||||
],
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'voorbereiden',
|
||||
question: 'Wat moet ik thuis voorbereiden?',
|
||||
answer: ['Weinig. Een warme kamer met wat daglicht is fijn.'],
|
||||
},
|
||||
deliveryFaq,
|
||||
],
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
offer: {
|
||||
eyebrow: 'Pakket newborn',
|
||||
title: 'Wat zit er in een newbornshoot',
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
closing: {
|
||||
title: 'Op zoek naar een newbornfotograaf in Huizen?',
|
||||
lead: [
|
||||
'Stuur gerust een berichtje voor de mogelijkheden. Ik denk graag mee over een datum rond je uitgerekende datum.',
|
||||
],
|
||||
buttonLabel: 'Boek je newbornshoot',
|
||||
},
|
||||
};
|
||||
|
||||
export default newbornPage;
|
||||
@@ -0,0 +1,142 @@
|
||||
import type { ShootPageContent } from '../types';
|
||||
import { bookingFaq, deliveryFaq } from '../shootPageShared';
|
||||
|
||||
// Images: for now only the shoot's main photo and detail photo exist, with
|
||||
// the descriptions they have in shootTypes.ts (CON-ST-05)
|
||||
import portret from '../../assets/shoots/portret.jpg';
|
||||
import portretDetail from '../../assets/shoots/portret-detail.jpg';
|
||||
|
||||
const mainPhoto = {
|
||||
src: portret,
|
||||
alt: 'Een vrouw met lang bruin haar in een witte blouse kijkt glimlachend omlaag, met bomen op de achtergrond',
|
||||
width: 848,
|
||||
height: 1060,
|
||||
};
|
||||
|
||||
// The portrait page (/soorten-fotoshoots/portret) until the CMS API exists.
|
||||
// Drafted from the text in shootTypes.ts. Duration, number of photos, best
|
||||
// period and locations are not known, so the texts do not name them
|
||||
// (CON-ST-04). No package, so no price: the page shows "Prijs op aanvraag",
|
||||
// decided by the data (FR-ST-07).
|
||||
const portretPage: ShootPageContent = {
|
||||
id: 'portret',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
intro: {
|
||||
eyebrow: 'Portretfotograaf in Huizen',
|
||||
title: 'Portretshoot in de natuur of zakelijk',
|
||||
text: 'Van portretshoots in de natuur tot zakelijke shoots voor de branding van je bedrijf. Ik fotografeer in Huizen, Bussum, Hilversum en omgeving.',
|
||||
},
|
||||
stories: [
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'verwachten',
|
||||
eyebrow: 'Wat kun je verwachten',
|
||||
title: 'Jij, zoals je bent',
|
||||
paragraphs: [
|
||||
[
|
||||
"Mijn stijl is natuurlijk en ongedwongen. Geen ongemakkelijke poses, maar foto's waarop je jezelf herkent.",
|
||||
],
|
||||
],
|
||||
image: mainPhoto,
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'natuur-zakelijk',
|
||||
eyebrow: 'Natuur of zakelijk',
|
||||
title: 'Persoonlijk of voor je bedrijf',
|
||||
paragraphs: [
|
||||
[
|
||||
"Van portretshoots in de natuur tot zakelijke shoots voor de branding van je bedrijf. Vertel me waarvoor je de foto's wilt gebruiken, dan stemmen we de shoot daarop af.",
|
||||
],
|
||||
],
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
// OPEN(CON-ST-04): locations for the portrait shoot (natuur / zakelijk)
|
||||
{
|
||||
id: 'locatie',
|
||||
eyebrow: 'De locatie',
|
||||
title: 'Samen een plek kiezen',
|
||||
paragraphs: [
|
||||
[
|
||||
'We kiezen samen een plek die past bij jou of bij je bedrijf.',
|
||||
],
|
||||
],
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'ontspannen',
|
||||
eyebrow: 'Gewoon jezelf',
|
||||
title: 'Op je gemak voor de camera',
|
||||
paragraphs: [
|
||||
[
|
||||
'Niet gewend om op de foto te gaan? Geen zorgen. We nemen de tijd, zodat je je op je gemak voelt.',
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
process: {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
// OPEN(CON-ST-04): locations for the portrait shoot (natuur / zakelijk)
|
||||
location: 'En een plek die bij jou past.',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
// OPEN(CON-ST-04): shoot duration for the portrait shoot
|
||||
duration: 'We stemmen de duur samen af.',
|
||||
// The same for every shoot (CON-ST-01)
|
||||
deliveryTime: '2–3 weken',
|
||||
},
|
||||
photos: {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
title: 'Uit eerdere portretshoots',
|
||||
// Only the main and the detail photo for now. Story 1 and the package
|
||||
// block use them, so the page view leaves the mosaic out (D14, D15);
|
||||
// they are listed so that adding photos later is a data-only change.
|
||||
images: [
|
||||
mainPhoto,
|
||||
{
|
||||
src: portretDetail,
|
||||
alt: 'Een vrouw met lang blond haar in een jurk met bloemenprint houdt een takje heide vast op de heide',
|
||||
width: 480,
|
||||
height: 480,
|
||||
},
|
||||
],
|
||||
},
|
||||
faq: {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
title: 'Vragen over de portretshoot',
|
||||
items: [
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'zakelijk',
|
||||
question: "Kan ik ook zakelijke foto's laten maken?",
|
||||
answer: [
|
||||
'Ja. Naast portretshoots in de natuur doe ik ook zakelijke shoots voor de branding van je bedrijf.',
|
||||
],
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'ontspannen',
|
||||
question: 'Ik sta niet graag op de foto. Is dat erg?',
|
||||
answer: [
|
||||
"Helemaal niet. We nemen de tijd, zodat je je op je gemak voelt. Geen ongemakkelijke poses, maar foto's waarop je jezelf herkent.",
|
||||
],
|
||||
},
|
||||
bookingFaq,
|
||||
deliveryFaq,
|
||||
],
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
offer: {
|
||||
eyebrow: 'Portretshoot boeken',
|
||||
title: 'Benieuwd naar de mogelijkheden?',
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
closing: {
|
||||
title: 'Op zoek naar een portretfotograaf in Huizen?',
|
||||
lead: [
|
||||
"Stuur gerust een berichtje voor de mogelijkheden. Vertel me waarvoor je de foto's wilt gebruiken.",
|
||||
],
|
||||
buttonLabel: 'Boek je portretshoot',
|
||||
},
|
||||
};
|
||||
|
||||
export default portretPage;
|
||||
@@ -0,0 +1,206 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { shootPackage } from '../../lib/shootPackage';
|
||||
import { shootPageView, type ShootPageSources } from '../../lib/shootPageView';
|
||||
import packages from '../packages';
|
||||
import portfolioContent from '../portfolioContent';
|
||||
import siteContent from '../siteContent';
|
||||
import shootPageShared from '../shootPageShared';
|
||||
import shootTypes from '../shootTypes';
|
||||
import type { ContentImage, ShootPageContent, ShootTypeId } from '../types';
|
||||
import gezinPage from './gezin';
|
||||
import loveshootPage from './loveshoot';
|
||||
import newbornPage from './newborn';
|
||||
import portretPage from './portret';
|
||||
import zwangerschapPage from './zwangerschap';
|
||||
|
||||
// One entry per shoot type, so a missing page file is a type error
|
||||
const pages: Record<ShootTypeId, ShootPageContent> = {
|
||||
newborn: newbornPage,
|
||||
zwangerschap: zwangerschapPage,
|
||||
gezin: gezinPage,
|
||||
loveshoot: loveshootPage,
|
||||
portret: portretPage,
|
||||
};
|
||||
const entries = Object.entries(pages) as [ShootTypeId, ShootPageContent][];
|
||||
|
||||
// The real sources, as the routes pass them
|
||||
const sources: ShootPageSources = {
|
||||
shootTypes,
|
||||
packages,
|
||||
shared: shootPageShared,
|
||||
site: siteContent,
|
||||
portfolioShoots: [],
|
||||
};
|
||||
|
||||
// The placeholders the page view fills in (see ShootPageShared)
|
||||
const knownPlaceholders = [
|
||||
'reactietermijn',
|
||||
'aanbetaling',
|
||||
'locatie',
|
||||
'duur',
|
||||
'opleverduur',
|
||||
];
|
||||
|
||||
// Every visitor-facing string in a content object: all strings except
|
||||
// image file paths
|
||||
function texts(value: unknown): string[] {
|
||||
if (typeof value === 'string') return [value];
|
||||
if (Array.isArray(value)) return value.flatMap(texts);
|
||||
if (typeof value === 'object' && value !== null) {
|
||||
return Object.entries(value).flatMap(([key, item]) =>
|
||||
key === 'src' ? [] : texts(item),
|
||||
);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
function images(page: ShootPageContent): ContentImage[] {
|
||||
return [
|
||||
...page.stories.flatMap((story) =>
|
||||
story.image === undefined ? [] : [story.image],
|
||||
),
|
||||
...page.photos.images,
|
||||
];
|
||||
}
|
||||
|
||||
// The photos as they are described elsewhere on the site, by file
|
||||
const knownImages = new Map<string, ContentImage>(
|
||||
[
|
||||
...shootTypes.flatMap((shoot) =>
|
||||
shoot.detailImage === undefined
|
||||
? [shoot.image]
|
||||
: [shoot.image, shoot.detailImage],
|
||||
),
|
||||
...portfolioContent.photos.map((photo) => photo.thumb),
|
||||
].map((image) => [image.src, image]),
|
||||
);
|
||||
|
||||
describe('shoot page content', () => {
|
||||
it('has a page for every shoot type, with its own id', () => {
|
||||
expect(Object.keys(pages).sort()).toEqual(
|
||||
shootTypes.map((shoot) => shoot.id).sort(),
|
||||
);
|
||||
for (const [id, page] of entries) {
|
||||
expect(page.id).toBe(id);
|
||||
}
|
||||
});
|
||||
|
||||
it.each(entries)(
|
||||
'%s has exactly four stories with unique ids',
|
||||
(_, page) => {
|
||||
expect(page.stories).toHaveLength(4);
|
||||
const ids = page.stories.map((story) => story.id);
|
||||
expect(new Set(ids).size).toBe(ids.length);
|
||||
for (const story of page.stories) {
|
||||
expect(story.paragraphs.length).toBeGreaterThan(0);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
it.each(entries)('%s has 3 to 5 FAQ items with unique ids', (_, page) => {
|
||||
const ids = page.faq.items.map((item) => item.id);
|
||||
expect(ids.length).toBeGreaterThanOrEqual(3);
|
||||
expect(ids.length).toBeLessThanOrEqual(5);
|
||||
expect(new Set(ids).size).toBe(ids.length);
|
||||
});
|
||||
|
||||
it.each(entries)(
|
||||
'%s describes every photo and gives it a size',
|
||||
(_, page) => {
|
||||
for (const image of images(page)) {
|
||||
expect(image.alt.trim()).not.toBe('');
|
||||
expect(image.width).toBeGreaterThan(0);
|
||||
expect(image.height).toBeGreaterThan(0);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
it.each(entries)(
|
||||
'%s reuses the description and size a photo has elsewhere',
|
||||
(_, page) => {
|
||||
const reused = images(page).filter((image) =>
|
||||
knownImages.has(image.src),
|
||||
);
|
||||
// At least the shoot's main photo
|
||||
expect(reused.length).toBeGreaterThan(0);
|
||||
for (const image of reused) {
|
||||
expect(image).toEqual(knownImages.get(image.src));
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
it.each(entries)('%s has a page view', (id, page) => {
|
||||
expect(shootPageView(id, page, sources)).toBeDefined();
|
||||
});
|
||||
|
||||
// D14: every photo once on the rendered page
|
||||
it.each(entries)('%s shows no photo twice on the page', (id, page) => {
|
||||
const view = shootPageView(id, page, sources);
|
||||
expect(view).toBeDefined();
|
||||
const shown = [
|
||||
...(view?.stories.flatMap((story) =>
|
||||
story.image === undefined ? [] : [story.image],
|
||||
) ?? []),
|
||||
...(view === undefined ? [] : [view.offer.image]),
|
||||
...(view?.photos?.images ?? []),
|
||||
];
|
||||
const shownSources = shown.map((image) => image.src);
|
||||
expect(new Set(shownSources).size).toBe(shownSources.length);
|
||||
});
|
||||
|
||||
// D6: one duration, the same as in the package
|
||||
it.each(entries)(
|
||||
'%s names the duration of its package, if it has one',
|
||||
(_, page) => {
|
||||
const shoot = shootTypes.find((item) => item.id === page.id);
|
||||
expect(shoot).toBeDefined();
|
||||
const pkg = shoot && shootPackage(shoot, packages);
|
||||
if (pkg === undefined) return;
|
||||
const duration = pkg.features.find((feature) =>
|
||||
feature.endsWith('uur fotografie'),
|
||||
);
|
||||
expect(duration).toBeDefined();
|
||||
expect(page.process.duration.startsWith(duration ?? '')).toBe(true);
|
||||
},
|
||||
);
|
||||
|
||||
it.each(entries)('%s is delivered in 2–3 weken (CON-ST-01)', (_, page) => {
|
||||
expect(page.process.deliveryTime).toBe('2–3 weken');
|
||||
});
|
||||
|
||||
describe.each([...entries, ['shared', shootPageShared] as const])(
|
||||
'the texts of %s',
|
||||
(_, content) => {
|
||||
const all = texts(content);
|
||||
|
||||
it('contain no design placeholders in brackets', () => {
|
||||
for (const text of all) {
|
||||
expect(text).not.toMatch(/[[\]]/);
|
||||
}
|
||||
});
|
||||
|
||||
it('only use known placeholders', () => {
|
||||
for (const text of all) {
|
||||
for (const [, name] of text.matchAll(/\{([^}]*)\}/g)) {
|
||||
expect(knownPlaceholders).toContain(name);
|
||||
}
|
||||
// No stray brace outside a placeholder
|
||||
expect(text.replace(/\{[^{}]*\}/g, '')).not.toMatch(/[{}]/);
|
||||
}
|
||||
});
|
||||
|
||||
it('contain no e-mail address', () => {
|
||||
for (const text of all) {
|
||||
expect(text).not.toContain('@');
|
||||
}
|
||||
});
|
||||
|
||||
// Clarification 2 = B: no cancellation or rescheduling terms
|
||||
it('say nothing about cancelling or rescheduling', () => {
|
||||
for (const text of all) {
|
||||
expect(text.toLowerCase()).not.toMatch(/annuler|verzet/);
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,154 @@
|
||||
import type { ShootPageContent } from '../types';
|
||||
import { bookingFaq, deliveryFaq } from '../shootPageShared';
|
||||
|
||||
// Images: the shoot's main photo and the maternity photos from the
|
||||
// portfolio, with the descriptions they have there. Provisional selection
|
||||
// per slot; unit 2 finalises it in its functional design (CON-ST-05). The
|
||||
// detail photo is shown by the package block, so it is not used here.
|
||||
import zwangerschap from '../../assets/shoots/zwangerschap.jpg';
|
||||
import f41a7883 from '../../assets/portfolio/f41a7883.jpg';
|
||||
import f41a8206 from '../../assets/portfolio/f41a8206.jpg';
|
||||
|
||||
const belly = {
|
||||
src: f41a8206,
|
||||
alt: 'Zwangere buik in een zwarte jurk, omarmd door twee handen',
|
||||
width: 800,
|
||||
height: 534,
|
||||
};
|
||||
const dunes = {
|
||||
src: f41a7883,
|
||||
alt: 'Aanstaande vader omarmt zijn zwangere partner op een zandvlakte in de avondzon',
|
||||
width: 800,
|
||||
height: 1200,
|
||||
};
|
||||
|
||||
// The maternity page (/soorten-fotoshoots/zwangerschap) until the CMS API
|
||||
// exists. Drafted from the texts in shootTypes.ts and packages.ts; no facts
|
||||
// beyond them (CON-ST-04).
|
||||
const zwangerschapPage: ShootPageContent = {
|
||||
id: 'zwangerschap',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
intro: {
|
||||
eyebrow: 'Zwangerschapsfotograaf in Huizen',
|
||||
title: 'Je zwangerschap, voor altijd vastgelegd',
|
||||
text: 'Met een zwangerschapsshoot leg je deze bijzondere periode vast voor altijd. Ik fotografeer in Huizen, Bussum, Hilversum en omgeving, op een plek die bij jullie past.',
|
||||
},
|
||||
stories: [
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'verwachten',
|
||||
eyebrow: 'Wat kun je verwachten',
|
||||
title: 'Deze bijzondere periode, voor altijd bewaard',
|
||||
paragraphs: [
|
||||
[
|
||||
'Een zwangerschapsshoot is ontspannen en ongedwongen. Ik leg jullie vast zoals jullie zijn: geen ongemakkelijke poses, maar spontane momenten van jou, je buik en, als je wilt, je partner.',
|
||||
],
|
||||
],
|
||||
image: {
|
||||
src: zwangerschap,
|
||||
alt: 'Een zwangere vrouw en haar partner kijken elkaar lachend aan op een zandvlakte, zijn hand op haar buik',
|
||||
width: 848,
|
||||
height: 1060,
|
||||
},
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'periode',
|
||||
eyebrow: 'De beste periode',
|
||||
title: 'Tussen 30 en 34 weken',
|
||||
paragraphs: [
|
||||
[
|
||||
'De mooiste periode voor een zwangerschapsshoot is tussen de 30 en 34 weken. Stuur gerust op tijd een berichtje, dan plannen we de shoot samen in die weken.',
|
||||
],
|
||||
],
|
||||
image: belly,
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'locatie',
|
||||
eyebrow: 'De locatie',
|
||||
title: 'Op een plek die bij jullie past',
|
||||
paragraphs: [
|
||||
[
|
||||
'We kiezen samen een locatie uit die bij jullie past, denk aan de Soesterduinen of de heide.',
|
||||
],
|
||||
],
|
||||
image: dunes,
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'duur',
|
||||
eyebrow: 'Hoe lang duurt het',
|
||||
title: 'Rustig de tijd',
|
||||
paragraphs: [
|
||||
[
|
||||
'We nemen de tijd, zodat jullie je op je gemak voelen. Zo ontstaan de mooiste, spontane momenten.',
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
process: {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
location:
|
||||
'En een plek die bij jullie past, zoals de Soesterduinen of de heide.',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
duration: '1 uur fotografie, zonder haast.',
|
||||
// The same for every shoot (CON-ST-01)
|
||||
deliveryTime: '2–3 weken',
|
||||
},
|
||||
photos: {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
title: 'Uit eerdere zwangerschapsshoots',
|
||||
// Both photos are used by the story blocks, so the page view leaves
|
||||
// the mosaic out (D14, D15) until Andrea delivers more photos; adding
|
||||
// them here is then a data-only change
|
||||
images: [dunes, belly],
|
||||
},
|
||||
faq: {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
title: 'Vragen over de zwangerschapsshoot',
|
||||
items: [
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'periode',
|
||||
question: 'Wanneer plan ik de zwangerschapsshoot?',
|
||||
answer: [
|
||||
'De mooiste periode is tussen de 30 en 34 weken. Stuur gerust al eerder een berichtje, dan zoeken we samen een moment in die weken.',
|
||||
],
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'partner',
|
||||
question: 'Mag mijn partner ook op de foto?',
|
||||
answer: [
|
||||
'Ja, heel graag. Samen op de foto of alleen jij: we doen wat bij jullie past.',
|
||||
],
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
{
|
||||
id: 'locatie',
|
||||
question: 'Waar vindt de zwangerschapsshoot plaats?',
|
||||
answer: [
|
||||
'We kiezen samen een locatie uit die bij jullie past, denk aan de Soesterduinen of de heide.',
|
||||
],
|
||||
},
|
||||
bookingFaq,
|
||||
deliveryFaq,
|
||||
],
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
offer: {
|
||||
eyebrow: 'Pakket zwangerschap',
|
||||
title: 'Wat zit er in een zwangerschapsshoot',
|
||||
},
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
closing: {
|
||||
title: 'Op zoek naar een zwangerschapsfotograaf in Huizen?',
|
||||
lead: [
|
||||
'Stuur gerust een berichtje voor de mogelijkheden. Ik denk graag mee over een plek die bij jullie past.',
|
||||
],
|
||||
buttonLabel: 'Boek je zwangerschapsshoot',
|
||||
},
|
||||
};
|
||||
|
||||
export default zwangerschapPage;
|
||||
@@ -67,7 +67,7 @@ const shootTypes: ShootType[] = [
|
||||
name: 'Gezin',
|
||||
shootLabel: 'Gezinsshoot',
|
||||
photosLabel: "gezinsfoto's",
|
||||
// Draft text, still to be approved by Andrea (FR-SF-02)
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
paragraphs: [
|
||||
'Met een gezinsshoot leggen we vast hoe jullie nu samen zijn: spelen, knuffelen en lachen. Geen stijve poses, maar echte momenten die je later met plezier terugkijkt. We kiezen samen een plek die bij jullie past, bij jullie thuis of buiten in de natuur.',
|
||||
],
|
||||
|
||||
@@ -232,6 +232,109 @@ export interface ShootTypesPageContent {
|
||||
};
|
||||
}
|
||||
|
||||
// One block of the story on a shoot page (FR-ST-03)
|
||||
export interface StoryBlock {
|
||||
// Stable slug, e.g. 'verwachten'; used in the heading id
|
||||
id: string;
|
||||
eyebrow: string;
|
||||
title: string;
|
||||
// One or more; RichText so a block can link inline
|
||||
paragraphs: RichText[];
|
||||
// Without one the block is text only
|
||||
image?: ContentImage;
|
||||
}
|
||||
|
||||
// One question of the FAQ on a shoot page (FR-ST-06). The answer may contain
|
||||
// placeholders, see ShootPageShared.
|
||||
export interface FaqItem {
|
||||
// Stable slug, unique per page
|
||||
id: string;
|
||||
question: string;
|
||||
answer: RichText;
|
||||
}
|
||||
|
||||
// The six fixed steps of the process timeline, in this order (FR-ST-04)
|
||||
export type ProcessStepId =
|
||||
| 'aanvragen'
|
||||
| 'datum'
|
||||
| 'aanbetaling'
|
||||
| 'shoot'
|
||||
| 'bewerking'
|
||||
| 'oplevering';
|
||||
|
||||
// Title and text of one process step (FR-ST-04)
|
||||
export interface ProcessStepContent {
|
||||
title: string;
|
||||
// May contain placeholders, see ShootPageShared
|
||||
text: string;
|
||||
}
|
||||
|
||||
// The deposit that fixes the date (FR-ST-04, FR-ST-07)
|
||||
export interface DepositInfo {
|
||||
// Whole euros
|
||||
amount: number;
|
||||
// E.g. 'Aanbetaling {aanbetaling}, restbedrag na de shoot.'
|
||||
note: string;
|
||||
}
|
||||
|
||||
// The text that is the same on every shoot page (FR-ST-11, shared part).
|
||||
// Some texts contain placeholders, filled in per shoot when the page view is
|
||||
// built. There are five, and they may appear in the step texts, the deposit
|
||||
// note and the FAQ answers:
|
||||
// {reactietermijn} siteContent.contactForm.replyTime
|
||||
// {aanbetaling} the deposit amount as a price
|
||||
// {locatie} ShootPageContent.process.location
|
||||
// {duur} ShootPageContent.process.duration
|
||||
// {opleverduur} ShootPageContent.process.deliveryTime
|
||||
export interface ShootPageShared {
|
||||
// E.g. 'Kruimelpad', 'Home', 'Soorten fotoshoots'
|
||||
breadcrumb: { label: string; home: string; overview: string };
|
||||
process: {
|
||||
// E.g. 'Zo werkt het'
|
||||
eyebrow: string;
|
||||
// E.g. 'Van aanvraag tot online galerij'
|
||||
title: string;
|
||||
lead: string;
|
||||
steps: Record<ProcessStepId, ProcessStepContent>;
|
||||
};
|
||||
deposit: DepositInfo;
|
||||
// E.g. 'Impressie'
|
||||
photos: { eyebrow: string };
|
||||
faq: { eyebrow: string; lead: RichText };
|
||||
offer: {
|
||||
// E.g. 'Boek dit pakket'
|
||||
bookLabel: string;
|
||||
// E.g. 'Eerst een vraag stellen'
|
||||
askLabel: string;
|
||||
// Shown when the shoot has no visible package, e.g. 'Prijs op aanvraag'
|
||||
onRequest: { price: string; text: string; linkLabel: string };
|
||||
};
|
||||
}
|
||||
|
||||
// The content of one shoot page (FR-ST-11, per-shoot part); one file per shoot
|
||||
export interface ShootPageContent {
|
||||
// Must match the route that imports it (checked by a test)
|
||||
id: ShootTypeId;
|
||||
intro: { eyebrow: string; title: string; text: string };
|
||||
// Four per shoot (checked by a test)
|
||||
stories: StoryBlock[];
|
||||
process: {
|
||||
// Step 2, e.g. 'Een newbornshoot is bij jou thuis.'
|
||||
location: string;
|
||||
// Step 4, e.g. '1-2 uur fotografie, in het tempo van jullie baby.'
|
||||
duration: string;
|
||||
// Step 5 and the shared FAQ, e.g. '2–3 weken'
|
||||
deliveryTime: string;
|
||||
};
|
||||
// Ordered; adding a photo is a data-only change
|
||||
photos: { title: string; images: ContentImage[] };
|
||||
// 3-5 items, shared ones mixed in
|
||||
faq: { title: string; items: FaqItem[] };
|
||||
// E.g. 'Pakket newborn', 'Wat zit er in een newbornshoot'
|
||||
offer: { eyebrow: string; title: string };
|
||||
closing: { title: string; lead: RichText; buttonLabel: string };
|
||||
}
|
||||
|
||||
export interface HeroSlide {
|
||||
id: string;
|
||||
src: string;
|
||||
|
||||
@@ -0,0 +1,187 @@
|
||||
import fc from 'fast-check';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
knownPlaceholders,
|
||||
placeholderName,
|
||||
plainText,
|
||||
richText,
|
||||
textWithPlaceholders,
|
||||
} from '../test/arbitraries';
|
||||
import { fillPlaceholders, fillRichText } from './fillPlaceholders';
|
||||
|
||||
const values = {
|
||||
reactietermijn: '1-2 werkdagen',
|
||||
aanbetaling: '€ 50',
|
||||
locatie: 'Een newbornshoot is bij jou thuis.',
|
||||
duur: '1-2 uur fotografie',
|
||||
opleverduur: '2–3 weken',
|
||||
};
|
||||
|
||||
// A value for every known placeholder; values never contain braces, as in
|
||||
// the content
|
||||
const allValues = fc
|
||||
.tuple(...knownPlaceholders.map(() => plainText))
|
||||
.map((texts) =>
|
||||
Object.fromEntries(
|
||||
knownPlaceholders.map((name, index) => [name, texts[index]]),
|
||||
),
|
||||
);
|
||||
|
||||
// Values for some names, known or not
|
||||
const someValues = fc.dictionary(placeholderName, plainText, { maxKeys: 6 });
|
||||
|
||||
// Text in which no {name} appears, stray braces included
|
||||
const withoutPlaceholder = fc
|
||||
.string()
|
||||
.filter((text) => !/\{[^{}]*\}/.test(text));
|
||||
|
||||
const hasKnownPlaceholder = (text: string) =>
|
||||
knownPlaceholders.some((name) => text.includes(`{${name}}`));
|
||||
|
||||
describe('fillPlaceholders', () => {
|
||||
it('fills in each placeholder', () => {
|
||||
expect(
|
||||
fillPlaceholders('Ik reageer binnen {reactietermijn}.', values),
|
||||
).toBe('Ik reageer binnen 1-2 werkdagen.');
|
||||
expect(fillPlaceholders('Aanbetaling {aanbetaling}.', values)).toBe(
|
||||
'Aanbetaling € 50.',
|
||||
);
|
||||
expect(fillPlaceholders('{locatie}', values)).toBe(values.locatie);
|
||||
expect(fillPlaceholders('{duur}', values)).toBe(values.duur);
|
||||
expect(fillPlaceholders('Binnen {opleverduur}.', values)).toBe(
|
||||
'Binnen 2–3 weken.',
|
||||
);
|
||||
});
|
||||
|
||||
it('fills in a repeated placeholder every time', () => {
|
||||
expect(fillPlaceholders('{duur} en nog eens {duur}', values)).toBe(
|
||||
'1-2 uur fotografie en nog eens 1-2 uur fotografie',
|
||||
);
|
||||
});
|
||||
|
||||
it('keeps unknown placeholders, stray braces and inherited names', () => {
|
||||
expect(fillPlaceholders('{onbekend}', values)).toBe('{onbekend}');
|
||||
expect(fillPlaceholders('{Duur} { duur}', values)).toBe(
|
||||
'{Duur} { duur}',
|
||||
);
|
||||
expect(fillPlaceholders('{ en }', values)).toBe('{ en }');
|
||||
expect(fillPlaceholders('}{', values)).toBe('}{');
|
||||
expect(fillPlaceholders('{}', values)).toBe('{}');
|
||||
expect(fillPlaceholders('{constructor} {toString}', values)).toBe(
|
||||
'{constructor} {toString}',
|
||||
);
|
||||
expect(fillPlaceholders('{{duur}}', values)).toBe(
|
||||
'{1-2 uur fotografie}',
|
||||
);
|
||||
});
|
||||
|
||||
it('inserts a value literally', () => {
|
||||
expect(fillPlaceholders('{duur}', { duur: '$& $1 $$' })).toBe(
|
||||
'$& $1 $$',
|
||||
);
|
||||
});
|
||||
|
||||
it('returns text without placeholders as it is (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(
|
||||
withoutPlaceholder,
|
||||
fc.dictionary(fc.string(), fc.string()),
|
||||
(text, given) => {
|
||||
expect(fillPlaceholders(text, given)).toBe(text);
|
||||
},
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
it('changes nothing when filled in a second time (idempotency)', () => {
|
||||
fc.assert(
|
||||
fc.property(textWithPlaceholders, someValues, (text, given) => {
|
||||
const once = fillPlaceholders(text, given);
|
||||
expect(fillPlaceholders(once, given)).toBe(once);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('leaves no known placeholder behind (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(textWithPlaceholders, allValues, (text, given) => {
|
||||
expect(hasKnownPlaceholder(fillPlaceholders(text, given))).toBe(
|
||||
false,
|
||||
);
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('fillRichText', () => {
|
||||
it('fills in text pieces and link texts, and keeps the link target', () => {
|
||||
expect(
|
||||
fillRichText(
|
||||
[
|
||||
'Binnen {opleverduur}. ',
|
||||
{
|
||||
text: 'Vraag het binnen {reactietermijn}',
|
||||
to: '/contact',
|
||||
},
|
||||
{
|
||||
text: '{duur}',
|
||||
to: '/soorten-fotoshoots',
|
||||
hash: 'newborn',
|
||||
},
|
||||
],
|
||||
values,
|
||||
),
|
||||
).toEqual([
|
||||
'Binnen 2–3 weken. ',
|
||||
{ text: 'Vraag het binnen 1-2 werkdagen', to: '/contact' },
|
||||
{
|
||||
text: '1-2 uur fotografie',
|
||||
to: '/soorten-fotoshoots',
|
||||
hash: 'newborn',
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('fills every piece in its place and keeps links as links with their target (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(richText, someValues, (text, given) => {
|
||||
const filled = fillRichText(text, given);
|
||||
expect(filled).toHaveLength(text.length);
|
||||
filled.forEach((piece, index) => {
|
||||
const before = text[index];
|
||||
if (typeof before === 'string') {
|
||||
expect(piece).toBe(fillPlaceholders(before, given));
|
||||
} else {
|
||||
expect(piece).toEqual({
|
||||
...before,
|
||||
text: fillPlaceholders(before.text, given),
|
||||
});
|
||||
}
|
||||
});
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('changes nothing when filled in a second time (idempotency)', () => {
|
||||
fc.assert(
|
||||
fc.property(richText, someValues, (text, given) => {
|
||||
const once = fillRichText(text, given);
|
||||
expect(fillRichText(once, given)).toEqual(once);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('leaves no known placeholder behind (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(richText, allValues, (text, given) => {
|
||||
fillRichText(text, given).forEach((piece) => {
|
||||
expect(
|
||||
hasKnownPlaceholder(
|
||||
typeof piece === 'string' ? piece : piece.text,
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,31 @@
|
||||
import type { RichText } from '../content/types.ts';
|
||||
|
||||
// A placeholder: a name between braces, with no brace inside
|
||||
const PLACEHOLDER = /\{([^{}]*)\}/g;
|
||||
|
||||
// Fills in every {name} whose name is one of the values, so a figure that
|
||||
// is data (reply time, deposit, duration, ...) is written in one place only
|
||||
// (D8, NFR-ST-04). Unknown placeholders and other text stay as they are;
|
||||
// only own properties count, so {constructor} is no placeholder. The values
|
||||
// are inserted literally ($& and the like mean nothing here).
|
||||
export function fillPlaceholders(
|
||||
text: string,
|
||||
values: Readonly<Record<string, string>>,
|
||||
): string {
|
||||
return text.replace(PLACEHOLDER, (match, name: string) =>
|
||||
Object.hasOwn(values, name) ? values[name] : match,
|
||||
);
|
||||
}
|
||||
|
||||
// The same for running text: the text pieces and the link texts are filled
|
||||
// in, link targets stay as they are
|
||||
export function fillRichText(
|
||||
text: RichText,
|
||||
values: Readonly<Record<string, string>>,
|
||||
): RichText {
|
||||
return text.map((piece) =>
|
||||
typeof piece === 'string'
|
||||
? fillPlaceholders(piece, values)
|
||||
: { ...piece, text: fillPlaceholders(piece.text, values) },
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import fc from 'fast-check';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { richText } from '../test/arbitraries';
|
||||
import { richTextToPlain } from './richTextToPlain';
|
||||
|
||||
describe('richTextToPlain', () => {
|
||||
it('reads links by their text, without adding spaces', () => {
|
||||
expect(
|
||||
richTextToPlain([
|
||||
'Staat je vraag er niet tussen? ',
|
||||
{ text: 'Stuur gerust een berichtje', to: '/contact' },
|
||||
'.',
|
||||
]),
|
||||
).toBe('Staat je vraag er niet tussen? Stuur gerust een berichtje.');
|
||||
expect(richTextToPlain([])).toBe('');
|
||||
expect(richTextToPlain(['Alleen tekst'])).toBe('Alleen tekst');
|
||||
});
|
||||
|
||||
it('is the text pieces and link texts joined, as long as they are together (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(richText, (text) => {
|
||||
const pieces = text.map((piece) =>
|
||||
typeof piece === 'string' ? piece : piece.text,
|
||||
);
|
||||
const plain = richTextToPlain(text);
|
||||
expect(plain).toBe(pieces.join(''));
|
||||
expect(plain.length).toBe(
|
||||
pieces.reduce((sum, piece) => sum + piece.length, 0),
|
||||
);
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
import type { RichText } from '../content/types.ts';
|
||||
|
||||
// The text a visitor reads: text pieces as they are, links by their text,
|
||||
// joined without anything in between (spaces belong to the text). For
|
||||
// places that take plain text only, such as the FAQ in structured data.
|
||||
export function richTextToPlain(text: RichText): string {
|
||||
return text
|
||||
.map((piece) => (typeof piece === 'string' ? piece : piece.text))
|
||||
.join('');
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
shootContactLink,
|
||||
shootPortfolioLink,
|
||||
} from './shootLinks';
|
||||
import { shootPackage } from './shootPackage';
|
||||
import { visiblePackages } from './visiblePackages';
|
||||
|
||||
const shoot = (id: string) => shootTypes.find((item) => item.id === id)!;
|
||||
@@ -58,6 +59,15 @@ describe('shootContactLink', () => {
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('agrees with shootPackage (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(shootType, fc.array(anyPackage), (item, list) => {
|
||||
const link = shootContactLink(item, list);
|
||||
expect(link.search?.pakket).toBe(shootPackage(item, list)?.id);
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('shootPortfolioLink', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { PricingPackage, ShootType } from '../content/types.ts';
|
||||
import type { RoutePath } from '../navigation.ts';
|
||||
import type { PageMeta } from '../sitePages.ts';
|
||||
import { visiblePackages } from './visiblePackages.ts';
|
||||
import { shootPackage } from './shootPackage.ts';
|
||||
|
||||
// Where "Stuur een berichtje" goes: the contact page, with the shoot's
|
||||
// package preselected when that package is shown (BR-SF-01..03, FR-CP-09)
|
||||
@@ -9,11 +9,9 @@ export function shootContactLink(
|
||||
shoot: ShootType,
|
||||
packages: readonly PricingPackage[],
|
||||
) {
|
||||
const shown = visiblePackages(packages).some(
|
||||
(pkg) => pkg.id === shoot.packageId,
|
||||
);
|
||||
return shown && shoot.packageId !== undefined
|
||||
? { to: '/contact' as const, search: { pakket: shoot.packageId } }
|
||||
const pkg = shootPackage(shoot, packages);
|
||||
return pkg !== undefined
|
||||
? { to: '/contact' as const, search: { pakket: pkg.id } }
|
||||
: { to: '/contact' as const };
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
import fc from 'fast-check';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import packages from '../content/packages';
|
||||
import shootTypes from '../content/shootTypes';
|
||||
import { anyPackage, shootType } from '../test/arbitraries';
|
||||
import { shootPackage } from './shootPackage';
|
||||
import { visiblePackages } from './visiblePackages';
|
||||
|
||||
const shoot = (id: string) => shootTypes.find((item) => item.id === id)!;
|
||||
|
||||
describe('shootPackage', () => {
|
||||
it('finds the package of the three shoots that have one', () => {
|
||||
expect(shootPackage(shoot('newborn'), packages)).toMatchObject({
|
||||
id: 'newborn',
|
||||
price: 185,
|
||||
});
|
||||
expect(shootPackage(shoot('zwangerschap'), packages)).toMatchObject({
|
||||
id: 'zwangerschap',
|
||||
price: 175,
|
||||
});
|
||||
expect(shootPackage(shoot('gezin'), packages)).toMatchObject({
|
||||
id: 'gezin',
|
||||
price: 175,
|
||||
});
|
||||
});
|
||||
|
||||
it('finds none for Loveshoot and Portret', () => {
|
||||
expect(shootPackage(shoot('loveshoot'), packages)).toBeUndefined();
|
||||
expect(shootPackage(shoot('portret'), packages)).toBeUndefined();
|
||||
});
|
||||
|
||||
it('finds none when the package is removed or invalid', () => {
|
||||
expect(
|
||||
shootPackage(
|
||||
shoot('gezin'),
|
||||
packages.filter((pkg) => pkg.id !== 'gezin'),
|
||||
),
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
shootPackage(
|
||||
shoot('newborn'),
|
||||
packages.map((pkg) =>
|
||||
pkg.id === 'newborn' ? { ...pkg, price: 0 } : pkg,
|
||||
),
|
||||
),
|
||||
).toBeUndefined();
|
||||
});
|
||||
|
||||
it('is undefined or a shown package with the id of the shoot (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(shootType, fc.array(anyPackage), (item, list) => {
|
||||
const result = shootPackage(item, list);
|
||||
const shown = visiblePackages(list);
|
||||
const expected = shown.some((pkg) => pkg.id === item.packageId);
|
||||
expect(result !== undefined).toBe(expected);
|
||||
if (result !== undefined) {
|
||||
expect(result.id).toBe(item.packageId);
|
||||
expect(shown).toContain(result);
|
||||
}
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
import type { PricingPackage, ShootType } from '../content/types.ts';
|
||||
import { visiblePackages } from './visiblePackages.ts';
|
||||
|
||||
// The package a shoot points to, if that package is shown; a removed or
|
||||
// invalid package, or none, gives undefined, and the page then shows
|
||||
// "Prijs op aanvraag" (FR-ST-07, SECURITY-15)
|
||||
export function shootPackage(
|
||||
shoot: ShootType,
|
||||
packages: readonly PricingPackage[],
|
||||
): PricingPackage | undefined {
|
||||
return visiblePackages(packages).find((pkg) => pkg.id === shoot.packageId);
|
||||
}
|
||||
@@ -0,0 +1,369 @@
|
||||
import fc from 'fast-check';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import sleepingBaby from '../assets/portfolio/f41a8700.jpg';
|
||||
import packages from '../content/packages';
|
||||
import shootPageShared from '../content/shootPageShared';
|
||||
import loveshootPage from '../content/shootPages/loveshoot';
|
||||
import newbornPage from '../content/shootPages/newborn';
|
||||
import shootTypes from '../content/shootTypes';
|
||||
import siteContent from '../content/siteContent';
|
||||
import type { ContentImage, RichText } from '../content/types';
|
||||
import {
|
||||
anyPackage,
|
||||
anySiteContent,
|
||||
contentImage,
|
||||
knownPlaceholders,
|
||||
plainText,
|
||||
shootPageContent,
|
||||
shootPageShared as anyShared,
|
||||
shootType,
|
||||
shootTypeId,
|
||||
} from '../test/arbitraries';
|
||||
import { shootPackage } from './shootPackage';
|
||||
import { SHOOT_TYPE_IDS, shootPagePath } from './shootPages';
|
||||
import {
|
||||
MOSAIC_MIN_PHOTOS,
|
||||
PROCESS_STEP_ORDER,
|
||||
shootPageView,
|
||||
type ShootPageSources,
|
||||
type ShootPageView,
|
||||
} from './shootPageView';
|
||||
import { visiblePackages } from './visiblePackages';
|
||||
|
||||
const NBSP = ' ';
|
||||
|
||||
const sources: ShootPageSources = {
|
||||
shootTypes,
|
||||
packages,
|
||||
shared: shootPageShared,
|
||||
site: siteContent,
|
||||
portfolioShoots: ['newborn'],
|
||||
};
|
||||
|
||||
// Shoot types with unique ids, some with a detail photo
|
||||
const shoots = fc.uniqueArray(
|
||||
fc
|
||||
.tuple(shootType, fc.option(contentImage, { nil: undefined }))
|
||||
.map(([shoot, detailImage]) =>
|
||||
detailImage === undefined ? shoot : { ...shoot, detailImage },
|
||||
),
|
||||
{ selector: (shoot) => shoot.id, maxLength: 5 },
|
||||
);
|
||||
|
||||
// The sources as the CMS could deliver them. The reply time has no braces,
|
||||
// as in the content: it is filled in as a value.
|
||||
const anySources: fc.Arbitrary<ShootPageSources> = fc.record({
|
||||
shootTypes: shoots,
|
||||
packages: fc.array(anyPackage, { maxLength: 6 }),
|
||||
shared: anyShared,
|
||||
site: fc.tuple(anySiteContent, plainText).map(([site, replyTime]) => ({
|
||||
...site,
|
||||
contactForm: { ...site.contactForm, replyTime },
|
||||
})),
|
||||
portfolioShoots: fc.subarray([...SHOOT_TYPE_IDS]),
|
||||
});
|
||||
|
||||
// A shoot id (mostly one of the sources), the sources, and page content
|
||||
// that mostly belongs to that shoot, its photos repeating the shoot's own
|
||||
const viewCase = anySources.chain((given) => {
|
||||
const ids = given.shootTypes.map((shoot) => shoot.id);
|
||||
const id =
|
||||
ids.length > 0
|
||||
? fc.oneof(
|
||||
{ arbitrary: fc.constantFrom(...ids), weight: 4 },
|
||||
shootTypeId,
|
||||
)
|
||||
: shootTypeId;
|
||||
return id.chain((shootId) => {
|
||||
const shoot = given.shootTypes.find((item) => item.id === shootId);
|
||||
const reuse =
|
||||
shoot === undefined
|
||||
? []
|
||||
: [
|
||||
shoot.image,
|
||||
...(shoot.detailImage ? [shoot.detailImage] : []),
|
||||
];
|
||||
return fc.record({
|
||||
id: fc.constant(shootId),
|
||||
sources: fc.constant(given),
|
||||
page: fc.oneof(
|
||||
{ arbitrary: shootPageContent(shootId, reuse), weight: 4 },
|
||||
shootPageContent(undefined, reuse),
|
||||
),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// A case for which the view exists
|
||||
const resolvedCase = viewCase.filter(
|
||||
({ id, page, sources: given }) =>
|
||||
page.id === id && given.shootTypes.some((shoot) => shoot.id === id),
|
||||
);
|
||||
|
||||
const build = (c: {
|
||||
id: Parameters<typeof shootPageView>[0];
|
||||
page: Parameters<typeof shootPageView>[1];
|
||||
sources: ShootPageSources;
|
||||
}) => shootPageView(c.id, c.page, c.sources) as ShootPageView;
|
||||
|
||||
const plain = (text: RichText) =>
|
||||
text.map((piece) => (typeof piece === 'string' ? piece : piece.text));
|
||||
|
||||
// Every text in which placeholders are filled in
|
||||
const filledTexts = (view: ShootPageView) => [
|
||||
...view.stories.flatMap((story) => [
|
||||
story.eyebrow,
|
||||
story.title,
|
||||
...story.paragraphs.flatMap(plain),
|
||||
]),
|
||||
...view.process.steps.map((step) => step.text),
|
||||
...(view.faq?.items ?? []).flatMap((item) => [
|
||||
item.question,
|
||||
...plain(item.answer),
|
||||
]),
|
||||
view.offer.depositNote,
|
||||
];
|
||||
|
||||
// The photos the story blocks and the package block show
|
||||
const usedElsewhere = (view: ShootPageView): ContentImage[] => [
|
||||
...view.stories.flatMap((story) =>
|
||||
story.image === undefined ? [] : [story.image],
|
||||
),
|
||||
view.offer.image,
|
||||
];
|
||||
|
||||
describe('shootPageView with the real content', () => {
|
||||
it('builds the newborn page with its package, filled texts and mosaic', () => {
|
||||
const view = shootPageView('newborn', newbornPage, sources)!;
|
||||
expect(view.path).toBe('/soorten-fotoshoots/newborn');
|
||||
expect(view.breadcrumb).toEqual({
|
||||
label: 'Kruimelpad',
|
||||
items: [
|
||||
{ label: 'Home', to: '/' },
|
||||
{ label: 'Soorten fotoshoots', to: '/soorten-fotoshoots' },
|
||||
{ label: 'Newborn', to: '/soorten-fotoshoots/newborn' },
|
||||
],
|
||||
});
|
||||
expect(view.offer.pkg?.price).toBe(185);
|
||||
expect(view.offer.bookLink).toEqual({
|
||||
to: '/contact',
|
||||
search: { pakket: 'newborn' },
|
||||
});
|
||||
expect(view.closing.link).toEqual(view.offer.bookLink);
|
||||
expect(view.offer.askLink).toEqual({ to: '/contact' });
|
||||
expect(view.offer.depositNote).toBe(
|
||||
`Aanbetaling €${NBSP}50, restbedrag na de shoot.`,
|
||||
);
|
||||
expect(view.offer.image).toBe(shootTypes[0].detailImage);
|
||||
expect(view.process.steps.map((step) => step.id)).toEqual(
|
||||
PROCESS_STEP_ORDER,
|
||||
);
|
||||
expect(view.process.steps[0].text).toBe(
|
||||
'Stuur een berichtje. Ik reageer binnen 1-2 werkdagen.',
|
||||
);
|
||||
expect(view.process.steps[2].text).toBe(
|
||||
`Met een aanbetaling van €${NBSP}50 staat je datum vast.`,
|
||||
);
|
||||
expect(view.process.steps[3].text).toBe(newbornPage.process.duration);
|
||||
// The sleeping baby is in a story block already (D14)
|
||||
expect(view.photos?.images).toEqual(
|
||||
newbornPage.photos.images.filter(
|
||||
(image) => image.src !== sleepingBaby,
|
||||
),
|
||||
);
|
||||
expect(view.photos?.images).toHaveLength(3);
|
||||
expect(view.photos?.portfolioLink).toEqual({
|
||||
to: '/portfolio',
|
||||
search: { shoot: 'newborn' },
|
||||
});
|
||||
expect(view.faq?.items.length).toBe(newbornPage.faq.items.length);
|
||||
});
|
||||
|
||||
it('builds the loveshoot page without package and without mosaic', () => {
|
||||
const view = shootPageView('loveshoot', loveshootPage, sources)!;
|
||||
expect(view.offer.pkg).toBeUndefined();
|
||||
expect(view).not.toHaveProperty('offer.pkg');
|
||||
expect(view.offer.bookLink).toEqual({ to: '/contact' });
|
||||
expect(view.closing.link).toEqual({ to: '/contact' });
|
||||
expect(view.offer.onRequest.price).toBe('Prijs op aanvraag');
|
||||
expect(view.photos).toBeUndefined();
|
||||
expect(view.breadcrumb.items.at(-1)).toEqual({
|
||||
label: 'Loveshoot',
|
||||
to: '/soorten-fotoshoots/loveshoot',
|
||||
});
|
||||
});
|
||||
|
||||
it('gives undefined for a missing shoot type or content of another shoot', () => {
|
||||
expect(
|
||||
shootPageView('newborn', newbornPage, {
|
||||
...sources,
|
||||
shootTypes: shootTypes.filter(
|
||||
(shoot) => shoot.id !== 'newborn',
|
||||
),
|
||||
}),
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
shootPageView('loveshoot', newbornPage, sources),
|
||||
).toBeUndefined();
|
||||
});
|
||||
|
||||
it('leaves out the FAQ without questions and the portfolio link when the portfolio does not show the shoot', () => {
|
||||
const view = shootPageView(
|
||||
'newborn',
|
||||
{ ...newbornPage, faq: { ...newbornPage.faq, items: [] } },
|
||||
{ ...sources, portfolioShoots: [] },
|
||||
)!;
|
||||
expect(view.faq).toBeUndefined();
|
||||
expect(view.photos).toBeDefined();
|
||||
expect(view.photos).not.toHaveProperty('portfolioLink');
|
||||
});
|
||||
});
|
||||
|
||||
describe('shootPageView', () => {
|
||||
it('is undefined exactly when the shoot type is missing or the content is of another shoot (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(viewCase, ({ id, page, sources: given }) => {
|
||||
const view = shootPageView(id, page, given);
|
||||
const exists =
|
||||
page.id === id &&
|
||||
given.shootTypes.some((shoot) => shoot.id === id);
|
||||
expect(view !== undefined).toBe(exists);
|
||||
if (view !== undefined) {
|
||||
expect(view.id).toBe(id);
|
||||
expect(view.shoot.id).toBe(id);
|
||||
expect(view.path).toBe(shootPagePath(id));
|
||||
}
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('always has the six steps in their fixed order, whatever the content order (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(resolvedCase, (c) => {
|
||||
const view = build(c);
|
||||
expect(view.process.steps.map((step) => step.id)).toEqual(
|
||||
PROCESS_STEP_ORDER,
|
||||
);
|
||||
view.process.steps.forEach((step) => {
|
||||
expect(step.title).toBe(
|
||||
c.sources.shared.process.steps[step.id].title,
|
||||
);
|
||||
});
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('leaves no known placeholder in any text (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(resolvedCase, (c) => {
|
||||
for (const text of filledTexts(build(c))) {
|
||||
for (const name of knownPlaceholders) {
|
||||
expect(text).not.toContain(`{${name}}`);
|
||||
}
|
||||
}
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('shows each remaining page photo once, in order, never one used elsewhere, or no photos below the minimum (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(resolvedCase, (c) => {
|
||||
const view = build(c);
|
||||
const used = new Set(usedElsewhere(view).map((i) => i.src));
|
||||
const remaining = new Set(
|
||||
c.page.photos.images
|
||||
.map((image) => image.src)
|
||||
.filter((src) => !used.has(src)),
|
||||
);
|
||||
if (remaining.size < MOSAIC_MIN_PHOTOS) {
|
||||
expect(view.photos).toBeUndefined();
|
||||
return;
|
||||
}
|
||||
const images = view.photos!.images;
|
||||
const srcs = images.map((image) => image.src);
|
||||
expect(new Set(srcs).size).toBe(srcs.length);
|
||||
expect(new Set(srcs)).toEqual(remaining);
|
||||
expect(srcs.some((src) => used.has(src))).toBe(false);
|
||||
// An ordered subset: each photo is a page photo, found
|
||||
// after the one before it
|
||||
let from = 0;
|
||||
for (const image of images) {
|
||||
const at = c.page.photos.images.indexOf(image, from);
|
||||
expect(at).toBeGreaterThanOrEqual(from);
|
||||
from = at + 1;
|
||||
}
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('shows the package exactly when shootPackage finds one (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(resolvedCase, (c) => {
|
||||
const view = build(c);
|
||||
expect(view.offer.pkg).toBe(
|
||||
shootPackage(view.shoot, c.sources.packages),
|
||||
);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('only ever preselects a shown package (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(resolvedCase, (c) => {
|
||||
const view = build(c);
|
||||
const shown = visiblePackages(c.sources.packages).map(
|
||||
(pkg) => pkg.id,
|
||||
);
|
||||
for (const link of [view.offer.bookLink, view.closing.link]) {
|
||||
expect(link.to).toBe('/contact');
|
||||
if (link.search !== undefined) {
|
||||
expect(shown).toContain(link.search.pakket);
|
||||
expect(link.search.pakket).toBe(view.offer.pkg?.id);
|
||||
}
|
||||
}
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('ends the breadcrumb with this page, after Home and the overview (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(resolvedCase, (c) => {
|
||||
const view = build(c);
|
||||
expect(view.breadcrumb.items.map((item) => item.to)).toEqual([
|
||||
'/',
|
||||
'/soorten-fotoshoots',
|
||||
view.path,
|
||||
]);
|
||||
expect(view.breadcrumb.items.at(-1)?.label).toBe(
|
||||
view.shoot.name,
|
||||
);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('links the photos to the portfolio exactly when the portfolio shows the shoot (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(resolvedCase, (c) => {
|
||||
const view = build(c);
|
||||
if (view.photos === undefined) return;
|
||||
expect(view.photos.portfolioLink !== undefined).toBe(
|
||||
c.sources.portfolioShoots.includes(c.id),
|
||||
);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('has a FAQ exactly when there are questions, all of them in order (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(resolvedCase, (c) => {
|
||||
const view = build(c);
|
||||
expect(view.faq !== undefined).toBe(
|
||||
c.page.faq.items.length > 0,
|
||||
);
|
||||
expect((view.faq?.items ?? []).map((item) => item.id)).toEqual(
|
||||
c.page.faq.items.map((item) => item.id),
|
||||
);
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,232 @@
|
||||
import type {
|
||||
ContentImage,
|
||||
FaqItem,
|
||||
PricingPackage,
|
||||
ProcessStepId,
|
||||
RichText,
|
||||
ShootPageContent,
|
||||
ShootPageShared,
|
||||
ShootType,
|
||||
ShootTypeId,
|
||||
SiteContent,
|
||||
StoryBlock,
|
||||
} from '../content/types.ts';
|
||||
import type { RoutePath } from '../navigation.ts';
|
||||
import { fillPlaceholders, fillRichText } from './fillPlaceholders.ts';
|
||||
import { formatPrice } from './formatPrice.ts';
|
||||
import { shootContactLink, shootPortfolioLink } from './shootLinks.ts';
|
||||
import { shootPackage } from './shootPackage.ts';
|
||||
import {
|
||||
SHOOT_TYPES_PATH,
|
||||
shootPagePath,
|
||||
type ShootPagePath,
|
||||
} from './shootPages.ts';
|
||||
|
||||
// The six steps of the process timeline, always in this order (FR-ST-04)
|
||||
export const PROCESS_STEP_ORDER: readonly ProcessStepId[] = [
|
||||
'aanvragen',
|
||||
'datum',
|
||||
'aanbetaling',
|
||||
'shoot',
|
||||
'bewerking',
|
||||
'oplevering',
|
||||
];
|
||||
|
||||
// The fewest photos the photo section needs; with fewer left it is not
|
||||
// shown (D15). Proposed 2, confirmed in Functional Design of unit 2.
|
||||
export const MOSAIC_MIN_PHOTOS = 2;
|
||||
|
||||
export interface BreadcrumbItem {
|
||||
label: string;
|
||||
to: RoutePath;
|
||||
}
|
||||
|
||||
export interface ProcessStep {
|
||||
id: ProcessStepId;
|
||||
title: string;
|
||||
text: string;
|
||||
}
|
||||
|
||||
// Everything a shoot page is built from besides its own content
|
||||
export interface ShootPageSources {
|
||||
shootTypes: readonly ShootType[];
|
||||
packages: readonly PricingPackage[];
|
||||
shared: ShootPageShared;
|
||||
site: SiteContent;
|
||||
// The shoot types that link to the portfolio (live and with photos)
|
||||
portfolioShoots: readonly ShootTypeId[];
|
||||
}
|
||||
|
||||
// A shoot page with everything decided: placeholders filled, steps in
|
||||
// order, photos chosen, package and links resolved. The sections and the
|
||||
// structured data are both built from it, so they cannot disagree (D9).
|
||||
export interface ShootPageView {
|
||||
id: ShootTypeId;
|
||||
path: ShootPagePath;
|
||||
shoot: ShootType;
|
||||
// The last item is this page
|
||||
breadcrumb: { label: string; items: BreadcrumbItem[] };
|
||||
intro: ShootPageContent['intro'];
|
||||
stories: StoryBlock[];
|
||||
// Always six, in PROCESS_STEP_ORDER
|
||||
process: {
|
||||
eyebrow: string;
|
||||
title: string;
|
||||
lead: string;
|
||||
steps: ProcessStep[];
|
||||
};
|
||||
// Left out below MOSAIC_MIN_PHOTOS; no photo that is used elsewhere on
|
||||
// the page
|
||||
photos?: {
|
||||
eyebrow: string;
|
||||
title: string;
|
||||
images: ContentImage[];
|
||||
portfolioLink?: ReturnType<typeof shootPortfolioLink>;
|
||||
};
|
||||
// Left out when there are no questions
|
||||
faq?: { eyebrow: string; title: string; lead: RichText; items: FaqItem[] };
|
||||
offer: {
|
||||
eyebrow: string;
|
||||
title: string;
|
||||
// The shoot's detail photo, else its main photo
|
||||
image: ContentImage;
|
||||
// Present exactly when the shoot's package is shown
|
||||
pkg?: PricingPackage;
|
||||
onRequest: ShootPageShared['offer']['onRequest'];
|
||||
bookLabel: string;
|
||||
askLabel: string;
|
||||
bookLink: ReturnType<typeof shootContactLink>;
|
||||
askLink: { to: '/contact' };
|
||||
depositNote: string;
|
||||
};
|
||||
closing: {
|
||||
title: string;
|
||||
lead: RichText;
|
||||
buttonLabel: string;
|
||||
link: ReturnType<typeof shootContactLink>;
|
||||
};
|
||||
}
|
||||
|
||||
// The page photos left for the photo section: without the photos the story
|
||||
// blocks and the package block already show, each photo once, in their own
|
||||
// order (D14)
|
||||
function remainingPhotos(
|
||||
photos: readonly ContentImage[],
|
||||
usedElsewhere: readonly ContentImage[],
|
||||
): ContentImage[] {
|
||||
const taken = new Set(usedElsewhere.map((image) => image.src));
|
||||
return photos.filter((image) => {
|
||||
if (taken.has(image.src)) return false;
|
||||
taken.add(image.src);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
// The view of one shoot page, or undefined when the shoot type is missing
|
||||
// or the content belongs to another shoot; the route then shows the
|
||||
// not-found page (SECURITY-15)
|
||||
export function shootPageView(
|
||||
id: ShootTypeId,
|
||||
page: ShootPageContent,
|
||||
sources: ShootPageSources,
|
||||
): ShootPageView | undefined {
|
||||
const shoot = sources.shootTypes.find((item) => item.id === id);
|
||||
if (shoot === undefined || page.id !== id) return undefined;
|
||||
|
||||
const { shared, site, packages } = sources;
|
||||
const path = shootPagePath(id);
|
||||
|
||||
// Every figure that is data comes from its own source (D8, NFR-ST-04)
|
||||
const values = {
|
||||
reactietermijn: site.contactForm.replyTime,
|
||||
aanbetaling: formatPrice(shared.deposit.amount),
|
||||
locatie: page.process.location,
|
||||
duur: page.process.duration,
|
||||
opleverduur: page.process.deliveryTime,
|
||||
};
|
||||
const fill = (text: string) => fillPlaceholders(text, values);
|
||||
|
||||
const stories = page.stories.map((story) => ({
|
||||
...story,
|
||||
eyebrow: fill(story.eyebrow),
|
||||
title: fill(story.title),
|
||||
paragraphs: story.paragraphs.map((text) => fillRichText(text, values)),
|
||||
}));
|
||||
const faqItems = page.faq.items.map((item) => ({
|
||||
...item,
|
||||
question: fill(item.question),
|
||||
answer: fillRichText(item.answer, values),
|
||||
}));
|
||||
|
||||
const offerImage = shoot.detailImage ?? shoot.image;
|
||||
const photos = remainingPhotos(page.photos.images, [
|
||||
...stories.flatMap((story) =>
|
||||
story.image === undefined ? [] : [story.image],
|
||||
),
|
||||
offerImage,
|
||||
]);
|
||||
|
||||
const pkg = shootPackage(shoot, packages);
|
||||
const contactLink = shootContactLink(shoot, packages);
|
||||
|
||||
return {
|
||||
id,
|
||||
path,
|
||||
shoot,
|
||||
breadcrumb: {
|
||||
label: shared.breadcrumb.label,
|
||||
items: [
|
||||
{ label: shared.breadcrumb.home, to: '/' },
|
||||
{ label: shared.breadcrumb.overview, to: SHOOT_TYPES_PATH },
|
||||
{ label: shoot.name, to: path },
|
||||
],
|
||||
},
|
||||
intro: page.intro,
|
||||
stories,
|
||||
process: {
|
||||
eyebrow: shared.process.eyebrow,
|
||||
title: shared.process.title,
|
||||
lead: shared.process.lead,
|
||||
steps: PROCESS_STEP_ORDER.map((stepId) => ({
|
||||
id: stepId,
|
||||
title: shared.process.steps[stepId].title,
|
||||
text: fill(shared.process.steps[stepId].text),
|
||||
})),
|
||||
},
|
||||
...(photos.length >= MOSAIC_MIN_PHOTOS
|
||||
? {
|
||||
photos: {
|
||||
eyebrow: shared.photos.eyebrow,
|
||||
title: page.photos.title,
|
||||
images: photos,
|
||||
...(sources.portfolioShoots.includes(id)
|
||||
? { portfolioLink: shootPortfolioLink(shoot) }
|
||||
: {}),
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
...(faqItems.length > 0
|
||||
? {
|
||||
faq: {
|
||||
eyebrow: shared.faq.eyebrow,
|
||||
title: page.faq.title,
|
||||
lead: shared.faq.lead,
|
||||
items: faqItems,
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
offer: {
|
||||
eyebrow: page.offer.eyebrow,
|
||||
title: page.offer.title,
|
||||
image: offerImage,
|
||||
...(pkg !== undefined ? { pkg } : {}),
|
||||
onRequest: shared.offer.onRequest,
|
||||
bookLabel: shared.offer.bookLabel,
|
||||
askLabel: shared.offer.askLabel,
|
||||
bookLink: contactLink,
|
||||
askLink: { to: '/contact' },
|
||||
depositNote: fill(shared.deposit.note),
|
||||
},
|
||||
closing: { ...page.closing, link: contactLink },
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
import fc from 'fast-check';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { shootTypeId, slugInput } from '../test/arbitraries';
|
||||
import {
|
||||
SHOOT_TYPE_IDS,
|
||||
SHOOT_TYPES_PATH,
|
||||
shootIdFromPath,
|
||||
shootIdFromSlug,
|
||||
shootPagePath,
|
||||
} from './shootPages';
|
||||
|
||||
// Paths as they could reach the app: a slug below the overview, with or
|
||||
// without slashes after it, the overview itself, or anything else
|
||||
const pathInput = fc.oneof(
|
||||
fc
|
||||
.tuple(
|
||||
slugInput.filter((slug) => typeof slug === 'string'),
|
||||
fc.constantFrom('', '/', '//'),
|
||||
)
|
||||
.map(([slug, end]) => `${SHOOT_TYPES_PATH}/${slug as string}${end}`),
|
||||
fc.constantFrom(SHOOT_TYPES_PATH, `${SHOOT_TYPES_PATH}/`, '/', ''),
|
||||
fc.string(),
|
||||
);
|
||||
|
||||
describe('shootPagePath and SHOOT_TYPE_IDS', () => {
|
||||
it('lists the five shoot types, each with a page below the overview', () => {
|
||||
expect(SHOOT_TYPE_IDS).toEqual([
|
||||
'newborn',
|
||||
'zwangerschap',
|
||||
'gezin',
|
||||
'loveshoot',
|
||||
'portret',
|
||||
]);
|
||||
expect(SHOOT_TYPE_IDS.map(shootPagePath)).toEqual([
|
||||
'/soorten-fotoshoots/newborn',
|
||||
'/soorten-fotoshoots/zwangerschap',
|
||||
'/soorten-fotoshoots/gezin',
|
||||
'/soorten-fotoshoots/loveshoot',
|
||||
'/soorten-fotoshoots/portret',
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('shootIdFromSlug', () => {
|
||||
it('knows every shoot type by its exact id', () => {
|
||||
for (const id of SHOOT_TYPE_IDS) {
|
||||
expect(shootIdFromSlug(id)).toBe(id);
|
||||
}
|
||||
});
|
||||
|
||||
it('ignores other cases, padding, slashes and non-text values', () => {
|
||||
expect(shootIdFromSlug('Newborn')).toBeUndefined();
|
||||
expect(shootIdFromSlug(' newborn')).toBeUndefined();
|
||||
expect(shootIdFromSlug('newborn/')).toBeUndefined();
|
||||
expect(shootIdFromSlug('onzin')).toBeUndefined();
|
||||
expect(shootIdFromSlug('constructor')).toBeUndefined();
|
||||
expect(shootIdFromSlug(['newborn'])).toBeUndefined();
|
||||
expect(shootIdFromSlug(undefined)).toBeUndefined();
|
||||
});
|
||||
|
||||
it('gives back the id it was given (round trip)', () => {
|
||||
fc.assert(
|
||||
fc.property(shootTypeId, (id) => {
|
||||
expect(shootIdFromSlug(id)).toBe(id);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('gives a known id for exactly that slug, or undefined, and never throws (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(slugInput, (slug) => {
|
||||
const result = shootIdFromSlug(slug);
|
||||
if (result !== undefined) {
|
||||
expect(SHOOT_TYPE_IDS).toContain(result);
|
||||
expect(result).toBe(slug);
|
||||
}
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('shootIdFromPath', () => {
|
||||
it('finds the shoot type of its page, with one trailing slash tolerated', () => {
|
||||
expect(shootIdFromPath('/soorten-fotoshoots/newborn')).toBe('newborn');
|
||||
expect(shootIdFromPath('/soorten-fotoshoots/portret')).toBe('portret');
|
||||
expect(shootIdFromPath('/soorten-fotoshoots/newborn/')).toBe('newborn');
|
||||
});
|
||||
|
||||
it('gives undefined for any other path', () => {
|
||||
expect(shootIdFromPath('/soorten-fotoshoots/onzin')).toBeUndefined();
|
||||
expect(shootIdFromPath('/soorten-fotoshoots')).toBeUndefined();
|
||||
expect(shootIdFromPath('/soorten-fotoshoots/')).toBeUndefined();
|
||||
expect(shootIdFromPath('/soorten-fotoshoots/Newborn')).toBeUndefined();
|
||||
expect(
|
||||
shootIdFromPath('/soorten-fotoshoots/newborn/extra'),
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
shootIdFromPath('/soorten-fotoshoots/newborn//'),
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
shootIdFromPath('/soorten-fotoshoots%2Fnewborn'),
|
||||
).toBeUndefined();
|
||||
expect(
|
||||
shootIdFromPath('/soorten-fotoshoots/newborn%2Fextra'),
|
||||
).toBeUndefined();
|
||||
expect(shootIdFromPath('/newborn')).toBeUndefined();
|
||||
expect(shootIdFromPath('')).toBeUndefined();
|
||||
});
|
||||
|
||||
it('gives back the id of every shoot page path (round trip)', () => {
|
||||
fc.assert(
|
||||
fc.property(shootTypeId, (id) => {
|
||||
expect(shootIdFromPath(shootPagePath(id))).toBe(id);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('gives a known id only for its exact page path, or undefined, and never throws (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(pathInput, (path) => {
|
||||
const result = shootIdFromPath(path);
|
||||
if (result !== undefined) {
|
||||
expect(SHOOT_TYPE_IDS).toContain(result);
|
||||
expect(shootPagePath(result)).toBe(
|
||||
path.endsWith('/') ? path.slice(0, -1) : path,
|
||||
);
|
||||
}
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,51 @@
|
||||
import type { ShootTypeId } from '../content/types.ts';
|
||||
import type { RoutePath } from '../navigation.ts';
|
||||
import { isShootTypeId } from './portfolioFilters.ts';
|
||||
|
||||
// The overview of all shoot types; each shoot page is one level below it
|
||||
export const SHOOT_TYPES_PATH = '/soorten-fotoshoots';
|
||||
|
||||
// Every shoot type id once. As a record, a new id in ShootTypeId is a type
|
||||
// error until it is listed here.
|
||||
const everyShootTypeId: Record<ShootTypeId, true> = {
|
||||
newborn: true,
|
||||
zwangerschap: true,
|
||||
gezin: true,
|
||||
loveshoot: true,
|
||||
portret: true,
|
||||
};
|
||||
|
||||
export const SHOOT_TYPE_IDS: readonly ShootTypeId[] = Object.keys(
|
||||
everyShootTypeId,
|
||||
) as ShootTypeId[];
|
||||
|
||||
export type ShootPagePath = `${typeof SHOOT_TYPES_PATH}/${ShootTypeId}`;
|
||||
|
||||
// The page of one shoot type, e.g. '/soorten-fotoshoots/newborn' (FR-ST-01)
|
||||
export function shootPagePath(id: ShootTypeId): ShootPagePath {
|
||||
return `${SHOOT_TYPES_PATH}/${id}`;
|
||||
}
|
||||
|
||||
// The inverse: a known id for exactly a known slug (letter case, spaces and
|
||||
// slashes count), anything else gives undefined; never throws (SECURITY-05)
|
||||
export function shootIdFromSlug(slug: unknown): ShootTypeId | undefined {
|
||||
return isShootTypeId(slug, SHOOT_TYPE_IDS) ? slug : undefined;
|
||||
}
|
||||
|
||||
// The shoot type of a shoot page path: exactly '/soorten-fotoshoots/<id>',
|
||||
// with one trailing slash tolerated; any other path gives undefined
|
||||
export function shootIdFromPath(pathname: string): ShootTypeId | undefined {
|
||||
const prefix = `${SHOOT_TYPES_PATH}/`;
|
||||
if (!pathname.startsWith(prefix)) return undefined;
|
||||
const rest = pathname.slice(prefix.length);
|
||||
return shootIdFromSlug(rest.endsWith('/') ? rest.slice(0, -1) : rest);
|
||||
}
|
||||
|
||||
type Assert<T extends true> = T;
|
||||
|
||||
// Compile-time guard: every shoot page path is a route. A new shoot type
|
||||
// without a route file is a type error here. Exported only because
|
||||
// noUnusedLocals rejects an unused local type.
|
||||
export type EveryShootHasARoute = Assert<
|
||||
ShootPagePath extends RoutePath ? true : false
|
||||
>;
|
||||
+124
-15
@@ -14,7 +14,12 @@ import { Route as ContactRouteImport } from './routes/contact'
|
||||
import { Route as OverMijRouteImport } from './routes/over-mij'
|
||||
import { Route as PortfolioRouteImport } from './routes/portfolio'
|
||||
import { Route as PrivacyverklaringRouteImport } from './routes/privacyverklaring'
|
||||
import { Route as SoortenFotoshootsRouteImport } from './routes/soorten-fotoshoots'
|
||||
import { Route as SoortenFotoshootsIndexRouteImport } from './routes/soorten-fotoshoots/index'
|
||||
import { Route as SoortenFotoshootsGezinRouteImport } from './routes/soorten-fotoshoots/gezin'
|
||||
import { Route as SoortenFotoshootsLoveshootRouteImport } from './routes/soorten-fotoshoots/loveshoot'
|
||||
import { Route as SoortenFotoshootsNewbornRouteImport } from './routes/soorten-fotoshoots/newborn'
|
||||
import { Route as SoortenFotoshootsPortretRouteImport } from './routes/soorten-fotoshoots/portret'
|
||||
import { Route as SoortenFotoshootsZwangerschapRouteImport } from './routes/soorten-fotoshoots/zwangerschap'
|
||||
|
||||
const IndexRoute = IndexRouteImport.update({
|
||||
id: '/',
|
||||
@@ -41,11 +46,40 @@ const PrivacyverklaringRoute = PrivacyverklaringRouteImport.update({
|
||||
path: '/privacyverklaring',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const SoortenFotoshootsRoute = SoortenFotoshootsRouteImport.update({
|
||||
id: '/soorten-fotoshoots',
|
||||
path: '/soorten-fotoshoots',
|
||||
const SoortenFotoshootsIndexRoute = SoortenFotoshootsIndexRouteImport.update({
|
||||
id: '/soorten-fotoshoots/',
|
||||
path: '/soorten-fotoshoots/',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const SoortenFotoshootsGezinRoute = SoortenFotoshootsGezinRouteImport.update({
|
||||
id: '/soorten-fotoshoots/gezin',
|
||||
path: '/soorten-fotoshoots/gezin',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const SoortenFotoshootsLoveshootRoute =
|
||||
SoortenFotoshootsLoveshootRouteImport.update({
|
||||
id: '/soorten-fotoshoots/loveshoot',
|
||||
path: '/soorten-fotoshoots/loveshoot',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const SoortenFotoshootsNewbornRoute =
|
||||
SoortenFotoshootsNewbornRouteImport.update({
|
||||
id: '/soorten-fotoshoots/newborn',
|
||||
path: '/soorten-fotoshoots/newborn',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const SoortenFotoshootsPortretRoute =
|
||||
SoortenFotoshootsPortretRouteImport.update({
|
||||
id: '/soorten-fotoshoots/portret',
|
||||
path: '/soorten-fotoshoots/portret',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const SoortenFotoshootsZwangerschapRoute =
|
||||
SoortenFotoshootsZwangerschapRouteImport.update({
|
||||
id: '/soorten-fotoshoots/zwangerschap',
|
||||
path: '/soorten-fotoshoots/zwangerschap',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
|
||||
export interface FileRoutesByFullPath {
|
||||
'/': typeof IndexRoute
|
||||
@@ -53,7 +87,12 @@ export interface FileRoutesByFullPath {
|
||||
'/over-mij': typeof OverMijRoute
|
||||
'/portfolio': typeof PortfolioRoute
|
||||
'/privacyverklaring': typeof PrivacyverklaringRoute
|
||||
'/soorten-fotoshoots': typeof SoortenFotoshootsRoute
|
||||
'/soorten-fotoshoots/gezin': typeof SoortenFotoshootsGezinRoute
|
||||
'/soorten-fotoshoots/loveshoot': typeof SoortenFotoshootsLoveshootRoute
|
||||
'/soorten-fotoshoots/newborn': typeof SoortenFotoshootsNewbornRoute
|
||||
'/soorten-fotoshoots/portret': typeof SoortenFotoshootsPortretRoute
|
||||
'/soorten-fotoshoots/zwangerschap': typeof SoortenFotoshootsZwangerschapRoute
|
||||
'/soorten-fotoshoots/': typeof SoortenFotoshootsIndexRoute
|
||||
}
|
||||
export interface FileRoutesByTo {
|
||||
'/': typeof IndexRoute
|
||||
@@ -61,7 +100,12 @@ export interface FileRoutesByTo {
|
||||
'/over-mij': typeof OverMijRoute
|
||||
'/portfolio': typeof PortfolioRoute
|
||||
'/privacyverklaring': typeof PrivacyverklaringRoute
|
||||
'/soorten-fotoshoots': typeof SoortenFotoshootsRoute
|
||||
'/soorten-fotoshoots/gezin': typeof SoortenFotoshootsGezinRoute
|
||||
'/soorten-fotoshoots/loveshoot': typeof SoortenFotoshootsLoveshootRoute
|
||||
'/soorten-fotoshoots/newborn': typeof SoortenFotoshootsNewbornRoute
|
||||
'/soorten-fotoshoots/portret': typeof SoortenFotoshootsPortretRoute
|
||||
'/soorten-fotoshoots/zwangerschap': typeof SoortenFotoshootsZwangerschapRoute
|
||||
'/soorten-fotoshoots': typeof SoortenFotoshootsIndexRoute
|
||||
}
|
||||
export interface FileRoutesById {
|
||||
__root__: typeof rootRouteImport
|
||||
@@ -70,7 +114,12 @@ export interface FileRoutesById {
|
||||
'/over-mij': typeof OverMijRoute
|
||||
'/portfolio': typeof PortfolioRoute
|
||||
'/privacyverklaring': typeof PrivacyverklaringRoute
|
||||
'/soorten-fotoshoots': typeof SoortenFotoshootsRoute
|
||||
'/soorten-fotoshoots/gezin': typeof SoortenFotoshootsGezinRoute
|
||||
'/soorten-fotoshoots/loveshoot': typeof SoortenFotoshootsLoveshootRoute
|
||||
'/soorten-fotoshoots/newborn': typeof SoortenFotoshootsNewbornRoute
|
||||
'/soorten-fotoshoots/portret': typeof SoortenFotoshootsPortretRoute
|
||||
'/soorten-fotoshoots/zwangerschap': typeof SoortenFotoshootsZwangerschapRoute
|
||||
'/soorten-fotoshoots/': typeof SoortenFotoshootsIndexRoute
|
||||
}
|
||||
export interface FileRouteTypes {
|
||||
fileRoutesByFullPath: FileRoutesByFullPath
|
||||
@@ -80,7 +129,12 @@ export interface FileRouteTypes {
|
||||
| '/over-mij'
|
||||
| '/portfolio'
|
||||
| '/privacyverklaring'
|
||||
| '/soorten-fotoshoots'
|
||||
| '/soorten-fotoshoots/gezin'
|
||||
| '/soorten-fotoshoots/loveshoot'
|
||||
| '/soorten-fotoshoots/newborn'
|
||||
| '/soorten-fotoshoots/portret'
|
||||
| '/soorten-fotoshoots/zwangerschap'
|
||||
| '/soorten-fotoshoots/'
|
||||
fileRoutesByTo: FileRoutesByTo
|
||||
to:
|
||||
| '/'
|
||||
@@ -88,6 +142,11 @@ export interface FileRouteTypes {
|
||||
| '/over-mij'
|
||||
| '/portfolio'
|
||||
| '/privacyverklaring'
|
||||
| '/soorten-fotoshoots/gezin'
|
||||
| '/soorten-fotoshoots/loveshoot'
|
||||
| '/soorten-fotoshoots/newborn'
|
||||
| '/soorten-fotoshoots/portret'
|
||||
| '/soorten-fotoshoots/zwangerschap'
|
||||
| '/soorten-fotoshoots'
|
||||
id:
|
||||
| '__root__'
|
||||
@@ -96,7 +155,12 @@ export interface FileRouteTypes {
|
||||
| '/over-mij'
|
||||
| '/portfolio'
|
||||
| '/privacyverklaring'
|
||||
| '/soorten-fotoshoots'
|
||||
| '/soorten-fotoshoots/gezin'
|
||||
| '/soorten-fotoshoots/loveshoot'
|
||||
| '/soorten-fotoshoots/newborn'
|
||||
| '/soorten-fotoshoots/portret'
|
||||
| '/soorten-fotoshoots/zwangerschap'
|
||||
| '/soorten-fotoshoots/'
|
||||
fileRoutesById: FileRoutesById
|
||||
}
|
||||
export interface RootRouteChildren {
|
||||
@@ -105,7 +169,12 @@ export interface RootRouteChildren {
|
||||
OverMijRoute: typeof OverMijRoute
|
||||
PortfolioRoute: typeof PortfolioRoute
|
||||
PrivacyverklaringRoute: typeof PrivacyverklaringRoute
|
||||
SoortenFotoshootsRoute: typeof SoortenFotoshootsRoute
|
||||
SoortenFotoshootsGezinRoute: typeof SoortenFotoshootsGezinRoute
|
||||
SoortenFotoshootsLoveshootRoute: typeof SoortenFotoshootsLoveshootRoute
|
||||
SoortenFotoshootsNewbornRoute: typeof SoortenFotoshootsNewbornRoute
|
||||
SoortenFotoshootsPortretRoute: typeof SoortenFotoshootsPortretRoute
|
||||
SoortenFotoshootsZwangerschapRoute: typeof SoortenFotoshootsZwangerschapRoute
|
||||
SoortenFotoshootsIndexRoute: typeof SoortenFotoshootsIndexRoute
|
||||
}
|
||||
|
||||
declare module '@tanstack/react-router' {
|
||||
@@ -145,11 +214,46 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof PrivacyverklaringRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/soorten-fotoshoots': {
|
||||
id: '/soorten-fotoshoots'
|
||||
'/soorten-fotoshoots/': {
|
||||
id: '/soorten-fotoshoots/'
|
||||
path: '/soorten-fotoshoots'
|
||||
fullPath: '/soorten-fotoshoots'
|
||||
preLoaderRoute: typeof SoortenFotoshootsRouteImport
|
||||
fullPath: '/soorten-fotoshoots/'
|
||||
preLoaderRoute: typeof SoortenFotoshootsIndexRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/soorten-fotoshoots/gezin': {
|
||||
id: '/soorten-fotoshoots/gezin'
|
||||
path: '/soorten-fotoshoots/gezin'
|
||||
fullPath: '/soorten-fotoshoots/gezin'
|
||||
preLoaderRoute: typeof SoortenFotoshootsGezinRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/soorten-fotoshoots/loveshoot': {
|
||||
id: '/soorten-fotoshoots/loveshoot'
|
||||
path: '/soorten-fotoshoots/loveshoot'
|
||||
fullPath: '/soorten-fotoshoots/loveshoot'
|
||||
preLoaderRoute: typeof SoortenFotoshootsLoveshootRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/soorten-fotoshoots/newborn': {
|
||||
id: '/soorten-fotoshoots/newborn'
|
||||
path: '/soorten-fotoshoots/newborn'
|
||||
fullPath: '/soorten-fotoshoots/newborn'
|
||||
preLoaderRoute: typeof SoortenFotoshootsNewbornRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/soorten-fotoshoots/portret': {
|
||||
id: '/soorten-fotoshoots/portret'
|
||||
path: '/soorten-fotoshoots/portret'
|
||||
fullPath: '/soorten-fotoshoots/portret'
|
||||
preLoaderRoute: typeof SoortenFotoshootsPortretRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/soorten-fotoshoots/zwangerschap': {
|
||||
id: '/soorten-fotoshoots/zwangerschap'
|
||||
path: '/soorten-fotoshoots/zwangerschap'
|
||||
fullPath: '/soorten-fotoshoots/zwangerschap'
|
||||
preLoaderRoute: typeof SoortenFotoshootsZwangerschapRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
}
|
||||
@@ -161,7 +265,12 @@ const rootRouteChildren: RootRouteChildren = {
|
||||
OverMijRoute: OverMijRoute,
|
||||
PortfolioRoute: PortfolioRoute,
|
||||
PrivacyverklaringRoute: PrivacyverklaringRoute,
|
||||
SoortenFotoshootsRoute: SoortenFotoshootsRoute,
|
||||
SoortenFotoshootsGezinRoute: SoortenFotoshootsGezinRoute,
|
||||
SoortenFotoshootsLoveshootRoute: SoortenFotoshootsLoveshootRoute,
|
||||
SoortenFotoshootsNewbornRoute: SoortenFotoshootsNewbornRoute,
|
||||
SoortenFotoshootsPortretRoute: SoortenFotoshootsPortretRoute,
|
||||
SoortenFotoshootsZwangerschapRoute: SoortenFotoshootsZwangerschapRoute,
|
||||
SoortenFotoshootsIndexRoute: SoortenFotoshootsIndexRoute,
|
||||
}
|
||||
export const routeTree = rootRouteImport
|
||||
._addFileChildren(rootRouteChildren)
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import packages from '../../content/packages';
|
||||
import portfolioContent from '../../content/portfolioContent';
|
||||
import shootPageShared from '../../content/shootPageShared';
|
||||
import shootTypes from '../../content/shootTypes';
|
||||
import siteContent from '../../content/siteContent';
|
||||
import { shootTypesWithPhotos } from '../../lib/portfolioFilters';
|
||||
import type { ShootPageSources } from '../../lib/shootPageView';
|
||||
import { isPortfolioLive } from '../../lib/shootLinks';
|
||||
import sitePages from '../../sitePages';
|
||||
|
||||
// What every shoot page is built from besides its own content. The file
|
||||
// name starts with '-' so the router does not take it for a route.
|
||||
export const shootPageSources: ShootPageSources = {
|
||||
shootTypes,
|
||||
packages,
|
||||
shared: shootPageShared,
|
||||
site: siteContent,
|
||||
// Same as on the overview: only shoots with photos in a live portfolio
|
||||
portfolioShoots: isPortfolioLive(sitePages)
|
||||
? shootTypesWithPhotos(shootTypes, portfolioContent.photos).map(
|
||||
(type) => type.id,
|
||||
)
|
||||
: [],
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import NotFound from '../../components/StatusPage/NotFound';
|
||||
import ShootPage from '../../components/shoots/ShootPage/ShootPage';
|
||||
import StructuredData from '../../components/StructuredData/StructuredData';
|
||||
import gezinPage from '../../content/shootPages/gezin';
|
||||
import siteContent from '../../content/siteContent';
|
||||
import { shootPageView } from '../../lib/shootPageView';
|
||||
import { pageHead, shootPageGraph } from '../../seo';
|
||||
import { shootPageSources } from './-shootPageSources';
|
||||
|
||||
export const Route = createFileRoute('/soorten-fotoshoots/gezin')({
|
||||
head: () => pageHead('/soorten-fotoshoots/gezin'),
|
||||
component: GezinPage,
|
||||
});
|
||||
|
||||
// The gezin page. The structured data lives here, not in head(): head() is
|
||||
// part of the main bundle, the component is split off, so the page texts
|
||||
// only load with this page.
|
||||
function GezinPage() {
|
||||
const view = shootPageView('gezin', gezinPage, shootPageSources);
|
||||
if (view === undefined) return <NotFound />;
|
||||
return (
|
||||
<>
|
||||
{shootPageGraph(view, siteContent).map((data) => (
|
||||
<StructuredData key={data['@type']} data={data} />
|
||||
))}
|
||||
<ShootPage view={view} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
+21
-25
@@ -1,20 +1,21 @@
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import CallToAction from '../components/CallToAction/CallToAction';
|
||||
import LinkButton from '../components/LinkButton';
|
||||
import PageIntro from '../components/PageIntro/PageIntro';
|
||||
import RichParagraph from '../components/RichParagraph/RichParagraph';
|
||||
import ShootList from '../components/shoots/ShootList/ShootList';
|
||||
import packages from '../content/packages';
|
||||
import portfolioContent from '../content/portfolioContent';
|
||||
import shootTypes from '../content/shootTypes';
|
||||
import shootTypesPageContent from '../content/shootTypesPageContent';
|
||||
import siteContent from '../content/siteContent';
|
||||
import { shootTypesWithPhotos } from '../lib/portfolioFilters';
|
||||
import { isPortfolioLive } from '../lib/shootLinks';
|
||||
import { jsonLdScript, pageHead, shootServices, webPage } from '../seo';
|
||||
import sitePages from '../sitePages';
|
||||
import CallToAction from '../../components/CallToAction/CallToAction';
|
||||
import LinkButton from '../../components/LinkButton';
|
||||
import PageIntro from '../../components/PageIntro/PageIntro';
|
||||
import RichParagraph from '../../components/RichParagraph/RichParagraph';
|
||||
import ShootList from '../../components/shoots/ShootList/ShootList';
|
||||
import StructuredData from '../../components/StructuredData/StructuredData';
|
||||
import packages from '../../content/packages';
|
||||
import portfolioContent from '../../content/portfolioContent';
|
||||
import shootTypes from '../../content/shootTypes';
|
||||
import shootTypesPageContent from '../../content/shootTypesPageContent';
|
||||
import siteContent from '../../content/siteContent';
|
||||
import { shootTypesWithPhotos } from '../../lib/portfolioFilters';
|
||||
import { isPortfolioLive } from '../../lib/shootLinks';
|
||||
import { pageHead, shootServices, webPage } from '../../seo';
|
||||
import sitePages from '../../sitePages';
|
||||
|
||||
export const Route = createFileRoute('/soorten-fotoshoots')({
|
||||
export const Route = createFileRoute('/soorten-fotoshoots/')({
|
||||
head: () => pageHead('/soorten-fotoshoots'),
|
||||
component: PhotoshootTypes,
|
||||
});
|
||||
@@ -28,16 +29,11 @@ function PhotoshootTypes() {
|
||||
{/* The structured data lives here, not in head(): head() is part
|
||||
of the main bundle, the component is split off, so the shoot
|
||||
texts only load with this page. Google reads JSON-LD anywhere
|
||||
in the page; jsonLdScript escapes <, > and &. */}
|
||||
<script
|
||||
type="application/ld+json"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: jsonLdScript(
|
||||
webPage('WebPage', '/soorten-fotoshoots', {
|
||||
mainEntity: shootServices(shootTypes, siteContent),
|
||||
}),
|
||||
),
|
||||
}}
|
||||
in the page; StructuredData escapes <, > and &. */}
|
||||
<StructuredData
|
||||
data={webPage('WebPage', '/soorten-fotoshoots', {
|
||||
mainEntity: shootServices(shootTypes, siteContent),
|
||||
})}
|
||||
/>
|
||||
<PageIntro eyebrow={head.eyebrow} title={head.title}>
|
||||
{head.intro}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import NotFound from '../../components/StatusPage/NotFound';
|
||||
import ShootPage from '../../components/shoots/ShootPage/ShootPage';
|
||||
import StructuredData from '../../components/StructuredData/StructuredData';
|
||||
import loveshootPage from '../../content/shootPages/loveshoot';
|
||||
import siteContent from '../../content/siteContent';
|
||||
import { shootPageView } from '../../lib/shootPageView';
|
||||
import { pageHead, shootPageGraph } from '../../seo';
|
||||
import { shootPageSources } from './-shootPageSources';
|
||||
|
||||
export const Route = createFileRoute('/soorten-fotoshoots/loveshoot')({
|
||||
head: () => pageHead('/soorten-fotoshoots/loveshoot'),
|
||||
component: LoveshootPage,
|
||||
});
|
||||
|
||||
// The loveshoot page. The structured data lives here, not in head(): head() is
|
||||
// part of the main bundle, the component is split off, so the page texts
|
||||
// only load with this page.
|
||||
function LoveshootPage() {
|
||||
const view = shootPageView('loveshoot', loveshootPage, shootPageSources);
|
||||
if (view === undefined) return <NotFound />;
|
||||
return (
|
||||
<>
|
||||
{shootPageGraph(view, siteContent).map((data) => (
|
||||
<StructuredData key={data['@type']} data={data} />
|
||||
))}
|
||||
<ShootPage view={view} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import NotFound from '../../components/StatusPage/NotFound';
|
||||
import ShootPage from '../../components/shoots/ShootPage/ShootPage';
|
||||
import StructuredData from '../../components/StructuredData/StructuredData';
|
||||
import newbornPage from '../../content/shootPages/newborn';
|
||||
import siteContent from '../../content/siteContent';
|
||||
import { shootPageView } from '../../lib/shootPageView';
|
||||
import { pageHead, shootPageGraph } from '../../seo';
|
||||
import { shootPageSources } from './-shootPageSources';
|
||||
|
||||
export const Route = createFileRoute('/soorten-fotoshoots/newborn')({
|
||||
head: () => pageHead('/soorten-fotoshoots/newborn'),
|
||||
component: NewbornPage,
|
||||
});
|
||||
|
||||
// The newborn page. The structured data lives here, not in head(): head() is
|
||||
// part of the main bundle, the component is split off, so the page texts
|
||||
// only load with this page.
|
||||
function NewbornPage() {
|
||||
const view = shootPageView('newborn', newbornPage, shootPageSources);
|
||||
if (view === undefined) return <NotFound />;
|
||||
return (
|
||||
<>
|
||||
{shootPageGraph(view, siteContent).map((data) => (
|
||||
<StructuredData key={data['@type']} data={data} />
|
||||
))}
|
||||
<ShootPage view={view} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import NotFound from '../../components/StatusPage/NotFound';
|
||||
import ShootPage from '../../components/shoots/ShootPage/ShootPage';
|
||||
import StructuredData from '../../components/StructuredData/StructuredData';
|
||||
import portretPage from '../../content/shootPages/portret';
|
||||
import siteContent from '../../content/siteContent';
|
||||
import { shootPageView } from '../../lib/shootPageView';
|
||||
import { pageHead, shootPageGraph } from '../../seo';
|
||||
import { shootPageSources } from './-shootPageSources';
|
||||
|
||||
export const Route = createFileRoute('/soorten-fotoshoots/portret')({
|
||||
head: () => pageHead('/soorten-fotoshoots/portret'),
|
||||
component: PortretPage,
|
||||
});
|
||||
|
||||
// The portret page. The structured data lives here, not in head(): head() is
|
||||
// part of the main bundle, the component is split off, so the page texts
|
||||
// only load with this page.
|
||||
function PortretPage() {
|
||||
const view = shootPageView('portret', portretPage, shootPageSources);
|
||||
if (view === undefined) return <NotFound />;
|
||||
return (
|
||||
<>
|
||||
{shootPageGraph(view, siteContent).map((data) => (
|
||||
<StructuredData key={data['@type']} data={data} />
|
||||
))}
|
||||
<ShootPage view={view} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import NotFound from '../../components/StatusPage/NotFound';
|
||||
import ShootPage from '../../components/shoots/ShootPage/ShootPage';
|
||||
import StructuredData from '../../components/StructuredData/StructuredData';
|
||||
import zwangerschapPage from '../../content/shootPages/zwangerschap';
|
||||
import siteContent from '../../content/siteContent';
|
||||
import { shootPageView } from '../../lib/shootPageView';
|
||||
import { pageHead, shootPageGraph } from '../../seo';
|
||||
import { shootPageSources } from './-shootPageSources';
|
||||
|
||||
export const Route = createFileRoute('/soorten-fotoshoots/zwangerschap')({
|
||||
head: () => pageHead('/soorten-fotoshoots/zwangerschap'),
|
||||
component: ZwangerschapPage,
|
||||
});
|
||||
|
||||
// The zwangerschap page. The structured data lives here, not in head(): head() is
|
||||
// part of the main bundle, the component is split off, so the page texts
|
||||
// only load with this page.
|
||||
function ZwangerschapPage() {
|
||||
const view = shootPageView(
|
||||
'zwangerschap',
|
||||
zwangerschapPage,
|
||||
shootPageSources,
|
||||
);
|
||||
if (view === undefined) return <NotFound />;
|
||||
return (
|
||||
<>
|
||||
{shootPageGraph(view, siteContent).map((data) => (
|
||||
<StructuredData key={data['@type']} data={data} />
|
||||
))}
|
||||
<ShootPage view={view} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
+313
-12
@@ -1,26 +1,38 @@
|
||||
import fc from 'fast-check';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import aboutContent from './content/aboutContent';
|
||||
import packages from './content/packages';
|
||||
import portfolioContent from './content/portfolioContent';
|
||||
import shootPageShared from './content/shootPageShared';
|
||||
import loveshootPage from './content/shootPages/loveshoot';
|
||||
import newbornPage from './content/shootPages/newborn';
|
||||
import shootTypes from './content/shootTypes';
|
||||
import siteContent from './content/siteContent';
|
||||
import { emailAddress } from './lib/emailAddress';
|
||||
import { richTextToPlain } from './lib/richTextToPlain';
|
||||
import { shootPagePath } from './lib/shootPages';
|
||||
import { shootPageView, type ShootPageView } from './lib/shootPageView';
|
||||
import { visibleSocials } from './lib/visibleSocials';
|
||||
import type { RoutePath } from './navigation';
|
||||
import {
|
||||
aboutPage,
|
||||
absoluteUrl,
|
||||
areaServed,
|
||||
breadcrumbList,
|
||||
businessId,
|
||||
canonicalUrl,
|
||||
contactPage,
|
||||
defaultOgImage,
|
||||
faqPage,
|
||||
galleryImages,
|
||||
jsonLdScript,
|
||||
pageHead,
|
||||
person,
|
||||
personId,
|
||||
professionalService,
|
||||
shootPageGraph,
|
||||
shootService,
|
||||
shootServiceId,
|
||||
shootServices,
|
||||
siteHead,
|
||||
siteUrl,
|
||||
@@ -31,9 +43,17 @@ import {
|
||||
import sitePages from './sitePages';
|
||||
import {
|
||||
anySiteContent,
|
||||
faqItems,
|
||||
knownRoutePath,
|
||||
knowsAboutEntries,
|
||||
plainText,
|
||||
portfolioPhotos,
|
||||
pricingPackage,
|
||||
routePath,
|
||||
shootPageContent,
|
||||
shootPageShared as anyShared,
|
||||
shootType,
|
||||
shootTypeId,
|
||||
uniqueShootTypes,
|
||||
} from './test/arbitraries';
|
||||
|
||||
@@ -487,11 +507,18 @@ describe('shootServices', () => {
|
||||
expect(list.numberOfItems).toBe(5);
|
||||
const services = list.itemListElement.map((element) => element.item);
|
||||
expect(services.map((service) => service['@id'])).toEqual([
|
||||
`${page}#newborn`,
|
||||
`${page}#zwangerschap`,
|
||||
`${page}#gezin`,
|
||||
`${page}#loveshoot`,
|
||||
`${page}#portret`,
|
||||
`${page}/newborn#service`,
|
||||
`${page}/zwangerschap#service`,
|
||||
`${page}/gezin#service`,
|
||||
`${page}/loveshoot#service`,
|
||||
`${page}/portret#service`,
|
||||
]);
|
||||
expect(services.map((service) => service.url)).toEqual([
|
||||
`${page}/newborn`,
|
||||
`${page}/zwangerschap`,
|
||||
`${page}/gezin`,
|
||||
`${page}/loveshoot`,
|
||||
`${page}/portret`,
|
||||
]);
|
||||
expect(services[0]).toMatchObject({
|
||||
'@type': 'Service',
|
||||
@@ -532,16 +559,21 @@ describe('shootServices', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('gives every service its own anchor as @id (invariant)', () => {
|
||||
it('gives every service the id and URL of its own shoot page (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(uniqueShootTypes, anySiteContent, (shoots, site) => {
|
||||
const ids = shootServices(shoots, site).itemListElement.map(
|
||||
(element) => element.item['@id'],
|
||||
);
|
||||
const services = shootServices(
|
||||
shoots,
|
||||
site,
|
||||
).itemListElement.map((element) => element.item);
|
||||
const ids = services.map((service) => service['@id']);
|
||||
expect(new Set(ids).size).toBe(ids.length);
|
||||
ids.forEach((id, index) =>
|
||||
expect(id).toBe(`${page}#${shoots[index].id}`),
|
||||
);
|
||||
services.forEach((service, index) => {
|
||||
expect(service['@id']).toBe(
|
||||
`${page}/${shoots[index].id}#service`,
|
||||
);
|
||||
expect(service.url).toBe(`${page}/${shoots[index].id}`);
|
||||
});
|
||||
}),
|
||||
);
|
||||
});
|
||||
@@ -578,6 +610,275 @@ describe('shootServices', () => {
|
||||
});
|
||||
});
|
||||
|
||||
// A shoot type with hostile text where the structured data shows it
|
||||
const hostileShoot = fc
|
||||
.tuple(shootType, plainText, plainText)
|
||||
.map(([shoot, label, description]) => ({
|
||||
...shoot,
|
||||
shootLabel: label,
|
||||
paragraphs: [description, ...shoot.paragraphs],
|
||||
}));
|
||||
|
||||
// Breadcrumb items as a page could have them: known routes, hostile labels
|
||||
const breadcrumbItems = fc.array(
|
||||
fc.record({ label: plainText, to: knownRoutePath }),
|
||||
{ maxLength: 5 },
|
||||
);
|
||||
|
||||
// The view of a shoot page from the real shoot types and packages, with
|
||||
// any shared texts, site content and page content
|
||||
const anyView = fc
|
||||
.tuple(shootTypeId, anyShared, anySiteContent)
|
||||
.chain(([id, shared, site]) =>
|
||||
shootPageContent(id).map(
|
||||
(page) =>
|
||||
shootPageView(id, page, {
|
||||
shootTypes,
|
||||
packages,
|
||||
shared,
|
||||
site,
|
||||
portfolioShoots: [],
|
||||
}) as ShootPageView,
|
||||
),
|
||||
);
|
||||
|
||||
const realView = (id: 'newborn' | 'loveshoot') =>
|
||||
shootPageView(id, id === 'newborn' ? newbornPage : loveshootPage, {
|
||||
shootTypes,
|
||||
packages,
|
||||
shared: shootPageShared,
|
||||
site: siteContent,
|
||||
portfolioShoots: [],
|
||||
})!;
|
||||
|
||||
// Survives the script tag unchanged, and never writes a markup character
|
||||
// or the e-mail address
|
||||
const expectSafeScript = (data: unknown, site: typeof siteContent) => {
|
||||
const script = jsonLdScript(data);
|
||||
expect(JSON.parse(script)).toEqual(data);
|
||||
expect(/[<>&]/.test(script)).toBe(false);
|
||||
const address = emailAddress(site.email);
|
||||
if (address !== null) expect(script).not.toContain(address);
|
||||
};
|
||||
|
||||
describe('shootService', () => {
|
||||
it('describes the newborn shoot with the offer of its package', () => {
|
||||
const newbornPackage = packages.find((pkg) => pkg.id === 'newborn');
|
||||
expect(
|
||||
shootService(shootTypes[0], siteContent, newbornPackage),
|
||||
).toMatchObject({
|
||||
'@type': 'Service',
|
||||
'@id': `${siteUrl}/soorten-fotoshoots/newborn#service`,
|
||||
url: `${siteUrl}/soorten-fotoshoots/newborn`,
|
||||
name: 'Newbornshoot',
|
||||
offers: { '@type': 'Offer', price: 185, priceCurrency: 'EUR' },
|
||||
});
|
||||
expect(shootServiceId('portret')).toBe(
|
||||
`${siteUrl}/soorten-fotoshoots/portret#service`,
|
||||
);
|
||||
});
|
||||
|
||||
it('is the same service on the overview and on the shoot page, with an offer only for a package (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(
|
||||
uniqueShootTypes,
|
||||
anySiteContent,
|
||||
fc.option(pricingPackage, { nil: undefined }),
|
||||
(shoots, site, pkg) => {
|
||||
const overview = shootServices(
|
||||
shoots,
|
||||
site,
|
||||
).itemListElement;
|
||||
shoots.forEach((shoot, index) => {
|
||||
const service = shootService(shoot, site, pkg);
|
||||
expect(overview[index].item['@id']).toBe(
|
||||
service['@id'],
|
||||
);
|
||||
expect(service['@id']).toBe(shootServiceId(shoot.id));
|
||||
expect(service.url).toBe(
|
||||
canonicalUrl(shootPagePath(shoot.id)),
|
||||
);
|
||||
expect('offers' in service).toBe(pkg !== undefined);
|
||||
if (pkg !== undefined) {
|
||||
expect(service.offers).toEqual({
|
||||
'@type': 'Offer',
|
||||
price: pkg.price,
|
||||
priceCurrency: 'EUR',
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
it('survives the script tag, without markup characters or e-mail address (round trip, invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(
|
||||
hostileShoot,
|
||||
anySiteContent,
|
||||
fc.option(pricingPackage, { nil: undefined }),
|
||||
(shoot, site, pkg) => {
|
||||
expectSafeScript(shootService(shoot, site, pkg), site);
|
||||
expectSafeScript(shootServices([shoot], site), site);
|
||||
},
|
||||
),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('breadcrumbList', () => {
|
||||
it('numbers the items from 1, with absolute URLs and the labels in order (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(breadcrumbItems, (items) => {
|
||||
const list = breadcrumbList(items);
|
||||
expect(list['@type']).toBe('BreadcrumbList');
|
||||
expect(
|
||||
list.itemListElement.map((element) => element.position),
|
||||
).toEqual(items.map((_, index) => index + 1));
|
||||
expect(
|
||||
list.itemListElement.map((element) => element.name),
|
||||
).toEqual(items.map((item) => item.label));
|
||||
list.itemListElement.forEach((element, index) => {
|
||||
expect(element.item.startsWith(`${siteUrl}/`)).toBe(true);
|
||||
expect(element.item).toBe(canonicalUrl(items[index].to));
|
||||
});
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('survives the script tag, without markup characters (round trip, invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(breadcrumbItems, (items) => {
|
||||
expectSafeScript(breadcrumbList(items), siteContent);
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('faqPage', () => {
|
||||
it('is left out without questions', () => {
|
||||
expect(faqPage('/contact', [])).toBeUndefined();
|
||||
});
|
||||
|
||||
it('has one question per item in order, answered by its visible text (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(knownRoutePath, faqItems, (path, items) => {
|
||||
const data = faqPage(path, items);
|
||||
if (data === undefined) {
|
||||
expect(items).toHaveLength(0);
|
||||
return;
|
||||
}
|
||||
expect(data.isPartOf).toEqual({ '@id': canonicalUrl(path) });
|
||||
expect(data.mainEntity).toEqual(
|
||||
items.map((item) => ({
|
||||
'@type': 'Question',
|
||||
name: item.question,
|
||||
acceptedAnswer: {
|
||||
'@type': 'Answer',
|
||||
text: richTextToPlain(item.answer),
|
||||
},
|
||||
})),
|
||||
);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('survives the script tag, without markup characters (round trip, invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(knownRoutePath, faqItems, (path, items) => {
|
||||
expectSafeScript(faqPage(path, items) ?? null, siteContent);
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('shootPageGraph', () => {
|
||||
it('describes the newborn page: its service with the package price, the breadcrumb and the FAQ', () => {
|
||||
const [page, faq] = shootPageGraph(realView('newborn'), siteContent);
|
||||
expect(page).toMatchObject({
|
||||
'@type': 'WebPage',
|
||||
'@id': `${siteUrl}/soorten-fotoshoots/newborn`,
|
||||
mainEntity: {
|
||||
'@type': 'Service',
|
||||
'@id': `${siteUrl}/soorten-fotoshoots/newborn#service`,
|
||||
url: `${siteUrl}/soorten-fotoshoots/newborn`,
|
||||
offers: { '@type': 'Offer', price: 185, priceCurrency: 'EUR' },
|
||||
},
|
||||
breadcrumb: {
|
||||
'@type': 'BreadcrumbList',
|
||||
itemListElement: [
|
||||
{ position: 1, name: 'Home', item: `${siteUrl}/` },
|
||||
{
|
||||
position: 2,
|
||||
name: 'Soorten fotoshoots',
|
||||
item: `${siteUrl}/soorten-fotoshoots`,
|
||||
},
|
||||
{
|
||||
position: 3,
|
||||
name: 'Newborn',
|
||||
item: `${siteUrl}/soorten-fotoshoots/newborn`,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
expect(faq).toMatchObject({
|
||||
'@type': 'FAQPage',
|
||||
isPartOf: { '@id': `${siteUrl}/soorten-fotoshoots/newborn` },
|
||||
});
|
||||
expect(faq).toHaveProperty(
|
||||
'mainEntity.length',
|
||||
newbornPage.faq.items.length,
|
||||
);
|
||||
});
|
||||
|
||||
it('describes the loveshoot page without an offer', () => {
|
||||
const graph = shootPageGraph(realView('loveshoot'), siteContent);
|
||||
expect(graph.map((data) => data['@type'])).toEqual([
|
||||
'WebPage',
|
||||
'FAQPage',
|
||||
]);
|
||||
expect(graph[0]).not.toHaveProperty('mainEntity.offers');
|
||||
expect(JSON.stringify(graph)).not.toMatch(/"(offers|price)"/);
|
||||
});
|
||||
|
||||
it('has the page, and the FAQPage exactly when the page has questions (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(anyView, anySiteContent, (view, site) => {
|
||||
const [page, ...rest] = shootPageGraph(view, site);
|
||||
expect(rest).toHaveLength(view.faq === undefined ? 0 : 1);
|
||||
expect(page).toHaveProperty(['@id'], canonicalUrl(view.path));
|
||||
expect(page).toHaveProperty(
|
||||
['mainEntity', '@id'],
|
||||
shootServiceId(view.id),
|
||||
);
|
||||
expect(page).toHaveProperty(
|
||||
'breadcrumb',
|
||||
breadcrumbList(view.breadcrumb.items),
|
||||
);
|
||||
if (view.offer.pkg === undefined) {
|
||||
expect(page).not.toHaveProperty('mainEntity.offers');
|
||||
} else {
|
||||
expect(page).toHaveProperty(
|
||||
'mainEntity.offers.price',
|
||||
view.offer.pkg.price,
|
||||
);
|
||||
}
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('survives the script tag, without markup characters or e-mail address (round trip, invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(anyView, anySiteContent, (view, site) => {
|
||||
for (const data of shootPageGraph(view, site)) {
|
||||
expectSafeScript(data, site);
|
||||
}
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('the contact page', () => {
|
||||
it('is indexed, with its own title, description and preview image', () => {
|
||||
const head = pageHead('/contact');
|
||||
|
||||
+92
-14
@@ -2,12 +2,18 @@
|
||||
// Titels en beschrijvingen staan in het pagina-register (sitePages.ts).
|
||||
import type {
|
||||
AboutPageContent,
|
||||
FaqItem,
|
||||
PortfolioPhoto,
|
||||
PricingPackage,
|
||||
ServiceArea,
|
||||
ShootType,
|
||||
ShootTypeId,
|
||||
SiteContent,
|
||||
} from './content/types.ts';
|
||||
import { knowsAboutList } from './lib/knowsAboutList.ts';
|
||||
import { richTextToPlain } from './lib/richTextToPlain.ts';
|
||||
import { shootPagePath } from './lib/shootPages.ts';
|
||||
import type { BreadcrumbItem, ShootPageView } from './lib/shootPageView.ts';
|
||||
import { visibleSocials } from './lib/visibleSocials.ts';
|
||||
import type { RoutePath } from './navigation.ts';
|
||||
import sitePages from './sitePages.ts';
|
||||
@@ -182,33 +188,105 @@ export function absoluteUrl(src: string): string {
|
||||
: siteUrl + (src.startsWith('/') ? src : `/${src}`);
|
||||
}
|
||||
|
||||
// One stable id per shoot service, used by the overview's list and by the
|
||||
// shoot page itself, so search engines see one entity (SEO-ST-03, D2)
|
||||
export function shootServiceId(id: ShootTypeId): string {
|
||||
return `${canonicalUrl(shootPagePath(id))}#service`;
|
||||
}
|
||||
|
||||
// A shoot type as a service of the business; its page is the shoot page.
|
||||
// The offer with its price only when the page shows that package (pkg), so
|
||||
// "Prijs op aanvraag" never gets one (SEO-ST-03).
|
||||
export function shootService(
|
||||
shoot: ShootType,
|
||||
site: SiteContent,
|
||||
pkg?: PricingPackage,
|
||||
) {
|
||||
return {
|
||||
'@type': 'Service',
|
||||
'@id': shootServiceId(shoot.id),
|
||||
url: canonicalUrl(shootPagePath(shoot.id)),
|
||||
name: shoot.shootLabel,
|
||||
serviceType: shoot.shootLabel,
|
||||
description: shoot.paragraphs[0],
|
||||
image: absoluteUrl(shoot.image.src),
|
||||
provider: { '@id': businessId },
|
||||
areaServed: areaServed(site.serviceArea),
|
||||
...(pkg !== undefined
|
||||
? {
|
||||
offers: {
|
||||
'@type': 'Offer',
|
||||
price: pkg.price,
|
||||
priceCurrency: 'EUR',
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
};
|
||||
}
|
||||
|
||||
// The shoot types as a list of services offered by the business, in page
|
||||
// order (BR-SF-10..15). Each service points to its own anchor on the page;
|
||||
// no prices, since the page does not show them.
|
||||
// order (BR-SF-10..15). Each service is the one of its shoot page; no
|
||||
// prices, since the overview does not show them.
|
||||
export function shootServices(shoots: readonly ShootType[], site: SiteContent) {
|
||||
const page = canonicalUrl('/soorten-fotoshoots');
|
||||
const area = areaServed(site.serviceArea);
|
||||
return {
|
||||
'@type': 'ItemList',
|
||||
numberOfItems: shoots.length,
|
||||
itemListElement: shoots.map((shoot, index) => ({
|
||||
'@type': 'ListItem',
|
||||
position: index + 1,
|
||||
item: {
|
||||
'@type': 'Service',
|
||||
'@id': `${page}#${shoot.id}`,
|
||||
url: `${page}#${shoot.id}`,
|
||||
name: shoot.shootLabel,
|
||||
serviceType: shoot.shootLabel,
|
||||
description: shoot.paragraphs[0],
|
||||
image: absoluteUrl(shoot.image.src),
|
||||
provider: { '@id': businessId },
|
||||
areaServed: area,
|
||||
item: shootService(shoot, site),
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
// The visible breadcrumb as schema.org data: positions from 1, each page as
|
||||
// an absolute URL (SEO-ST-03)
|
||||
export function breadcrumbList(items: readonly BreadcrumbItem[]) {
|
||||
return {
|
||||
'@type': 'BreadcrumbList',
|
||||
itemListElement: items.map((item, index) => ({
|
||||
'@type': 'ListItem',
|
||||
position: index + 1,
|
||||
name: item.label,
|
||||
item: canonicalUrl(item.to),
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
// The visible questions as a FAQPage, part of the page they are on; the
|
||||
// answers as plain text, links by their text (SEO-ST-03). Without
|
||||
// questions there is no FAQPage.
|
||||
export function faqPage(path: RoutePath, items: readonly FaqItem[]) {
|
||||
if (items.length === 0) return undefined;
|
||||
return {
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'FAQPage',
|
||||
isPartOf: { '@id': canonicalUrl(path) },
|
||||
inLanguage: 'nl-NL',
|
||||
mainEntity: items.map((item) => ({
|
||||
'@type': 'Question',
|
||||
name: item.question,
|
||||
acceptedAnswer: {
|
||||
'@type': 'Answer',
|
||||
text: richTextToPlain(item.answer),
|
||||
},
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
// The structured data of a shoot page, one object per script (D13): the
|
||||
// page with the shoot's service and the breadcrumb, and the FAQPage when
|
||||
// there are questions. Built from the same view as the visible page, so
|
||||
// the two cannot disagree.
|
||||
export function shootPageGraph(view: ShootPageView, site: SiteContent) {
|
||||
const page = webPage('WebPage', view.path, {
|
||||
mainEntity: shootService(view.shoot, site, view.offer.pkg),
|
||||
breadcrumb: breadcrumbList(view.breadcrumb.items),
|
||||
});
|
||||
const faq = faqPage(view.path, view.faq?.items ?? []);
|
||||
return faq === undefined ? [page] : [page, faq];
|
||||
}
|
||||
|
||||
// A head script tag with structured data, escaped by jsonLdScript (BR-SD-07)
|
||||
export function structuredDataScript(data: unknown) {
|
||||
return {
|
||||
|
||||
@@ -61,6 +61,46 @@ const sitePages: Record<RoutePath, PageMeta> = {
|
||||
alt: 'Een pasgeboren baby slaapt in een gestreept pakje',
|
||||
},
|
||||
},
|
||||
'/soorten-fotoshoots/newborn': {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
title: 'Newbornshoot in Huizen',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
description:
|
||||
"Newbornshoot in Huizen en omgeving, bij jou thuis in het rustige ritme van je baby. Warme, spontane foto's van Andrea Slop Fotografie.",
|
||||
indexed: true,
|
||||
},
|
||||
'/soorten-fotoshoots/zwangerschap': {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
title: 'Zwangerschapsshoot in Huizen',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
description:
|
||||
"Zwangerschapsshoot in Huizen en omgeving: leg deze bijzondere periode vast in spontane foto's. Ontdek de mogelijkheden van Andrea Slop Fotografie.",
|
||||
indexed: true,
|
||||
},
|
||||
'/soorten-fotoshoots/gezin': {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
title: 'Gezinsshoot in Huizen',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
description:
|
||||
'Gezinsshoot in Huizen en omgeving: echte momenten die laten zien hoe jullie nu samen zijn. Ontdek de mogelijkheden van Andrea Slop Fotografie.',
|
||||
indexed: true,
|
||||
},
|
||||
'/soorten-fotoshoots/loveshoot': {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
title: 'Loveshoot in Huizen',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
description:
|
||||
"Loveshoot in Huizen en omgeving: leg jullie liefde vast in spontane, kleurrijke foto's. Ontdek de mogelijkheden van Andrea Slop Fotografie.",
|
||||
indexed: true,
|
||||
},
|
||||
'/soorten-fotoshoots/portret': {
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
title: 'Portretshoot in Huizen',
|
||||
// DRAFT(CON-ST-03): awaiting Andrea's approval
|
||||
description:
|
||||
"Portretshoot in Huizen en omgeving, in de natuur of zakelijk. Spontane portretfoto's van Andrea Slop Fotografie.",
|
||||
indexed: true,
|
||||
},
|
||||
'/contact': {
|
||||
title: 'Contact – fotoshoot boeken in Huizen',
|
||||
description:
|
||||
|
||||
@@ -23,6 +23,11 @@ describe('sitemapXml', () => {
|
||||
`${base}/over-mij`,
|
||||
`${base}/portfolio`,
|
||||
`${base}/soorten-fotoshoots`,
|
||||
`${base}/soorten-fotoshoots/newborn`,
|
||||
`${base}/soorten-fotoshoots/zwangerschap`,
|
||||
`${base}/soorten-fotoshoots/gezin`,
|
||||
`${base}/soorten-fotoshoots/loveshoot`,
|
||||
`${base}/soorten-fotoshoots/portret`,
|
||||
`${base}/contact`,
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -4,17 +4,28 @@ import type { ContactFormEvent } from '../lib/contactFormReducer';
|
||||
import type { LightboxEvent } from '../lib/lightboxReducer';
|
||||
import type { Point } from '../lib/swipeDirection';
|
||||
import type {
|
||||
ContentImage,
|
||||
EmailAddress,
|
||||
FaqItem,
|
||||
GalleryItem,
|
||||
InlineLink,
|
||||
PortfolioPhoto,
|
||||
FrameColor,
|
||||
PricingPackage,
|
||||
ProcessStepContent,
|
||||
ProcessStepId,
|
||||
RichText,
|
||||
ShootPageContent,
|
||||
ShootPageShared,
|
||||
ShootType,
|
||||
ShootTypeId,
|
||||
SiteContent,
|
||||
SocialLink,
|
||||
StoryBlock,
|
||||
Testimonial,
|
||||
} from '../content/types';
|
||||
import type { RoutePath } from '../navigation';
|
||||
import sitePages from '../sitePages';
|
||||
|
||||
// Gedeelde generators voor de property-based tests (fast-check)
|
||||
|
||||
@@ -403,3 +414,262 @@ export const portfolioPhotos = fc.uniqueArray(portfolioPhoto, {
|
||||
selector: (photo) => photo.id,
|
||||
maxLength: 15,
|
||||
});
|
||||
|
||||
// --- Shoot pages ---
|
||||
|
||||
// The image shape of the content, as the shoot types and testimonials use it
|
||||
export const contentImage: fc.Arbitrary<ContentImage> = image;
|
||||
|
||||
// The placeholders the shoot pages fill in (see ShootPageShared)
|
||||
export const knownPlaceholders = [
|
||||
'reactietermijn',
|
||||
'aanbetaling',
|
||||
'locatie',
|
||||
'duur',
|
||||
'opleverduur',
|
||||
] as const;
|
||||
|
||||
// Known placeholder names and unknown ones, including names that exist on
|
||||
// every object (an own-property check must leave those alone)
|
||||
export const placeholderName = fc.oneof(
|
||||
fc.constantFrom(...knownPlaceholders),
|
||||
fc.constantFrom('constructor', 'toString', '__proto__', 'Duur', ' duur'),
|
||||
fc
|
||||
.stringMatching(/^[a-z]{1,12}$/)
|
||||
.filter(
|
||||
(name) => !(knownPlaceholders as readonly string[]).includes(name),
|
||||
),
|
||||
);
|
||||
|
||||
// Text without braces, with the characters that matter in a script tag or
|
||||
// JSON: </script>, <, >, &, quotes, backslashes and line separators
|
||||
export const plainText = fc.oneof(
|
||||
fc.string({ maxLength: 20 }).filter((text) => !/[{}]/.test(text)),
|
||||
fc.constantFrom('</script>', '<', '>', '&', '"', '\\', '
', ' '),
|
||||
);
|
||||
|
||||
// Text with placeholders in it, as an editor might write it. A stray brace
|
||||
// is only ever an opening one: an opening and a closing brace around a
|
||||
// filled placeholder could otherwise form a new one, which content never
|
||||
// contains.
|
||||
export const textWithPlaceholders = fc
|
||||
.array(
|
||||
fc.oneof(
|
||||
plainText,
|
||||
placeholderName.map((name) => `{${name}}`),
|
||||
fc.constant('{'),
|
||||
),
|
||||
{ maxLength: 6 },
|
||||
)
|
||||
.map((pieces) => pieces.join(''));
|
||||
|
||||
// Every route of the site
|
||||
export const knownRoutePath = fc.constantFrom(
|
||||
...(Object.keys(sitePages) as RoutePath[]),
|
||||
);
|
||||
|
||||
// A link inside running text: a known route, optionally an anchor
|
||||
export const inlineLink: fc.Arbitrary<InlineLink> = fc.record(
|
||||
{ to: knownRoutePath, hash: pathSegment, text: textWithPlaceholders },
|
||||
{ requiredKeys: ['to', 'text'] },
|
||||
);
|
||||
|
||||
// Running text as text pieces and links, hostile characters included
|
||||
export const richText: fc.Arbitrary<RichText> = fc.array(
|
||||
fc.oneof(textWithPlaceholders, inlineLink),
|
||||
{ maxLength: 5 },
|
||||
);
|
||||
|
||||
const slug = fc.stringMatching(/^[a-z0-9-]{1,12}$/);
|
||||
|
||||
// A story block, with or without an image
|
||||
export const storyBlock: fc.Arbitrary<StoryBlock> = fc.record(
|
||||
{
|
||||
id: slug,
|
||||
eyebrow: textWithPlaceholders,
|
||||
title: textWithPlaceholders,
|
||||
paragraphs: fc.array(richText, { minLength: 1, maxLength: 3 }),
|
||||
image: contentImage,
|
||||
},
|
||||
{ requiredKeys: ['id', 'eyebrow', 'title', 'paragraphs'] },
|
||||
);
|
||||
|
||||
export const faqItem: fc.Arbitrary<FaqItem> = fc.record({
|
||||
id: slug,
|
||||
question: textWithPlaceholders,
|
||||
answer: richText,
|
||||
});
|
||||
|
||||
// FAQ items with unique ids, as one page has them
|
||||
export const faqItems = fc.uniqueArray(faqItem, {
|
||||
selector: (item) => item.id,
|
||||
maxLength: 6,
|
||||
});
|
||||
|
||||
const processStepIds: ProcessStepId[] = [
|
||||
'aanvragen',
|
||||
'datum',
|
||||
'aanbetaling',
|
||||
'shoot',
|
||||
'bewerking',
|
||||
'oplevering',
|
||||
];
|
||||
|
||||
const processStepContent: fc.Arbitrary<ProcessStepContent> = fc.record({
|
||||
title: plainText,
|
||||
text: textWithPlaceholders,
|
||||
});
|
||||
|
||||
// All six steps, with the keys in a random order: the content's key order
|
||||
// must not decide the order on the page
|
||||
const processSteps: fc.Arbitrary<Record<ProcessStepId, ProcessStepContent>> = fc
|
||||
.tuple(
|
||||
fc.shuffledSubarray(processStepIds, {
|
||||
minLength: processStepIds.length,
|
||||
maxLength: processStepIds.length,
|
||||
}),
|
||||
fc.array(processStepContent, {
|
||||
minLength: processStepIds.length,
|
||||
maxLength: processStepIds.length,
|
||||
}),
|
||||
)
|
||||
.map(
|
||||
([order, steps]) =>
|
||||
Object.fromEntries(
|
||||
order.map((id, index) => [id, steps[index]]),
|
||||
) as Record<ProcessStepId, ProcessStepContent>,
|
||||
);
|
||||
|
||||
// The shared shoot page texts as the CMS could deliver them
|
||||
export const shootPageShared: fc.Arbitrary<ShootPageShared> = fc.record({
|
||||
breadcrumb: fc.record({
|
||||
label: plainText,
|
||||
home: plainText,
|
||||
overview: plainText,
|
||||
}),
|
||||
process: fc.record({
|
||||
eyebrow: plainText,
|
||||
title: plainText,
|
||||
lead: plainText,
|
||||
steps: processSteps,
|
||||
}),
|
||||
deposit: fc.record({
|
||||
amount: fc.integer({ min: 1, max: 999 }),
|
||||
note: textWithPlaceholders,
|
||||
}),
|
||||
photos: fc.record({ eyebrow: plainText }),
|
||||
faq: fc.record({ eyebrow: plainText, lead: richText }),
|
||||
offer: fc.record({
|
||||
bookLabel: plainText,
|
||||
askLabel: plainText,
|
||||
onRequest: fc.record({
|
||||
price: plainText,
|
||||
text: plainText,
|
||||
linkLabel: plainText,
|
||||
}),
|
||||
}),
|
||||
});
|
||||
|
||||
// One shoot page as the CMS could deliver it, for the given shoot or any.
|
||||
// The photos deliberately repeat each other, the story images and the
|
||||
// images in `reuse` (pass the shoot's main and detail photo), so the rule
|
||||
// that a photo appears once per page is put to the test.
|
||||
export function shootPageContent(
|
||||
id?: ShootTypeId,
|
||||
reuse: readonly ContentImage[] = [],
|
||||
): fc.Arbitrary<ShootPageContent> {
|
||||
const stories = fc.uniqueArray(storyBlock, {
|
||||
selector: (story) => story.id,
|
||||
maxLength: 6,
|
||||
});
|
||||
return stories.chain((storyList) => {
|
||||
const used = [
|
||||
...storyList.flatMap((story) =>
|
||||
story.image === undefined ? [] : [story.image],
|
||||
),
|
||||
...reuse,
|
||||
];
|
||||
const photo =
|
||||
used.length > 0
|
||||
? fc.oneof(contentImage, fc.constantFrom(...used))
|
||||
: contentImage;
|
||||
const photos = fc
|
||||
.tuple(
|
||||
fc.array(photo, { maxLength: 6 }),
|
||||
fc.array(fc.nat(), { maxLength: 2 }),
|
||||
)
|
||||
.map(([list, repeats]) =>
|
||||
list.length === 0
|
||||
? list
|
||||
: [...list, ...repeats.map((n) => list[n % list.length])],
|
||||
);
|
||||
return fc.record({
|
||||
id: id === undefined ? shootTypeId : fc.constant(id),
|
||||
intro: fc.record({
|
||||
eyebrow: plainText,
|
||||
title: plainText,
|
||||
text: plainText,
|
||||
}),
|
||||
stories: fc.constant(storyList),
|
||||
// The values of {locatie}, {duur} and {opleverduur}
|
||||
process: fc.record({
|
||||
location: plainText,
|
||||
duration: plainText,
|
||||
deliveryTime: plainText,
|
||||
}),
|
||||
photos: fc.record({ title: plainText, images: photos }),
|
||||
faq: fc.record({ title: plainText, items: faqItems }),
|
||||
offer: fc.record({ eyebrow: plainText, title: plainText }),
|
||||
closing: fc.record({
|
||||
title: plainText,
|
||||
lead: richText,
|
||||
buttonLabel: plainText,
|
||||
}),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// What could end up where a shoot slug is expected: the known ids, other
|
||||
// letter cases, slashes, '..', an encoded slash, whitespace, markup, any
|
||||
// string, and values that are no string at all
|
||||
export const slugInput: fc.Arbitrary<unknown> = fc.oneof(
|
||||
shootTypeId,
|
||||
shootTypeId.map((id) => id.toUpperCase()),
|
||||
shootTypeId.map((id) => id[0].toUpperCase() + id.slice(1)),
|
||||
fc
|
||||
.tuple(
|
||||
fc.constantFrom('', '/', '//', ' ', '\t', '..', '../', '%2F'),
|
||||
shootTypeId,
|
||||
fc.constantFrom(
|
||||
'',
|
||||
'/',
|
||||
'//',
|
||||
' ',
|
||||
'\n',
|
||||
'/..',
|
||||
'%2F',
|
||||
'</script>',
|
||||
),
|
||||
)
|
||||
.map((parts) => parts.join('')),
|
||||
fc.constantFrom(
|
||||
'',
|
||||
'..',
|
||||
'%2F',
|
||||
'</script>',
|
||||
'newborn/extra',
|
||||
'newborn%2Fextra',
|
||||
'onzin',
|
||||
'constructor',
|
||||
'__proto__',
|
||||
),
|
||||
fc.string(),
|
||||
fc.oneof(
|
||||
fc.integer(),
|
||||
fc.boolean(),
|
||||
fc.constant(null),
|
||||
fc.constant(undefined),
|
||||
fc.array(shootTypeId, { maxLength: 2 }),
|
||||
fc.object(),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { ChakraProvider } from '@chakra-ui/react';
|
||||
import {
|
||||
createMemoryHistory,
|
||||
createRouter,
|
||||
RouterProvider,
|
||||
} from '@tanstack/react-router';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { expect } from 'vitest';
|
||||
import ErrorPage from '../components/StatusPage/ErrorPage';
|
||||
import { routeTree } from '../routeTree.gen';
|
||||
import system from '../theme';
|
||||
|
||||
// De echte app: route tree, router-opties en thema zoals in main.tsx
|
||||
export async function renderApp(path: string) {
|
||||
const router = createRouter({
|
||||
routeTree,
|
||||
history: createMemoryHistory({ initialEntries: [path] }),
|
||||
scrollRestoration: true,
|
||||
defaultErrorComponent: ErrorPage,
|
||||
});
|
||||
await router.load();
|
||||
const result = render(
|
||||
<ChakraProvider value={system}>
|
||||
<RouterProvider router={router} />
|
||||
</ChakraProvider>,
|
||||
);
|
||||
return { ...result, router };
|
||||
}
|
||||
|
||||
export const expectShell = () => {
|
||||
expect(screen.getByRole('banner')).toBeInTheDocument();
|
||||
expect(screen.getByRole('contentinfo')).toBeInTheDocument();
|
||||
};
|
||||
Reference in New Issue
Block a user