|
1 | | -import { createLogger } from '@sim/logger' |
2 | | -import { getErrorMessage } from '@sim/utils/errors' |
3 | | -import { ChangelogActions, ChangelogTimeline } from '@/app/(landing)/changelog/components' |
4 | | -import type { ChangelogEntry, GitHubRelease } from '@/app/(landing)/changelog/types' |
5 | | -import { mapReleases, releasesEndpoint } from '@/app/(landing)/changelog/utils' |
6 | | -import { ProseHero, ProseShell } from '@/app/(landing)/components/prose-page' |
7 | | - |
8 | | -const logger = createLogger('Changelog') |
9 | | - |
10 | | -/** |
11 | | - * Changelog page - reuses the shared prose primitives ({@link ProseShell} + |
12 | | - * {@link ProseHero}) so its headline and column match Terms and Privacy, then |
13 | | - * renders the GitHub-release timeline. The first page of releases is |
14 | | - * fetched here on the server at build/revalidate time; the {@link ChangelogTimeline} |
15 | | - * client leaf paginates the rest. Re-authored from the prior dark changelog onto |
16 | | - * the platform light tokens. |
17 | | - */ |
18 | | - |
19 | | -const LEAD = |
20 | | - 'Every new feature, improvement, and fix in Sim, the open-source AI workspace, with release notes straight from GitHub.' |
21 | | - |
22 | | -async function getInitialEntries(): Promise<ChangelogEntry[]> { |
23 | | - try { |
24 | | - // boundary-raw-fetch: external GitHub Releases API (cross-origin), not a same-origin contract |
25 | | - const res = await fetch(releasesEndpoint(1), { |
26 | | - headers: { Accept: 'application/vnd.github+json' }, |
27 | | - next: { revalidate: 3600 }, |
28 | | - }) |
29 | | - const releases = (await res.json()) as GitHubRelease[] |
30 | | - return mapReleases(releases ?? []) |
31 | | - } catch (error) { |
32 | | - logger.warn('Failed to load initial changelog releases from GitHub', { |
33 | | - error: getErrorMessage(error), |
34 | | - }) |
35 | | - return [] |
36 | | - } |
37 | | -} |
| 1 | +import Link from 'next/link' |
| 2 | +import { CHANGELOG_SECTION, getAllEntryMeta, LATEST_ENTRY_LIMIT } from '@/lib/changelog' |
| 3 | +import { buildCollectionPageJsonLd } from '@/lib/content/seo' |
| 4 | +import { |
| 5 | + ChangelogActions, |
| 6 | + ChangelogGrid, |
| 7 | + ChangelogHeader, |
| 8 | + ChangelogLayout, |
| 9 | +} from '@/app/(landing)/changelog/components' |
| 10 | +import { JsonLd } from '@/app/(landing)/components/json-ld' |
38 | 11 |
|
39 | 12 | export default async function Changelog() { |
40 | | - const entries = await getInitialEntries() |
41 | | - |
| 13 | + const metadata = await getAllEntryMeta() |
| 14 | + const visible = metadata.slice(0, LATEST_ENTRY_LIMIT) |
42 | 15 | return ( |
43 | | - <ProseShell> |
44 | | - <ProseHero title='Changelog' lead={LEAD} actions={<ChangelogActions />} /> |
45 | | - <section id='releases' aria-label='Release history'> |
46 | | - <ChangelogTimeline initialEntries={entries} /> |
47 | | - </section> |
48 | | - </ProseShell> |
| 16 | + <ChangelogLayout> |
| 17 | + <JsonLd data={buildCollectionPageJsonLd(CHANGELOG_SECTION, visible)} /> |
| 18 | + <ChangelogHeader |
| 19 | + title='Changelog' |
| 20 | + lead={CHANGELOG_SECTION.description} |
| 21 | + actions={<ChangelogActions />} |
| 22 | + /> |
| 23 | + <ChangelogGrid entries={visible} featureLatest /> |
| 24 | + <div className='flex flex-wrap gap-6 border-[var(--border)] border-t pt-6 text-[var(--text-secondary)] text-sm'> |
| 25 | + <Link href='/changelog/archive' className='underline underline-offset-4'> |
| 26 | + All updates |
| 27 | + </Link> |
| 28 | + <a |
| 29 | + href='https://github.com/simstudioai/sim/releases' |
| 30 | + target='_blank' |
| 31 | + rel='noopener noreferrer' |
| 32 | + className='underline underline-offset-4' |
| 33 | + > |
| 34 | + Earlier releases on GitHub |
| 35 | + </a> |
| 36 | + </div> |
| 37 | + </ChangelogLayout> |
49 | 38 | ) |
50 | 39 | } |
0 commit comments