Moves the app to TanStack Start with prerendering

Every page is now built as HTML from sitePages.ts, with a catch-all route for
404.html. Hooks that read the browser during render are safe for prerendering.
The script step that keeps the CSP intact follows, so this build still has
inline scripts and is not deployable yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-31 17:58:54 +01:00
co-authored by Claude Opus 5.5
parent 65c850e949
commit c1e90f0768
33 changed files with 746 additions and 269 deletions
+12 -17
View File
@@ -1,4 +1,4 @@
import { useEffect, useState } from 'react';
import { useState, useSyncExternalStore } from 'react';
import { useMediaQuery } from '@chakra-ui/react';
import useSwipe from '@/hooks/useSwipe';
import { wrapIndex } from '@/lib/wrapIndex';
@@ -12,6 +12,11 @@ import { wrapIndex } from '@/lib/wrapIndex';
// leest een nieuwe naam van de knop met focus niet altijd voor.
export type HeroAnnouncement = 'slide' | 'paused' | 'playing' | null;
const subscribeVisibility = (onChange: () => void) => {
document.addEventListener('visibilitychange', onChange);
return () => document.removeEventListener('visibilitychange', onChange);
};
export default function useHeroSlider(count: number) {
const [index, setIndex] = useState(0);
const [announcement, setAnnouncement] = useState<HeroAnnouncement>(null);
@@ -19,23 +24,13 @@ export default function useHeroSlider(count: number) {
const [stopped, setStopped] = useState(false);
const [hovered, setHovered] = useState(false);
const [focused, setFocused] = useState(false);
const [hidden, setHidden] = useState(() => document.hidden);
const [reducedMotion] = useMediaQuery(
['(prefers-reduced-motion: reduce)'],
{
ssr: false,
},
// Server and hydrating render say "visible", like the HTML
const hidden = useSyncExternalStore(
subscribeVisibility,
() => document.hidden,
() => false,
);
useEffect(() => {
const onVisibilityChange = () => setHidden(document.hidden);
document.addEventListener('visibilitychange', onVisibilityChange);
return () =>
document.removeEventListener(
'visibilitychange',
onVisibilityChange,
);
}, []);
const [reducedMotion] = useMediaQuery(['(prefers-reduced-motion: reduce)']);
// Als de API minder slides teruggeeft dan de huidige index, begin vooraan.
const active = index < count ? index : 0;