Files
AndreaSlopFotografie/web/src/routes/index.tsx
T
SluijsensandClaude Opus 5.5 2c2e27e337 Makes the first render match the prerendered HTML
Search values, the 404 buttons and the footer year now apply after hydration.
The e-mail address stays out of the HTML behind a placeholder, and all review
texts are in the page, so crawlers can read them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 18:17:26 +01:00

67 lines
2.8 KiB
TypeScript

import { createFileRoute } from '@tanstack/react-router';
import Hero from '../components/Hero/Hero';
import InstagramGrid from '../components/InstagramGrid/InstagramGrid';
import AboutBlock from '../components/home/AboutBlock/AboutBlock';
import ContactSection from '../components/home/ContactSection/ContactSection';
import Pricing from '../components/home/Pricing/Pricing';
import Testimonials from '../components/home/Testimonials/Testimonials';
import IntroGallery from '../components/home/IntroGallery/IntroGallery';
import heroContent from '../content/heroContent';
import homeContent from '../content/homeContent';
import instagramContent from '../content/instagramContent';
import packages from '../content/packages';
import testimonials from '../content/testimonials';
import siteContent from '../content/siteContent';
import { visibleSocials } from '../lib/visibleSocials';
import useHydrated from '../hooks/useHydrated';
import { pageHead } from '../seo';
// ?pakket= from a "Boek" link on a price card. Only text is kept; whether it
// names a real package is checked against the shown packages (BR-PARAM-01).
type HomeSearch = { pakket?: string };
export const Route = createFileRoute('/')({
validateSearch: (search: Record<string, unknown>): HomeSearch =>
typeof search.pakket === 'string' ? { pakket: search.pakket } : {},
head: () => pageHead('/'),
component: Index,
});
// The homepage: the hero, then the sections in the order of LAYOUT.md
function Index() {
const { pakket: searched } = Route.useSearch();
// The search only counts after hydration, so the prerendered HTML and the
// first browser render agree (BR-HYD-10)
const pakket = useHydrated() ? searched : undefined;
// Without a valid https link the tiles would lead nowhere: no section
const instagram = visibleSocials(siteContent.socials).find(
(social) => social.platform === 'instagram',
);
return (
<>
<Hero content={heroContent} socials={siteContent.socials} />
<IntroGallery content={homeContent.intro} />
<AboutBlock content={homeContent.about} />
<Pricing content={homeContent.pricing} packages={packages} />
<Testimonials
content={homeContent.testimonials}
testimonials={testimonials}
/>
<ContactSection
content={homeContent.contact}
packages={packages}
enabled={siteContent.contactForm.enabled}
email={siteContent.email}
replyTime={siteContent.contactForm.replyTime}
pakket={pakket}
/>
{instagram && (
<InstagramGrid
content={instagramContent}
profileUrl={instagram.href}
/>
)}
</>
);
}