Lazy loading saved its bytes during page load, but left the logo empty for a moment when navigating to the homepage on a wide screen. Also adds the second unit's code summary and the shared docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 KiB
16 KiB
Code Structure
Build System
- Type: pnpm (
packageManager: pnpm@12.11.2, lockfileweb/pnpm-lock.yaml) - Configuration:
web/package.json— scriptsdev,build(tsc && vite buildand the script stepconfig/externalizeInlineScripts.ts; prerendering),preview(config/previewServer.ts),e2e(browser tests),test(vitest + coverage),lint,format:check,audit:deps,audit:dev,lighthouse,server-config, andcheck(all of them in sequence,e2eadded by prerendering)web/vite.config.ts— TanStack Start plugin with prerendering (prerendering; replaces the router plugin, code splitting included) before React plugin, sitemap plugin, security headers on dev/preview, Vitest config (jsdom, 20 s timeout, 100% coverage threshold forsrc/lib/**,seo.ts,sitemap.ts)web/tsconfig.json— bundler mode,@/*→src/*web/eslint.config.js— JS + typescript-eslint + react-hooks + jsx-a11y recommendedweb/.prettierrc— 4 spaces, single quotes, semicolonsweb/lighthouserc.cjs/.desktop.cjs— Lighthouse CI againstpnpm preview(accessibility and best practices 1.0, performance 0.9; home mobile 0.8).gitea/workflows/continuous_integration.yaml— jobscheck,deploy-test,lighthouse,deploy-production
Key Classes/Modules
graph TD
Root["routes/__root.tsx"] --> AppShell["components/AppShell.tsx"]
AppShell --> NavigationBar["NavigationBar/NavigationBar.tsx"]
AppShell --> Footer["Footer/Footer.tsx"]
AppShell --> BackToTop["BackToTop/BackToTop.tsx"]
AppShell --> Umami["Analytics/UmamiAnalytics.tsx"]
NavigationBar --> NavLink["NavigationBar/NavLink.tsx"]
NavigationBar --> MobileNav["NavigationBar/MobileNav.tsx"]
NavigationBar --> navigation["navigation.ts"]
Footer --> navigation
navigation --> shootNavItems["lib/shootNavItems.ts"]
navigation --> shootTypes["content/shootTypes.ts"]
Index["routes/index.tsx"] --> Hero["Hero/Hero.tsx"]
Hero --> HeroArrows["Hero/HeroArrows.tsx"]
Hero --> HeroPause["Hero/HeroPauseButton.tsx"]
Hero --> HeroSocials["Hero/HeroSocials.tsx"]
Hero --> useHeroSlider["Hero/useHeroSlider.ts"]
Hero --> LinkButton["components/LinkButton.tsx"]
LinkButton --> RouterLink["components/RouterLink.tsx"]
Index --> HomeParts["home/*: IntroGallery, AboutBlock, Pricing, Testimonials, ContactSection; shared InstagramGrid"]
HomeParts --> PageSection["PageSection/PageSection.tsx"]
HomeParts --> SectionHeading["SectionHeading/SectionHeading.tsx"]
HomeParts --> Reveal["Reveal/Reveal.tsx"]
HomeParts --> FramedImage["FramedImage/FramedImage.tsx"]
FramedImage --> DeferredImage["DeferredImage/DeferredImage.tsx"]
HomeParts --> DeferredImage
Placeholder["routes/over-mij.tsx and other placeholders"] --> PageIntro["PageIntro/PageIntro.tsx"]
classDef shell fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000;
classDef page fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000;
classDef util fill:#e2e8f0,stroke:#4a5568,stroke-width:1px,color:#000;
class Root,AppShell,NavigationBar,Footer,BackToTop,Umami,NavLink,MobileNav shell;
class Index,Hero,HeroArrows,HeroPause,HeroSocials,Placeholder,PageIntro,HomeParts page;
class navigation,shootNavItems,shootTypes,useHeroSlider,LinkButton,RouterLink,PageSection,SectionHeading,Reveal,FramedImage,DeferredImage util;
Text alternative: the root route renders AppShell (NavigationBar, Footer, BackToTop, Umami); NavigationBar and Footer read navigation.ts; the index route renders the Hero and the six home sections, which are built from the shared PageSection, SectionHeading, Reveal, FramedImage and DeferredImage blocks; placeholder routes render PageIntro.
Existing Files Inventory
Candidates for modification are marked with ★ for the over-mij-page feature.
web/index.htmlandweb/src/main.tsx— removed by prerendering; replaced bysrc/client.tsx(hydration entry, Sentry start),src/router.tsx(getRouter) and the document shell inroutes/__root.tsxweb/src/routes/$.tsx— catch-all route, rendersNotFound(prerendered as404.html; prerendering)web/src/routeTree.gen.ts— generated (do not edit)web/src/routes/__root.tsx— root layout, site head, 404/errorweb/src/routes/index.tsx— home (/): Hero + six sections,?pakket=search paramweb/src/routes/over-mij.tsx— the about page (indexed;AboutPageJSON-LD)web/src/components/about/*—AboutIntro,StorySectionweb/src/components/shoots/*—ShootList,ShootBlock(soorten-fotoshoots page; unit 2: "Lees meer over de …" link first in the row, to the shoot page)web/src/components/shoots/ShootPage/ShootPage.tsx— shoot page,ShootPageViewin: intro, then the sections inshootPageBandsorder (unit 2: stories, process, photos, FAQ, package, closing; wrapperdata-testid="shoot-page")web/src/components/shoots/{StoryBlocks,ProcessIcons}/— shoot page parts (unit 2): onePageSectionper story (StoryBlocks); the six process icons as inline SVG (ProcessIcons)web/src/components/{Breadcrumb,ProcessTimeline,PhotoMosaic,FaqList,PackageBlock}/— shoot page parts (unit 2), each with a testweb/src/components/StructuredData/StructuredData.tsx— JSON-LD script viajsonLdScript; the onlydangerouslySetInnerHTMLof the shoot pagesweb/src/components/{CallToAction,RichParagraph}/— shared closing block (unit 2 addstone); paragraph with inline linksweb/src/content/{shootTypes,shootTypesPageContent}.ts— shoot types (also used by the portfolio filters) and page texts;web/src/assets/shoots/— 4:5 shoot photosweb/src/lib/shootLinks.ts— contact and portfolio link targets per shoot typeweb/src/lib/{shootPages,shootPackage,fillPlaceholders,richTextToPlain,shootPageView}.ts— shoot page helpers (ids and paths, package, placeholders, plain text, view), each with a testweb/src/lib/{headingId,readMoreLabel,mosaicLayout,storyLayout,shootPageBands}.ts— shoot page helpers (unit 2): safe heading ids, "Lees meer" label, photo-mosaic and story layout, section bands; each with a test at 100 % coverageweb/src/lib/isShootSectionPath.ts— whether a pathname is under/soorten-fotoshoots/(FR-ST-14, used byStatusPage/NotFound), with a property-based testweb/src/lib/{shootNavItems,navCurrent,navMenuState}.ts— navigation helpers (unit 3), each with a test: submenu items from the shoot types (shootNavItems), current-page and section-current matching (isItemCurrent,isSectionCurrent), menu state reducer (navMenuReducer,NavMenuState,NavMenuEvent;navMenuState.tsat 100 % coverage)web/src/components/PhotoDuo/PhotoDuo.tsx— two photos side by sideweb/src/content/aboutContent.ts— about page content;web/src/assets/about/*— portrait and duo photos;web/public/og-over-mij.jpg— preview imageweb/src/routes/soorten-fotoshoots/index.tsx— the shoot types page (moved fromroutes/soorten-fotoshoots.tsx);newborn.tsx,zwangerschap.tsx,gezin.tsx,loveshoot.tsx,portret.tsx— one route per shoot page (/soorten-fotoshoots/<id>);-shootPageSources.ts— the sources the shoot routes shareweb/src/content/shootPageShared.ts— shared shoot page content (breadcrumb, process, deposit, shared FAQ items, offer texts);web/src/content/shootPages/*.ts— one content module per shoot page, plusshootPages.test.ts(content consistency)web/src/test/renderApp.tsx—renderApp(path)andexpectShell()for the route tests (prerendering: with a test shell instead of the document shell);web/src/test/hydrate.tsx— hydration helpers incl.hydrateAppAsStartweb/src/shootPages.test.tsx— route tests for the five shoot pages (unit 2): outline, sections, breadcrumb,aria-current(main and menus), package variants, OG registry, axe; the overview's "Lees meer" linksweb/src/routes/portfolio.tsx— the portfolio (indexed;?shoot=filter;ImageGalleryJSON-LD);web/src/components/portfolio/PortfolioGallery/,web/src/content/portfolioContent.ts,web/src/lib/portfolioFilters.ts,web/src/assets/portfolio/*(10 photos × 2 sizes),web/public/og-portfolio.jpgweb/src/routes/{contact,privacyverklaring}.tsx— placeholders withPageIntroweb/src/components/AppShell.tsx— shellweb/src/components/NavigationBar/*— header, NavLink (sectionCurrentunderline for the parent of an open section), MobileNav (scrolls; Escape returns focus to the hamburger), NavSubmenu (desktop disclosure panel), MobileNavGroup (expandable shoot list on mobile), ChevronIcon, NoScriptNav (two<noscript>menu links, display fallbacks)web/src/components/Footer/*— footer, FooterColumn, FooterLinkweb/src/components/Hero/*— hero slider, arrows, pause button, socials, slider hookweb/src/components/home/*— five homepage sections (AboutBlock is the closest relative of the Over mij page's first block)web/src/components/InstagramGrid/InstagramGrid.tsx— Instagram block, shared by the homepage and the portfolio (moved fromhome/in portfolio-page)- ★
web/src/components/PageSection/PageSection.tsx— section frame for any page (wasHomeSection) - ★
web/src/components/MediaText/MediaText.tsx,Eyebrow/Eyebrow.tsx— framed photo next to text; accent label (unit 2 addsmediaSize'medium') - ★
web/src/components/SectionHeading/SectionHeading.tsx— eyebrow + h2 + lead - ★
web/src/components/FramedImage/FramedImage.tsx,DeferredImage/DeferredImage.tsx,Reveal/Reveal.tsx— photo blocks and fade-in (display fallbacks:<noscript>twin, visible-by-defaultReveal); newweb/src/components/NoScript/(noScriptCss.ts,NoScriptStyles.tsx: all no-JavaScript CSS in one head<noscript><style>);data-requires-jsmarkers on controls that need JavaScript web/src/components/ContactForm/*— contact form and gateweb/src/components/BackToTop/BackToTop.tsx— back-to-top buttonweb/src/components/Analytics/UmamiAnalytics.tsx— Umami script injection- ★
web/src/components/PageIntro/PageIntro.tsx— page head block (eyebrow, h1, intro; unit 2 adds optionaltitleIdandbreadcrumb) web/src/components/StatusPage/*— StatusPage layout, NotFound (unit 2, FR-ST-14: under/soorten-fotoshoots/buttons back to the overview and to home, decided bylib/isShootSectionPath.ts), ErrorPage- ★
web/src/components/LinkButton.tsx,RouterLink.tsx— router links (button style / Chakra-wrapped) - ★
web/src/content/types.ts— content interfaces (API shape) - ★
web/src/content/*.ts— static content (siteContent,heroContent,homeContent(exportsintroPhotos),instagramContent,packages,testimonials,socialPlatforms) web/src/contact/*— contact form types and placeholder submitweb/src/hooks/*—useRouteFocus,useScrolledPast,useInView,usePageLoaded,useReveal,useSwipe(shared by the hero and the lightbox),useHydrated,useEmailAddress(prerendering: first render equals the prerendered HTML)web/src/hooks/useDismiss.ts— Escape and outside pointer down while active (useDismiss(ref, active, onDismiss)), used by NavSubmenu and MobileNav (unit 3)web/src/components/{PortfolioGrid,Lightbox,FilterBar}/— gallery building blocks (portfolio-page unit 2): masonry grid in reading order (CSS only), lightbox on ChakraDialog(lazy-loadable default export), single-choice toggle buttons; generic overGalleryItem/FilterOptionweb/src/lib/*.ts— pure helpers with testsweb/src/monitoring/*— Sentry/Umami config and loaderweb/src/navigation.ts—RoutePath,NavItem(withchildren, one level),hasChildren,mainNav(the shoot submenu comes fromshootTypesviashootNavItems),footerNav- ★
web/src/seo.ts(+preloadImage),web/src/lib/{revealPhase,firstRow}.ts,sitePages.ts,sitemap.ts— SEO (/over-mijisindexed: falsetoday) - ★
web/lighthouserc.cjs/.desktop.cjs— own list of indexed/noindex paths, guarded by a test web/src/theme.ts,web/src/recipes/*.ts— design systemweb/src/test/*—renderWithProviders, axe matcher, fast-check arbitraries,fakeIntersectionObserver, setupweb/src/test/navArbitraries.ts— navigation generators (menu events, menu states, pathnames; unit 3, not inlib/so the 100 % threshold does not apply);web/src/test/navViewport.ts— viewport helper (matchMediastub and thelgdisplay rules, because jsdom ignores@media)web/src/assets/*— hero photos (8),home/(intro 1–4, andrea, deco 1–2, two review photos), light/dark logosweb/config/securityHeaders.ts— CSPweb/config/serverConfig.ts,writeServerConfig.ts,sitemapPlugin.ts,testSeed.tsweb/config/{pageFiles,inlineScripts,externalizeInlineScripts,previewServer}.ts— prerendering: page file names, moving inline scripts to files after the build, preview server with the real server rules;web/e2e/andweb/vitest.e2e.config.ts— browser tests ondist/clientweb/deploy/iis/web.config,web/deploy/nginx/*.conf— generated server configsweb/public/*— favicon, logo, og-image, robots.txt, icons.svg;og-{newborn,zwangerschap,gezin,loveshoot,portret}.jpg(unit 2: 1200 × 630, the shoot pages'ogImage)
Design Patterns
API-shaped static content
- Location:
content/types.ts+content/*.ts - Purpose: Hard-coded today, swappable for API responses later
- Implementation: Plain data objects typed with interfaces, passed to components as props from the route (or AppShell)
Pure helpers with property-based tests
- Location:
lib/,seo.ts,sitemap.ts - Purpose: Logic that decides what is shown (e.g. invalid social → hidden, invalid e-mail → column omitted) lives outside components and is tested with fast-check
- Implementation: Small exported functions, 100% coverage threshold, shared arbitraries in
test/arbitraries.ts
Design tokens + recipes
- Location:
theme.ts,recipes/ - Purpose: Single source for colours, fonts, spacing, motion; reusable component variants
- Implementation:
defineConfigtokens/semanticTokens/textStyles,defineRecipe+useRecipe
Section composition
- Location:
components/home/*on top ofPageSection,MediaText,SectionHeading,Reveal,FramedImage,DeferredImage - Purpose: Each section is a thin component that gets its content as a prop and composes the shared blocks; the h2 id links the section landmark (
aria-labelledby) - Implementation: One
TITLE_IDconstant per section;data-testidon the section root; validity filters inlib/(e.g.visiblePackages) decide what is rendered
Deferred below-the-fold images
- Location:
DeferredImage,usePageLoaded,useInView - Purpose: Protect the largest contentful paint; photos load only after the load event and near the viewport, with intrinsic width/height reserving space
Page registry
- Location:
sitePages.ts, typed byRoutePath - Purpose: One source for head tags and the sitemap;
indexed: falsefor placeholders
Configuration as code for hosting
- Location:
config/securityHeaders.ts→config/serverConfig.ts→deploy/ - Purpose: Same headers in dev, preview, nginx (test) and IIS (production); a test guards drift
Accessibility by default
- Location: across components;
test/axe.tsin component tests; Lighthouse in CI - Implementation: landmarks, skip link, focus management, live regions, visible focus ring, 44px targets, reduced motion
Critical Dependencies
@chakra-ui/react ^3.37.0
- Usage: All layout and styling; typegen from
theme.tson install
@tanstack/react-router 1.170.46 (+ @tanstack/react-start 1.169.4; prerendering)
- Usage: File-based routes, static prerendering (Start),
Link,Outlet,HeadContent, typedRoutePath
@sentry/react ^11.8.0
- Usage: Error reporting, lazy-loaded after the load event
@iconify/react ^6.0.2 + @iconify-icons/ant-design 2.0.1
- Usage: Offline icons (bundled at build time)