@@ -42,43 +42,33 @@ const BlogPage = () => {
4242 const response = await fetch ( '/posts/posts.json' ) ;
4343 if ( response . ok ) {
4444 const allPostsData = await response . json ( ) ;
45- const processedPosts = [ ] ;
45+ const seriesMap = new Map ( ) ;
46+ const individualPosts = [ ] ;
47+
4648 allPostsData . forEach ( ( item ) => {
4749 if ( item . series ) {
50+ if ( ! seriesMap . has ( item . slug ) ) {
51+ seriesMap . set ( item . slug , {
52+ title : item . title ,
53+ slug : item . slug ,
54+ date : item . date ,
55+ updated : item . updated ,
56+ image : item . image ,
57+ isSeries : true ,
58+ posts : [ ] ,
59+ } ) ;
60+ }
4861 item . series . posts . forEach ( ( seriesPost ) => {
49- processedPosts . push ( {
62+ seriesMap . get ( item . slug ) . posts . push ( {
5063 ...seriesPost ,
5164 series : {
5265 slug : item . slug ,
5366 title : item . title ,
54- date : item . date ,
55- updated : item . updated ,
56- authors : item . authors ,
5767 } ,
5868 } ) ;
5969 } ) ;
6070 } else {
61- processedPosts . push ( item ) ;
62- }
63- } ) ;
64-
65- const seriesMap = new Map ( ) ;
66- const individualPosts = [ ] ;
67- processedPosts . forEach ( ( post ) => {
68- if ( post . series ) {
69- if ( ! seriesMap . has ( post . series . slug ) ) {
70- seriesMap . set ( post . series . slug , {
71- title : post . series . title ,
72- slug : post . series . slug ,
73- date : post . date ,
74- updated : post . updated ,
75- isSeries : true ,
76- posts : [ ] ,
77- } ) ;
78- }
79- seriesMap . get ( post . series . slug ) . posts . push ( post ) ;
80- } else {
81- individualPosts . push ( post ) ;
71+ individualPosts . push ( item ) ;
8272 }
8373 } ) ;
8474
@@ -120,6 +110,9 @@ const BlogPage = () => {
120110 return matchesFilter ( ) && matchesSearch ( ) ;
121111 } ) ;
122112
113+ const isPlaceholder = ( post ) =>
114+ ! post ?. image || post . image . includes ( 'placeholder' ) ;
115+
123116 if ( loading ) {
124117 return (
125118 < div className = "flex h-screen items-center justify-center bg-[#050505] text-white" >
@@ -137,6 +130,23 @@ const BlogPage = () => {
137130
138131 return (
139132 < div className = "flex min-h-screen bg-[#050505] text-white overflow-hidden relative selection:bg-emerald-500/30" >
133+ { /* Dynamic Background (Static or Active Post Blur) */ }
134+ < div className = "absolute inset-0 opacity-20 pointer-events-none z-0" >
135+ { activePost &&
136+ ( isPlaceholder ( activePost ) ? (
137+ < GenerativeArt
138+ seed = { activePost . title }
139+ className = "w-full h-full filter blur-3xl"
140+ />
141+ ) : (
142+ < img
143+ src = { activePost . image }
144+ alt = "bg"
145+ className = "w-full h-full object-cover filter blur-3xl"
146+ />
147+ ) ) }
148+ </ div >
149+
140150 { /* LEFT PANEL: The Index */ }
141151 < div className = "w-full 4xl:pr-[50vw] relative z-10 flex flex-col min-h-screen py-24 px-6 md:pl-20 overflow-y-auto overflow-x-hidden no-scrollbar transition-all duration-300" >
142152 < header className = "mb-16" >
0 commit comments