@@ -69,9 +69,8 @@ async function getAuthorData(slug: string) {
6969 } ) ) as ArticleData [ ] ;
7070
7171 return { author : authorData , articles } ;
72- }
73- // Fallback approach if composite index isn't available
74- catch ( error ) {
72+ } catch ( error ) {
73+ // Fallback approach if composite index isn't available
7574 console . log ( "Using fallback approach for querying articles:" , error ) ;
7675
7776 // First get all articles by this author
@@ -89,13 +88,16 @@ async function getAuthorData(slug: string) {
8988 return {
9089 uid : doc . id ,
9190 ...data ,
92- date : data . date && typeof data . date . toDate === 'function'
93- ? data . date . toDate ( )
94- : ( data . date instanceof Date ? data . date : new Date ( ) ) ,
95- publish : data . publish ?? false
91+ date :
92+ data . date && typeof data . date . toDate === "function"
93+ ? data . date . toDate ( )
94+ : data . date instanceof Date
95+ ? data . date
96+ : new Date ( ) ,
97+ publish : data . publish ?? false ,
9698 } as ArticleData ;
9799 } )
98- . filter ( article => article . publish === true ) ;
100+ . filter ( ( article ) => article . publish === true ) ;
99101
100102 return { author : authorData , articles } ;
101103 }
@@ -120,7 +122,11 @@ const SOCIAL_ICONS: { [key: string]: any } = {
120122} ;
121123
122124// **Async page component**
123- export default async function Page ( { params } : { params : Promise < { author : string } > } ) {
125+ export default async function Page ( {
126+ params,
127+ } : {
128+ params : Promise < { author : string } > ;
129+ } ) {
124130 const { author } = await params ; // Await the params object
125131 const data = await getAuthorData ( author ) ;
126132
@@ -137,7 +143,7 @@ export default async function Page({ params }: { params: Promise<{ author: strin
137143 . map ( ( [ platform , url ] ) => ( {
138144 href : url ,
139145 ariaLabel : `Visit ${ authorData . name } 's ${ platform } page` ,
140- Icon : SOCIAL_ICONS [ platform . toLowerCase ( ) ] || RiGithubFill , // Default to GitHub icon if unknown
146+ Icon : SOCIAL_ICONS [ platform . toLowerCase ( ) ] || RiGithubFill ,
141147 } ) )
142148 : [ ] ;
143149
@@ -164,7 +170,9 @@ export default async function Page({ params }: { params: Promise<{ author: strin
164170 { /* **Author Biography** */ }
165171 < article >
166172 < h1 className = "text-subheading pb-8" > { authorData . name } </ h1 >
167- < p className = "text-blog-summary pb-12" > { authorData . biography . summary } </ p >
173+ < p className = "text-blog-summary pb-12" >
174+ { authorData . biography . summary }
175+ </ p >
168176 < p className = "text-blog-body" > { authorData . biography . body } </ p >
169177 </ article >
170178 </ article >
@@ -211,7 +219,10 @@ function AuthorArticles({ articles }: { articles: ArticleData[] }) {
211219 </ Link >
212220 < div >
213221 < p className = "heading3-title pb-2 sm:pb-4" >
214- < Link href = { `/posts/${ article . slug } ` } className = "hover:text-white transition-colors" >
222+ < Link
223+ href = { `/posts/${ article . slug } ` }
224+ className = "hover:text-white transition-colors"
225+ >
215226 { article . title }
216227 </ Link >
217228 </ p >
@@ -240,4 +251,3 @@ function AuthorArticles({ articles }: { articles: ArticleData[] }) {
240251 </ div >
241252 ) ;
242253}
243-
0 commit comments