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

View file

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