1- import { BookOpen , Github , Rss } from 'lucide-react '
2- import Link from 'next/link '
1+ import { env } from '@/lib/core/config/env '
2+ import { ChangelogHero } from '@/app/changelog/components/changelog-hero '
33import ChangelogList from '@/app/changelog/components/timeline-list'
44
55export interface ChangelogEntry {
@@ -21,76 +21,51 @@ export default async function ChangelogContent() {
2121 let entries : ChangelogEntry [ ] = [ ]
2222
2323 try {
24+ const token = env . GITHUB_TOKEN
2425 const res = await fetch (
2526 'https://api.github.com/repos/simstudioai/sim/releases?per_page=10&page=1' ,
2627 {
27- headers : { Accept : 'application/vnd.github+json' } ,
28+ headers : {
29+ Accept : 'application/vnd.github+json' ,
30+ 'X-GitHub-Api-Version' : '2022-11-28' ,
31+ 'User-Agent' : 'Sim/1.0' ,
32+ ...( token ? { Authorization : `Bearer ${ token } ` } : { } ) ,
33+ } ,
2834 next : { revalidate : 3600 } ,
2935 }
3036 )
31- const releases : any [ ] = await res . json ( )
32- entries = ( releases || [ ] )
33- . filter ( ( r ) => ! r . prerelease )
34- . map ( ( r ) => ( {
35- tag : r . tag_name ,
36- title : r . name || r . tag_name ,
37- content : String ( r . body || '' ) ,
38- date : r . published_at ,
39- url : r . html_url ,
40- contributors : extractMentions ( String ( r . body || '' ) ) ,
41- } ) )
37+
38+ if ( ! res . ok ) {
39+ entries = [ ]
40+ } else {
41+ const releases = await res . json ( )
42+ if ( Array . isArray ( releases ) ) {
43+ entries = releases
44+ . filter ( ( r ) => ! r . prerelease )
45+ . map ( ( r ) => ( {
46+ tag : r . tag_name ,
47+ title : r . name || r . tag_name ,
48+ content : String ( r . body || '' ) ,
49+ date : r . published_at ,
50+ url : r . html_url ,
51+ contributors : extractMentions ( String ( r . body || '' ) ) ,
52+ } ) )
53+ }
54+ }
4255 } catch ( err ) {
4356 entries = [ ]
4457 }
4558
4659 return (
47- < div className = 'min-h-screen' >
48- < div className = 'relative grid md:grid-cols-2' >
49- { /* Left intro panel */ }
50- < div className = 'relative top-0 overflow-hidden border-[#2A2A2A] border-b px-6 py-16 sm:px-10 md:sticky md:h-dvh md:border-r md:border-b-0 md:px-12 md:py-24' >
51- < div className = 'relative mx-auto h-full max-w-xl md:flex md:flex-col md:justify-center' >
52- < h1 className = 'mt-6 font-[500] text-4xl tracking-tight sm:text-5xl' > Changelog</ h1 >
53- < p className = 'mt-4 text-[#999] text-sm' >
54- Stay up-to-date with the latest features, improvements, and bug fixes in Sim. All
55- changes are documented here with detailed release notes.
56- </ p >
57- < hr className = 'mt-6 border-[#2A2A2A]' />
58-
59- < div className = 'mt-6 flex flex-wrap items-center gap-3 text-sm' >
60- < Link
61- href = 'https://github.com/simstudioai/sim/releases'
62- target = '_blank'
63- rel = 'noopener noreferrer'
64- className = 'inline-flex items-center gap-2 rounded-[5px] border border-[#FFFFFF] bg-[#FFFFFF] px-[9px] py-[5px] text-[13.5px] text-black transition-colors hover:border-[#E0E0E0] hover:bg-[#E0E0E0]'
65- >
66- < Github className = 'h-4 w-4' />
67- View on GitHub
68- </ Link >
69- < Link
70- href = 'https://docs.sim.ai'
71- className = 'inline-flex items-center gap-2 rounded-[5px] border border-[#3d3d3d] px-[9px] py-[5px] text-[#ECECEC] text-[13.5px] transition-colors hover:bg-[#2A2A2A]'
72- >
73- < BookOpen className = 'h-4 w-4' />
74- Documentation
75- </ Link >
76- < Link
77- href = '/changelog.xml'
78- className = 'inline-flex items-center gap-2 rounded-[5px] border border-[#3d3d3d] px-[9px] py-[5px] text-[#ECECEC] text-[13.5px] transition-colors hover:bg-[#2A2A2A]'
79- >
80- < Rss className = 'h-4 w-4' />
81- RSS Feed
82- </ Link >
83- </ div >
84- </ div >
85- </ div >
86-
87- { /* Right timeline */ }
88- < div className = 'relative px-4 py-10 sm:px-6 md:px-8 md:py-12' >
89- < div className = 'relative max-w-2xl pl-8' >
90- < ChangelogList initialEntries = { entries } />
91- </ div >
92- </ div >
93- </ div >
60+ < div className = 'flex flex-col' >
61+ < ChangelogHero />
62+ < main className = 'mx-auto w-full max-w-5xl px-6 py-12' >
63+ < h2 className = 'mb-8 flex items-center gap-2 font-season text-[11px] uppercase tracking-widest text-[#666]' >
64+ < span className = 'inline-block h-2 w-2 bg-[#FFCC02]' aria-hidden = 'true' />
65+ All Releases
66+ </ h2 >
67+ < ChangelogList initialEntries = { entries } />
68+ </ main >
9469 </ div >
9570 )
9671}
0 commit comments