From 68dab11e6ba43921f2d331e9e9f7b0be356de863 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Fri, 22 Sep 2023 11:02:30 -0500 Subject: [PATCH] Fix tag text image generation --- src/app/(static)/t/[tag]/image/route.tsx | 16 +++++++++++----- src/photo/image-response/TagImageResponse.tsx | 4 +++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/app/(static)/t/[tag]/image/route.tsx b/src/app/(static)/t/[tag]/image/route.tsx index 7bcdd4cf..226dfafa 100644 --- a/src/app/(static)/t/[tag]/image/route.tsx +++ b/src/app/(static)/t/[tag]/image/route.tsx @@ -11,15 +11,14 @@ import { ImageResponse } from 'next/server'; export const runtime = 'edge'; export async function GET(request: Request, context: any) { + const tag = context.params.tag as string; + const [ photos, { fontFamily, fonts }, headers, ] = await Promise.all([ - getPhotosCached({ - limit: MAX_PHOTOS_TO_SHOW_PER_TAG, - tag: context.params.tag, - }), + getPhotosCached({ limit: MAX_PHOTOS_TO_SHOW_PER_TAG, tag }), getIBMPlexMonoMedium(), getImageCacheHeadersForAuth(await auth()), ]); @@ -27,7 +26,14 @@ export async function GET(request: Request, context: any) { const { width, height } = IMAGE_OG_SMALL_SIZE; return new ImageResponse( - , + , { width, height, fonts, headers }, ); } diff --git a/src/photo/image-response/TagImageResponse.tsx b/src/photo/image-response/TagImageResponse.tsx index 2e620378..61c7a453 100644 --- a/src/photo/image-response/TagImageResponse.tsx +++ b/src/photo/image-response/TagImageResponse.tsx @@ -5,12 +5,14 @@ import ImagePhotoGrid from './components/ImagePhotoGrid'; import ImageContainer from './components/ImageContainer'; export default function TagImageResponse({ + tag, photos, request, width, height, fontFamily, }: { + tag: string, photos: Photo[] request: Request width: number @@ -36,7 +38,7 @@ export default function TagImageResponse({ size={height * .067} style={{ transform: `translateY(${height * .02}px)` }} /> - {'Door County'.toUpperCase()} + {tag.toUpperCase()} );