import type { Metadata } from 'next' import { setRequestLocale, getTranslations } from 'next-intl/server' import { getCommits } from '@/lib/changelog' import { Pagination } from '@/components/Pagination' export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }): Promise { const { locale } = await params const t = await getTranslations({ locale, namespace: 'Misc' }) return { title: t('changelogs.title') } } function formatFecha(iso: string): string { if (!iso) return '' const d = new Date(iso) if (isNaN(d.getTime())) return iso return d.toLocaleString('es-ES', { day: 'numeric', month: 'long', year: 'numeric', hour: '2-digit', minute: '2-digit', }) } export default async function ChangelogsPage({ params, searchParams, }: { params: Promise<{ locale: string }> searchParams: Promise<{ page?: string }> }) { const { locale } = await params const sp = await searchParams const page = Math.max(1, Number(sp.page) || 1) setRequestLocale(locale) const t = await getTranslations('Misc') const { commits, totalPages } = await getCommits(page, 5) return (

{t('changelogs.title')}

{commits.length === 0 ? (

{t('changelogs.loadError')}

) : ( <> {commits.map((c) => (

{c.title}

{formatFecha(c.date)}

{c.author} {' ยท '} {c.shortSha}

{c.body && (

{c.body}

)}


))} (p === 1 ? '/changelogs' : `/changelogs?page=${p}`)} />
)}
) }