Merge branch 'main' into ppr-static
This commit is contained in:
commit
03169e71f6
@ -26,7 +26,7 @@ export default async function AdminNav() {
|
|||||||
return 0;
|
return 0;
|
||||||
}),
|
}),
|
||||||
getUniqueTagsCached().then(tags => tags.length).catch(() => 0),
|
getUniqueTagsCached().then(tags => tags.length).catch(() => 0),
|
||||||
getPhotosMostRecentUpdateCached(),
|
getPhotosMostRecentUpdateCached().catch(() => undefined),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const navItemPhotos = {
|
const navItemPhotos = {
|
||||||
|
|||||||
@ -26,9 +26,11 @@ export default async function AdminPhotosPage() {
|
|||||||
includeHidden: true,
|
includeHidden: true,
|
||||||
sortBy: 'createdAt',
|
sortBy: 'createdAt',
|
||||||
limit: INFINITE_SCROLL_INITIAL_ADMIN_PHOTOS,
|
limit: INFINITE_SCROLL_INITIAL_ADMIN_PHOTOS,
|
||||||
}),
|
}).catch(() => []),
|
||||||
getPhotosCountIncludingHiddenCached(),
|
getPhotosCountIncludingHiddenCached().catch(() => 0),
|
||||||
DEBUG_PHOTO_BLOBS ? getStoragePhotoUrlsNoStore() : [],
|
DEBUG_PHOTO_BLOBS
|
||||||
|
? getStoragePhotoUrlsNoStore()
|
||||||
|
: [],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import SiteGrid from '@/components/SiteGrid';
|
|||||||
import { getUniqueTagsHiddenCached } from '@/photo/cache';
|
import { getUniqueTagsHiddenCached } from '@/photo/cache';
|
||||||
|
|
||||||
export default async function AdminTagsPage() {
|
export default async function AdminTagsPage() {
|
||||||
const tags = await getUniqueTagsHiddenCached();
|
const tags = await getUniqueTagsHiddenCached().catch(() => []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SiteGrid
|
<SiteGrid
|
||||||
|
|||||||
@ -19,7 +19,10 @@ export const dynamic = 'force-static';
|
|||||||
const getPhotosCached = cache(getPhotos);
|
const getPhotosCached = cache(getPhotos);
|
||||||
|
|
||||||
export async function generateMetadata(): Promise<Metadata> {
|
export async function generateMetadata(): Promise<Metadata> {
|
||||||
const photos = await getPhotosCached({ limit: MAX_PHOTOS_TO_SHOW_OG });
|
const photos = await getPhotosCached({
|
||||||
|
limit: MAX_PHOTOS_TO_SHOW_OG,
|
||||||
|
})
|
||||||
|
.catch(() => []);
|
||||||
return generateOgImageMetaForPhotos(photos);
|
return generateOgImageMetaForPhotos(photos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,7 +34,7 @@ export default async function GridPage() {
|
|||||||
cameras,
|
cameras,
|
||||||
simulations,
|
simulations,
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
getPhotosCached({ limit: INFINITE_SCROLL_INITIAL_GRID }),
|
getPhotosCached({ limit: INFINITE_SCROLL_INITIAL_GRID }).catch(() => []),
|
||||||
...getPhotoSidebarData(),
|
...getPhotoSidebarData(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@ -9,13 +9,15 @@ import { ImageResponse } from 'next/og';
|
|||||||
import { getImageResponseCacheControlHeaders } from '@/image-response/cache';
|
import { getImageResponseCacheControlHeaders } from '@/image-response/cache';
|
||||||
import { isNextImageReadyBasedOnPhotos } from '@/photo';
|
import { isNextImageReadyBasedOnPhotos } from '@/photo';
|
||||||
|
|
||||||
|
export const dynamic = 'force-static';
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
const [
|
const [
|
||||||
photos,
|
photos,
|
||||||
headers,
|
headers,
|
||||||
{ fontFamily, fonts },
|
{ fontFamily, fonts },
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
getPhotosCached({ limit: MAX_PHOTOS_TO_SHOW_OG }),
|
getPhotosCached({ limit: MAX_PHOTOS_TO_SHOW_OG }).catch(() => []),
|
||||||
getImageResponseCacheControlHeaders(),
|
getImageResponseCacheControlHeaders(),
|
||||||
getIBMPlexMonoMedium(),
|
getIBMPlexMonoMedium(),
|
||||||
]);
|
]);
|
||||||
|
|||||||
45
src/app/not-found.tsx
Normal file
45
src/app/not-found.tsx
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import SiteGrid from '@/components/SiteGrid';
|
||||||
|
import { PATH_ROOT } from '@/site/paths';
|
||||||
|
import { clsx } from 'clsx/lite';
|
||||||
|
import Link from 'next/link';
|
||||||
|
import { usePathname } from 'next/navigation';
|
||||||
|
|
||||||
|
export default function NotFound() {
|
||||||
|
const pathname = usePathname();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SiteGrid contentMain={
|
||||||
|
<div className={clsx(
|
||||||
|
'min-h-72 sm:min-h-96',
|
||||||
|
'flex flex-col items-center justify-center gap-3',
|
||||||
|
)}>
|
||||||
|
<h1 className={clsx(
|
||||||
|
'text-[100px] sm:text-[120px] leading-none',
|
||||||
|
'text-gray-800 dark:text-gray-200',
|
||||||
|
)}>
|
||||||
|
404
|
||||||
|
</h1>
|
||||||
|
<div className="flex flex-col gap-6 text-center text-dim">
|
||||||
|
<div>
|
||||||
|
<span className={clsx(
|
||||||
|
'underline underline-offset-2 decoration-dotted',
|
||||||
|
'cursor-not-allowed',
|
||||||
|
)}>
|
||||||
|
{pathname}
|
||||||
|
</span>
|
||||||
|
{' '}
|
||||||
|
could not be found
|
||||||
|
</div>
|
||||||
|
<Link
|
||||||
|
href={PATH_ROOT}
|
||||||
|
className="text-main"
|
||||||
|
>
|
||||||
|
Return Home
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
} />
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -16,7 +16,6 @@ export const dynamic = 'force-static';
|
|||||||
const getPhotosCached = cache(getPhotos);
|
const getPhotosCached = cache(getPhotos);
|
||||||
|
|
||||||
export async function generateMetadata(): Promise<Metadata> {
|
export async function generateMetadata(): Promise<Metadata> {
|
||||||
// Make homepage queries resilient to error on first time setup
|
|
||||||
const photos = await getPhotosCached({
|
const photos = await getPhotosCached({
|
||||||
limit: MAX_PHOTOS_TO_SHOW_OG,
|
limit: MAX_PHOTOS_TO_SHOW_OG,
|
||||||
})
|
})
|
||||||
@ -25,7 +24,6 @@ export async function generateMetadata(): Promise<Metadata> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default async function HomePage() {
|
export default async function HomePage() {
|
||||||
// Make homepage queries resilient to error on first time setup
|
|
||||||
const [
|
const [
|
||||||
photos,
|
photos,
|
||||||
photosCount,
|
photosCount,
|
||||||
|
|||||||
@ -19,7 +19,7 @@ export async function GET() {
|
|||||||
getPhotosCached({
|
getPhotosCached({
|
||||||
sortBy: 'priority',
|
sortBy: 'priority',
|
||||||
limit: MAX_PHOTOS_TO_SHOW_TEMPLATE_TIGHT,
|
limit: MAX_PHOTOS_TO_SHOW_TEMPLATE_TIGHT,
|
||||||
}),
|
}).catch(() => []),
|
||||||
getIBMPlexMonoMedium(),
|
getIBMPlexMonoMedium(),
|
||||||
getImageResponseCacheControlHeaders(),
|
getImageResponseCacheControlHeaders(),
|
||||||
]);
|
]);
|
||||||
|
|||||||
@ -16,7 +16,10 @@ export async function GET() {
|
|||||||
{ fontFamily, fonts },
|
{ fontFamily, fonts },
|
||||||
headers,
|
headers,
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
getPhotosCached({ sortBy: 'priority', limit: MAX_PHOTOS_TO_SHOW_TEMPLATE }),
|
getPhotosCached({
|
||||||
|
sortBy: 'priority',
|
||||||
|
limit: MAX_PHOTOS_TO_SHOW_TEMPLATE,
|
||||||
|
}).catch(() => []),
|
||||||
getIBMPlexMonoMedium(),
|
getIBMPlexMonoMedium(),
|
||||||
getImageResponseCacheControlHeaders(),
|
getImageResponseCacheControlHeaders(),
|
||||||
]);
|
]);
|
||||||
|
|||||||
@ -14,10 +14,12 @@ import { SHOW_FILM_SIMULATIONS } from '@/site/config';
|
|||||||
import { sortTagsObject } from '@/tag';
|
import { sortTagsObject } from '@/tag';
|
||||||
|
|
||||||
export const getPhotoSidebarData = () => [
|
export const getPhotoSidebarData = () => [
|
||||||
getPhotosCount(),
|
getPhotosCount().catch(() => 0),
|
||||||
getUniqueTags().then(sortTagsObject),
|
getUniqueTags().then(sortTagsObject).catch(() => []),
|
||||||
getUniqueCameras(),
|
getUniqueCameras().catch(() => []),
|
||||||
SHOW_FILM_SIMULATIONS ? getUniqueFilmSimulations() : [],
|
SHOW_FILM_SIMULATIONS
|
||||||
|
? getUniqueFilmSimulations().catch(() => [])
|
||||||
|
: [],
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export const getPhotoSidebarDataCached = () => [
|
export const getPhotoSidebarDataCached = () => [
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user