import {getTranslations} from 'next-intl/server'; import {Link} from '@/i18n/navigation'; import {Icon} from './Icon'; type Query = Record; /** Previous / page n / next. The API has no totals, so "next" appears when the page was full. */ export async function Pagination({pathname, query, page, hasNext}: {pathname: string; query: Query; page: number; hasNext: boolean}) { if (page <= 1 && !hasNext) return null; const t = await getTranslations('Common'); const clean = Object.fromEntries(Object.entries(query).filter(([, v]) => v)) as Record; const href = (p: number) => ({pathname, query: {...clean, page: String(p)}}); return ( ); }