| 1 | import { allChangelogs } from 'content-collections' |
| 2 | import { format } |
| 3 | import { ArrowLeft } |
| 4 | import type { Metadata |
| 5 | import Image from 'next/image |
| 6 | import Link from 'next/link |
| 7 | import { notFound } |
| 8 | import { createMetadata } |
| 9 | |
| 10 | export function generateStaticParams() |
| 11 | return allChangelogs.map |
| 12 | } |
| 13 | |
| 14 | export async function generateMetadata |
| 15 | params, |
| 16 | }: PageProps< |
| 17 | const { slug |
| 18 | const entry = |
| 19 | if (!entry) |
| 20 | return createMetadata({ |
| 21 | } |
| 22 | const ogUrl = |
| 23 | return createMetadata({ |
| 24 | title: `${entry. |
| 25 | description: entry.description |
| 26 | openGraph: { images: ogUrl |
| 27 | twitter: { images: ogUrl |
| 28 | }) |
| 29 | } |
| 30 | |
| 31 | export default async function |
| 32 | params, |
| 33 | }: PageProps< |
| 34 | const { slug |
| 35 | const entry = |
| 36 | if (!entry) |
| 37 | notFound() |
| 38 | } |
| 39 | |
| 40 | const sorted = |
| 41 | const index = |
| 42 | const prev = |
| 43 | const next = |
| 44 | |
| 45 | const ogUrl = |
| 46 | |
| 47 | return ( |
| 48 | <main className='mx-auto w-full max-w-3xl px-6 pt-12 pb-24 |
| 49 | <Link |
| 50 | className='inline-flex items-center gap-1.5 font-mono text-[11px] text-muted-foreground uppercase tracking-[0.18em] transition-colors hover:text-foreground' |
| 51 | href='/changelogs' |
| 52 | > |
| 53 | <ArrowLeft className=' |
| 54 | </Link> |
| 55 | |
| 56 | <header className='mt-10 mb-12 border-border/60 border-b pb-12 |
| 57 | <div className='font-mono text-[11px] text-muted-foreground uppercase tracking-[0.18em] |
| 58 | / changelog |
| 59 | </div> |
| 60 | <div className='mt-3 flex items-center gap-3 font-mono text-[11px] text-muted-foreground uppercase tracking-[0.14em] |
| 61 | <time dateTime={entry |
| 62 | {format(new Date |
| 63 | </time> |
| 64 | {entry.version ? |
| 65 | <> |
| 66 | <span className='h-1 w-1 rounded-full bg-muted-foreground/40 |
| 67 | <span>v{entry. |
| 68 | </> |
| 69 | ) : null} |
| 70 | </div> |
| 71 | <h1 className='mt-5 font-semibold text-4xl text-foreground leading-[1] tracking-[-0.03em] sm:text-5xl |
| 72 | {entry.title} |
| 73 | </h1> |
| 74 | <p className='mt-5 text-muted-foreground text-xl leading-relaxed |
| 75 | {entry.description} |
| 76 | </p> |
| 77 | </header> |
| 78 | |
| 79 | <div className='relative mb-14 aspect-[1200/630] w-full overflow-hidden rounded-2xl border border-border/60 bg-card |
| 80 | <Image |
| 81 | alt={entry.title |
| 82 | className='object-cover' |
| 83 | fill |
| 84 | priority |
| 85 | sizes='(max-width: 768px) 100vw, 768px' |
| 86 | src={ogUrl} |
| 87 | unoptimized |
| 88 | /> |
| 89 | </div> |
| 90 | |
| 91 | <article |
| 92 | className='prose prose-neutral dark:prose-invert prose-h2:mt-12 prose-h3:mt-10 max-w-none prose-code:rounded prose-code:bg-muted prose-code:px-1.5 prose-code:py-0.5 prose-headings:font-semibold prose-a:text-primary prose-code:text-sm prose-h2:text-2xl prose-h3:text-xl prose-p:text-base prose-p:text-foreground/80 prose-p:leading-relaxed prose-headings:tracking-[-0.02em] prose-a:no-underline prose-code:before:content-none prose-code:after:content-none prose-a:hover:underline' |
| 93 | // biome-ignore lint/security/noDangerouslySetInnerHtml: trusted local markdown |
| 94 | dangerouslySetInnerHTML={{ __html: |
| 95 | /> |
| 96 | |
| 97 | {(prev || next |
| 98 | <nav className='mt-20 grid grid-cols-1 gap-3 border-border/60 border-t pt-10 sm:grid-cols-2 |
| 99 | {prev ? ( |
| 100 | <Link |
| 101 | className='group flex flex-col gap-2 rounded-xl border border-border/60 bg-card p-5 transition hover:border-primary/40' |
| 102 | href={`/changelog/${prev |
| 103 | > |
| 104 | <span className='font-mono text-[11px] text-muted-foreground uppercase tracking-[0.18em] |
| 105 | ← Previous |
| 106 | </span> |
| 107 | <span className='font-medium text-base text-foreground tracking-tight transition-colors group-hover:text-primary |
| 108 | {prev.title} |
| 109 | </span> |
| 110 | </Link> |
| 111 | ) : ( |
| 112 | <span /> |
| 113 | )} |
| 114 | {next ? ( |
| 115 | <Link |
| 116 | className='group flex flex-col gap-2 rounded-xl border border-border/60 bg-card p-5 text-right transition hover:border-primary/40 sm:items-end' |
| 117 | href={`/changelog/${next |
| 118 | > |
| 119 | <span className='font-mono text-[11px] text-muted-foreground uppercase tracking-[0.18em] |
| 120 | Next → |
| 121 | </span> |
| 122 | <span className='font-medium text-base text-foreground tracking-tight transition-colors group-hover:text-primary |
| 123 | {next.title} |
| 124 | </span> |
| 125 | </Link> |
| 126 | ) : ( |
| 127 | <span /> |
| 128 | )} |
| 129 | </nav> |
| 130 | )} |
| 131 | </main> |
| 132 | ) |
| 133 | } |