@@ -15,8 +15,8 @@ interface SerializedPost {
1515 ogImage : string
1616 readingTime ?: number
1717 tags : string [ ]
18- author : { id : string ; name : string ; avatarUrl ?: string ; url ?: string }
19- authors ?: { id : string ; name : string ; avatarUrl ?: string ; url ?: string } [ ]
18+ author : { name : string ; avatarUrl ?: string }
19+ authors ?: { name : string ; avatarUrl ?: string } [ ]
2020 featured ?: boolean
2121}
2222
@@ -59,7 +59,8 @@ export function StudioContent({ posts, initialTag, initialQuery }: StudioContent
5959 const counts : Record < string , number > = { }
6060 for ( const cat of CATEGORIES ) counts [ cat . id ] = 0
6161 for ( const post of posts ) {
62- counts [ getPrimaryCategory ( post . tags ) . id ] = ( counts [ getPrimaryCategory ( post . tags ) . id ] ?? 0 ) + 1
62+ const catId = getPrimaryCategory ( post . tags ) . id
63+ counts [ catId ] = ( counts [ catId ] ?? 0 ) + 1
6364 }
6465 return [
6566 { id : null as string | null , label : 'All Posts' , count : posts . length , color : '#00F701' } ,
@@ -73,8 +74,9 @@ export function StudioContent({ posts, initialTag, initialQuery }: StudioContent
7374 } , [ posts ] )
7475
7576 // ── Filter + sort (runs instantly on state change) ──────────────────────
77+ const lowerQ = query . trim ( ) . toLowerCase ( )
78+
7679 const { sorted, activeCategory } = useMemo ( ( ) => {
77- const lowerQ = query . trim ( ) . toLowerCase ( )
7880 let filtered = posts
7981
8082 if ( activeTag ) {
@@ -103,17 +105,22 @@ export function StudioContent({ posts, initialTag, initialQuery }: StudioContent
103105 return new Date ( b . date ) . getTime ( ) - new Date ( a . date ) . getTime ( )
104106 } )
105107 return { sorted : s , activeCategory : cat }
106- } , [ posts , activeTag , query ] )
108+ } , [ posts , activeTag , lowerQ ] )
107109
108- // ── Pagination ──────────────────────────────────────────────────────────
109110 const totalPages = Math . max ( 1 , Math . ceil ( sorted . length / PER_PAGE ) )
110111 const pagePosts = sorted . slice ( ( page - 1 ) * PER_PAGE , page * PER_PAGE )
111112
112- const lowerQ = query . trim ( ) . toLowerCase ( )
113- const featured = page === 1 && ! activeTag && ! lowerQ ? pagePosts . filter ( ( p ) => p . featured ) : [ ]
114- const feed =
115- page === 1 && ! activeTag && ! lowerQ ? pagePosts . filter ( ( p ) => ! p . featured ) : pagePosts
116- const showHero = page === 1 && ! activeTag && ! lowerQ
113+ const isDefaultView = page === 1 && ! activeTag && ! lowerQ
114+ const featured : SerializedPost [ ] = [ ]
115+ const feed : SerializedPost [ ] = [ ]
116+ for ( const p of pagePosts ) {
117+ if ( isDefaultView && p . featured ) {
118+ featured . push ( p )
119+ } else {
120+ feed . push ( p )
121+ }
122+ }
123+ const showHero = isDefaultView
117124
118125 const handleCategorySelect = useCallback (
119126 ( id : string | null ) => {
@@ -168,7 +175,7 @@ export function StudioContent({ posts, initialTag, initialQuery }: StudioContent
168175 < main className = 'relative min-w-0 flex-1' >
169176 < div className = 'flex flex-col' >
170177 { showHero && < StudioHero /> }
171- < div className = 'mx-auto w-full max-w-5xl px-6 py-12' >
178+ < div className = 'mx-auto w-full max-w-5xl py-12' >
172179 { lowerQ && (
173180 < div className = 'mb-8 flex items-center gap-3' >
174181 < span className = 'font-season text-[10px] uppercase tracking-widest text-[#666]' >
@@ -183,7 +190,7 @@ export function StudioContent({ posts, initialTag, initialQuery }: StudioContent
183190 < button
184191 type = 'button'
185192 onClick = { handleClearAll }
186- className = 'font-mono text-[10px] uppercase tracking-wider text-[#999] transition-colors hover:text-[#ECECEC]'
193+ className = 'font-season text-[10px] uppercase tracking-wider text-[#999] transition-colors hover:text-[#ECECEC]'
187194 >
188195 Clear
189196 </ button >
@@ -192,11 +199,11 @@ export function StudioContent({ posts, initialTag, initialQuery }: StudioContent
192199
193200 { activeCategory && ! lowerQ && (
194201 < div className = 'mb-8 flex items-center gap-3' >
195- < span className = 'font-mono text-[10px] uppercase tracking-widest text-[#666]' >
202+ < span className = 'font-season text-[10px] uppercase tracking-widest text-[#666]' >
196203 Filtered by:
197204 </ span >
198205 < span
199- className = 'px-2 py-0.5 font-mono text-[10px] uppercase tracking-wider'
206+ className = 'px-2 py-0.5 font-season text-[10px] uppercase tracking-wider'
200207 style = { {
201208 border : `1px solid ${ activeCategory . color } ` ,
202209 color : activeCategory . color ,
@@ -207,7 +214,7 @@ export function StudioContent({ posts, initialTag, initialQuery }: StudioContent
207214 < button
208215 type = 'button'
209216 onClick = { handleClearAll }
210- className = 'font-mono text-[10px] uppercase tracking-wider text-[#999] transition-colors hover:text-[#ECECEC]'
217+ className = 'font-season text-[10px] uppercase tracking-wider text-[#999] transition-colors hover:text-[#ECECEC]'
211218 >
212219 Clear
213220 </ button >
@@ -216,7 +223,7 @@ export function StudioContent({ posts, initialTag, initialQuery }: StudioContent
216223
217224 { featured . length > 0 && (
218225 < section className = 'mb-10' >
219- < h2 className = 'mb-8 flex items-center gap-2 font-mono text-[11px] uppercase tracking-widest text-[#666]' >
226+ < h2 className = 'mb-8 flex items-center gap-2 font-season text-[11px] uppercase tracking-widest text-[#666]' >
220227 < span className = 'inline-block h-2 w-2 bg-[#FA4EDF]' aria-hidden = 'true' />
221228 Featured Content
222229 </ h2 >
@@ -226,7 +233,7 @@ export function StudioContent({ posts, initialTag, initialQuery }: StudioContent
226233
227234 { feed . length > 0 && (
228235 < section >
229- < h2 className = 'mb-8 flex items-center gap-2 font-mono text-[11px] uppercase tracking-widest text-[#666]' >
236+ < h2 className = 'mb-8 flex items-center gap-2 font-season text-[11px] uppercase tracking-widest text-[#666]' >
230237 < span className = 'inline-block h-2 w-2 bg-[#00F701]' aria-hidden = 'true' />
231238 { lowerQ ? 'Search Results' : activeCategory ? activeCategory . label : 'All Posts' }
232239 </ h2 >
@@ -242,7 +249,7 @@ export function StudioContent({ posts, initialTag, initialQuery }: StudioContent
242249 < button
243250 type = 'button'
244251 onClick = { handleClearAll }
245- className = 'mt-4 inline-block font-mono text-[12px] uppercase tracking-wider text-[#999] transition-colors hover:text-[#ECECEC]'
252+ className = 'mt-4 inline-block font-season text-[12px] uppercase tracking-wider text-[#999] transition-colors hover:text-[#ECECEC]'
246253 >
247254 View all posts
248255 </ button >
@@ -255,20 +262,20 @@ export function StudioContent({ posts, initialTag, initialQuery }: StudioContent
255262 < button
256263 type = 'button'
257264 onClick = { ( ) => setPage ( ( p ) => p - 1 ) }
258- className = 'border border-[#3d3d3d] bg-[#232323] px-6 py-2.5 font-mono text-[11px] uppercase tracking-wider text-[#999] transition-colors hover:border-[#666] hover:text-[#ECECEC]'
265+ className = 'border border-[#3d3d3d] bg-[#232323] px-6 py-2.5 font-season text-[11px] uppercase tracking-wider text-[#999] transition-colors hover:border-[#666] hover:text-[#ECECEC]'
259266 style = { { borderRadius : '5px' } }
260267 >
261268 Previous
262269 </ button >
263270 ) }
264- < span className = 'font-mono text-[10px] uppercase tracking-wider text-[#666]' >
271+ < span className = 'font-season text-[10px] uppercase tracking-wider text-[#666]' >
265272 Page { page } of { totalPages }
266273 </ span >
267274 { page < totalPages && (
268275 < button
269276 type = 'button'
270277 onClick = { ( ) => setPage ( ( p ) => p + 1 ) }
271- className = 'border border-[#3d3d3d] bg-[#232323] px-6 py-2.5 font-mono text-[11px] uppercase tracking-wider text-[#999] transition-colors hover:border-[#666] hover:text-[#ECECEC]'
278+ className = 'border border-[#3d3d3d] bg-[#232323] px-6 py-2.5 font-season text-[11px] uppercase tracking-wider text-[#999] transition-colors hover:border-[#666] hover:text-[#ECECEC]'
272279 style = { { borderRadius : '5px' } }
273280 >
274281 Load more articles
@@ -283,7 +290,6 @@ export function StudioContent({ posts, initialTag, initialQuery }: StudioContent
283290 )
284291}
285292
286-
287293interface SidebarSearchProps {
288294 value : string
289295 onChange : ( value : string ) => void
@@ -308,7 +314,6 @@ function SidebarSearch({ value, onChange }: SidebarSearchProps) {
308314 )
309315}
310316
311-
312317interface SidebarCategoryItem {
313318 id : string | null
314319 label : string
0 commit comments