Makes Reveal, deferred images and the first row work from the HTML
Reveal content is visible in the HTML and only content below the viewport hides after hydration. Deferred photos get a noscript twin, and the first row of the portfolio loads eagerly per column count. Some old tests still expect the former behaviour; they are rewritten next, so this commit's test run is not fully green. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import type { ReactNode } from 'react';
|
||||
import { createRootRoute, HeadContent, Scripts } from '@tanstack/react-router';
|
||||
import { ChakraProvider } from '@chakra-ui/react';
|
||||
import AppShell from '../components/AppShell';
|
||||
import NoScriptStyles from '../components/NoScript/NoScriptStyles';
|
||||
import ErrorPage from '../components/StatusPage/ErrorPage';
|
||||
import NotFound from '../components/StatusPage/NotFound';
|
||||
import siteContent from '../content/siteContent';
|
||||
@@ -29,6 +30,7 @@ const RootDocument = ({ children }: { children: ReactNode }) => (
|
||||
<html lang="nl">
|
||||
<head>
|
||||
<HeadContent />
|
||||
<NoScriptStyles />
|
||||
</head>
|
||||
<body>
|
||||
{/* De site is alleen licht; de _dark-waarden in het thema blijven
|
||||
|
||||
@@ -7,7 +7,12 @@ import portfolioContent from '../content/portfolioContent';
|
||||
import shootTypes from '../content/shootTypes';
|
||||
import siteContent from '../content/siteContent';
|
||||
import type { ShootTypeId } from '../content/types';
|
||||
import { isShootTypeId } from '../lib/portfolioFilters';
|
||||
import { firstRowPreloads } from '../lib/firstRow';
|
||||
import {
|
||||
filterPhotos,
|
||||
isShootTypeId,
|
||||
toGalleryItems,
|
||||
} from '../lib/portfolioFilters';
|
||||
import { visibleSocials } from '../lib/visibleSocials';
|
||||
import useHydrated from '../hooks/useHydrated';
|
||||
import { galleryImages, pageHead, structuredDataScript, webPage } from '../seo';
|
||||
@@ -27,16 +32,26 @@ export const Route = createFileRoute('/portfolio')({
|
||||
: undefined;
|
||||
return isShootTypeId(value, shootTypeIds) ? { shoot: value } : {};
|
||||
},
|
||||
head: () => ({
|
||||
...pageHead('/portfolio'),
|
||||
scripts: [
|
||||
structuredDataScript(
|
||||
webPage('ImageGallery', '/portfolio', {
|
||||
associatedMedia: galleryImages(portfolioContent.photos),
|
||||
}),
|
||||
),
|
||||
],
|
||||
}),
|
||||
head: () => {
|
||||
const base = pageHead('/portfolio');
|
||||
// The unfiltered list the page renders: ?shoot= only applies after
|
||||
// hydration
|
||||
const items = toGalleryItems(
|
||||
filterPhotos(portfolioContent.photos, undefined),
|
||||
shootTypes,
|
||||
);
|
||||
return {
|
||||
...base,
|
||||
links: [...base.links, ...firstRowPreloads(items)],
|
||||
scripts: [
|
||||
structuredDataScript(
|
||||
webPage('ImageGallery', '/portfolio', {
|
||||
associatedMedia: galleryImages(portfolioContent.photos),
|
||||
}),
|
||||
),
|
||||
],
|
||||
};
|
||||
},
|
||||
component: Portfolio,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user