fix build issue by keying all list items

This commit is contained in:
Youwen Wu 2024-02-10 19:49:06 -08:00
parent fdf319eab2
commit 2a200f7088
2 changed files with 23 additions and 26 deletions

View file

@ -1,7 +1,7 @@
import { authors, affiliations, nationalities } from '../../db/data'
import { navigate } from '../../actions'
import { Zilla_Slab } from 'next/font/google'
import Link from 'next/link'
import { Fragment } from 'react'
const zillaSlab = Zilla_Slab({ subsets: ['latin'], weight: ['500'] })
@ -11,9 +11,8 @@ export default function Page({
params: { author: string }
}>) {
const authorData = authors[params.author]
console.log(authorData)
// console.log(authorData)
if (!authorData) {
navigate('/404')
return
}
@ -43,14 +42,14 @@ export default function Page({
const position = a.split('@')[0]
const affiliation = affiliations[a.split('@')[1]].name
return (
<>
<Fragment key={`${position}@${affiliation}`}>
<span className='text-slate-500 text-lg'>
{position} at{' '}
<Link href={`/affiliation/${a.split('@')[1]}`}>
{affiliation}
</Link>
</span>
</>
</Fragment>
)
})}
</>
@ -61,22 +60,20 @@ export default function Page({
if (!formerAffiliations) return null
return (
<>
<h1 className='text-3xl md:my-6 my-4 font-serif'>Former Positions:</h1>
{formerAffiliations?.map((a: string, i: number) => {
const position = a.split('@')[0]
const affiliation = affiliations[a.split('@')[1]].name
return (
<>
<h1 className='text-3xl md:my-6 my-4 font-serif'>
Former Positions:
</h1>
<Fragment key={`${position}@${affiliation}`}>
<span className='text-slate-500 text-lg'>
{position} at{' '}
<Link href={`/affiliation/${a.split('@')[1]}`}>
{affiliation}
</Link>
</span>
</>
</Fragment>
)
})}
</>
@ -89,12 +86,10 @@ export default function Page({
const nationalityData = nationalities[nationality]
const { demonym, flag } = nationalityData
return (
<>
<div className='flex items-center'>
<img src={flag} className='w-10 border-2 border-slate-200' />
<span className='mx-3 font-semibold'>{demonym}</span>
</div>
</>
<div className='flex items-center'>
<img src={flag} className='w-10 border-2 border-slate-200' />
<span className='mx-3 font-semibold'>{demonym}</span>
</div>
)
}
@ -149,7 +144,9 @@ export default function Page({
</h1>
<div className='flex gap-2 flex-wrap'>
{nationality.map((n: string) => (
<NationalityDisplay nationality={n} />
<Fragment key={n}>
<NationalityDisplay nationality={n} />
</Fragment>
))}
</div>
<Bio />

View file

@ -61,31 +61,31 @@ export default function RootLayout({
<div className={styles.footerContent}>
<Container width='1200px'>
<ul>
<li>
<li key='about'>
<Link href='/about'>About</Link>
</li>
<li>
<li key='help'>
<Link href='/help'>Help</Link>
</li>
<li>
<li key='contact'>
<Link href='/contact'>Contact</Link>
</li>
<li>
<li key='subscribe'>
<Link href='/subscribe'>Subscribe</Link>
</li>
<li>
<li key='copyright'>
<Link href='/legal/copyright'>Copyright</Link>
</li>
<li>
<li key='privacy'>
<Link href='/legal/privacy'>Privacy Policy</Link>
</li>
<li>
<li key='accessibility'>
<Link href='/help/accessibility'>Accessibility</Link>
</li>
<li>
<li key='status'>
<Link href='/status'>eeXiv status</Link>
</li>
<li>
<li key='notifications'>
<Link href='/status/notifications'>
Get status notifications
</Link>