import { getPublishedArticles, getTagList } from '@/lib/queries'; import ArticleCard from '@/components/ArticleCard'; import { InFeedAd, SidebarAd } from '@/components/ads/placements'; import { SECTIONS } from '@/data/feeds'; import type { ReactNode } from 'react'; import { notFound } from 'next/navigation'; export const dynamic = 'force-dynamic'; type Params = { section: string; page?: string }; export default async function SectionPage({ params, searchParams, }: { params: Params; searchParams: { page?: string }; }) { const section = params.section; const known = SECTIONS.find((s) => s.slug === section); if (!known) notFound(); const page = Math.max(1, parseInt(searchParams.page ?? '1', 10) || 1); const PER = 24; const [articles, tags] = await Promise.all([ getPublishedArticles(section, PER, (page - 1) * PER), getTagList(10), ]); return ( <>
Nothing in {known.label} yet — the worker will fill this in.
) : (