* Add 'recents' and 'years' categories * Add recents and years visibility config * Add fundamental recent/year queries * Display initial date-based data in sidebar * Adjust recents data type * Remove date rage from sidebar footer * Reformat recents/years in sidebar * Organize years in grid * Rename date -> year * Add year-based views * Split sidebar years into rows * Add years to cmdk menu * Localize 'years' * Create /recents views * Enable recents share modals * Fix recents og image * Statically optimize /recents image * Don't statically optimize /recents page * Update i18n * Add recents to cmdk * Suppress spinner for year badges * Refactor sidebar height calculation * Add recents to sitemap
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import { getPhotosCached } from '@/photo/cache';
|
|
import {
|
|
IMAGE_OG_DIMENSION_SMALL,
|
|
MAX_PHOTOS_TO_SHOW_PER_CATEGORY,
|
|
} from '@/image-response';
|
|
import RecentsImageResponse from
|
|
'@/image-response/RecentsImageResponse';
|
|
import { getIBMPlexMono } from '@/app/font';
|
|
import { ImageResponse } from 'next/og';
|
|
import { getImageResponseCacheControlHeaders } from '@/image-response/cache';
|
|
import { getAppText } from '@/i18n/state/server';
|
|
|
|
export const dynamic = 'force-static';
|
|
|
|
export async function GET() {
|
|
const [
|
|
photos,
|
|
{ fontFamily, fonts },
|
|
headers,
|
|
] = await Promise.all([
|
|
getPhotosCached({
|
|
limit: MAX_PHOTOS_TO_SHOW_PER_CATEGORY,
|
|
recent: true,
|
|
}),
|
|
getIBMPlexMono(),
|
|
getImageResponseCacheControlHeaders(),
|
|
]);
|
|
|
|
const appText = await getAppText();
|
|
|
|
const title = appText.category.recentPlural.toLocaleUpperCase();
|
|
|
|
const { width, height } = IMAGE_OG_DIMENSION_SMALL;
|
|
|
|
return new ImageResponse(
|
|
<RecentsImageResponse {...{
|
|
title,
|
|
photos,
|
|
width,
|
|
height,
|
|
fontFamily,
|
|
}}/>,
|
|
{ width, height, fonts, headers },
|
|
);
|
|
}
|