Make root pages more consistent

This commit is contained in:
Sam Becker 2023-11-08 08:46:06 -06:00
parent d9e0a80ca7
commit 95b0c3b327
3 changed files with 17 additions and 5 deletions

View File

@ -11,11 +11,12 @@ import {
} from '@/site/pagination';
import { pathForRoot } from '@/site/paths';
import { Metadata } from 'next';
import { MAX_PHOTOS_TO_SHOW_OG } from '@/photo/image-response';
export const runtime = 'edge';
export async function generateMetadata(): Promise<Metadata> {
const photos = await getPhotosCached();
const photos = await getPhotosCached({ limit: MAX_PHOTOS_TO_SHOW_OG });
return generateOgImageMetaForPhotos(photos);
}

View File

@ -1,4 +1,5 @@
import {
getPhotosCached,
getPhotosCountCached,
getUniqueCamerasCached,
getUniqueFilmSimulationsCached,
@ -7,9 +8,19 @@ import {
import InfoBlock from '@/components/InfoBlock';
import RedirectOnDesktop from '@/components/RedirectOnDesktop';
import SiteGrid from '@/components/SiteGrid';
import { generateOgImageMetaForPhotos } from '@/photo';
import PhotoGridSidebar from '@/photo/PhotoGridSidebar';
import { MAX_PHOTOS_TO_SHOW_OG } from '@/photo/image-response';
import { SHOW_FILM_SIMULATIONS } from '@/site/config';
import { PATH_GRID } from '@/site/paths';
import { Metadata } from 'next';
export const runtime = 'edge';
export async function generateMetadata(): Promise<Metadata> {
const photos = await getPhotosCached({ limit: MAX_PHOTOS_TO_SHOW_OG });
return generateOgImageMetaForPhotos(photos);
}
export default async function SetsPage() {
const [

View File

@ -6,10 +6,10 @@ import { useEffect } from 'react';
export default function RedirectOnDesktop({
redirectPath,
shouldPrefetch = true,
shouldPrefetchRedirect = true,
}: {
redirectPath: string
shouldPrefetch?: boolean
shouldPrefetchRedirect?: boolean
}) {
const router = useRouter();
@ -18,10 +18,10 @@ export default function RedirectOnDesktop({
const isDesktop = useIsDesktop();
useEffect(() => {
if (shouldPrefetch) {
if (shouldPrefetchRedirect) {
router.prefetch(redirectPath);
}
}, [router, shouldPrefetch, redirectPath]);
}, [router, shouldPrefetchRedirect, redirectPath]);
useEffect(() => {
if (isDesktop && pathname !== redirectPath) {