import { cn } from '@/lib/utils' import Link from 'next/link' import { Page } from 'nextra' import { getPagesUnderRoute } from 'nextra/context' const changelogItems = getPagesUnderRoute('/changelog') as Array export default function Changelog({ className }: { className?: string }) { const changelog = changelogItems .filter( (page) => page.route && !page.route.includes('content') && page.frontMatter.title && page.frontMatter.date, ) .sort((a, b) => new Date(b.frontMatter.date).getTime() - new Date(a.frontMatter.date).getTime()) .slice(0, 20) .map(({ route, frontMatter }) => ({ route, title: frontMatter.title ?? null, author: frontMatter.author ?? null, date: new Date(frontMatter.date), })) return (

Changelog

{/* Added id to the heading */}
{changelog.map((activityItem) => (

{activityItem.title}{' '} {activityItem.author ? `by ${activityItem.author}` : null}

{activityItem.date ? ( ) : null} ))}

Read the full changelog ... {null}

) } function formatDate(date: Date) { const dayDiff = (Date.now() - date.getTime()) / (1000 * 60 * 60 * 24) if (dayDiff < 1) return 'today' if (dayDiff < 14) return `${Math.round(dayDiff)} days ago` return date.toLocaleDateString(undefined, { month: 'short', day: 'numeric', year: 'numeric', timeZone: 'UTC', }) }