2024-02-10 19:29:33 -08:00
|
|
|
import { authors, affiliations, nationalities } from '../../db/data'
|
|
|
|
import { Zilla_Slab } from 'next/font/google'
|
|
|
|
import Link from 'next/link'
|
2024-02-10 20:09:36 -08:00
|
|
|
import { notFound } from 'next/navigation'
|
2024-02-10 19:49:06 -08:00
|
|
|
import { Fragment } from 'react'
|
2024-02-10 19:29:33 -08:00
|
|
|
|
|
|
|
const zillaSlab = Zilla_Slab({ subsets: ['latin'], weight: ['500'] })
|
|
|
|
|
|
|
|
export default function Page({
|
|
|
|
params,
|
|
|
|
}: Readonly<{
|
|
|
|
params: { author: string }
|
|
|
|
}>) {
|
|
|
|
const authorData = authors[params.author]
|
2024-02-10 19:49:06 -08:00
|
|
|
// console.log(authorData)
|
2024-02-10 19:29:33 -08:00
|
|
|
if (!authorData) {
|
2024-02-10 20:09:36 -08:00
|
|
|
notFound()
|
2024-02-10 19:29:33 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
const { name, affiliation, image, nationality, formerAffiliations } =
|
|
|
|
authorData
|
|
|
|
|
|
|
|
const MainPosition = () => {
|
|
|
|
const mainAffiliationShort = affiliation[0].split('@')[1]
|
|
|
|
const mainPosition = affiliation[0].split('@')[0]
|
|
|
|
const mainAffiliation = affiliations[mainAffiliationShort]
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<span>{mainPosition} at </span>
|
|
|
|
<Link href={`/affiliation/${mainAffiliationShort}`}>
|
|
|
|
{mainAffiliation.name}
|
|
|
|
</Link>
|
2024-02-10 19:59:15 -08:00
|
|
|
{authorData.website ? (
|
|
|
|
<div className='mt-2'>
|
2024-02-11 02:06:29 -08:00
|
|
|
Visit{' '}
|
|
|
|
{authorData.name.nickname
|
|
|
|
? authorData.name.nickname
|
|
|
|
: authorData.name.first}{' '}
|
|
|
|
at:{' '}
|
2024-02-10 20:09:36 -08:00
|
|
|
<a href={authorData.website} target='_blank'>
|
|
|
|
{authorData.website}
|
|
|
|
</a>
|
2024-02-10 19:59:15 -08:00
|
|
|
</div>
|
|
|
|
) : null}
|
2024-02-11 02:06:29 -08:00
|
|
|
<div className='my-4 max-h-12 flex flex-wrap'>
|
|
|
|
{affiliation.map((a: string) => (
|
|
|
|
<Link key={a} href={`/affiliation/${a.split('@')[1]}`}>
|
|
|
|
<img
|
|
|
|
src={affiliations[a.split('@')[1]].image}
|
|
|
|
alt={affiliations[a.split('@')[1]].name}
|
|
|
|
className='h-12 mr-2'
|
|
|
|
/>
|
|
|
|
</Link>
|
|
|
|
))}
|
|
|
|
</div>
|
2024-02-10 19:29:33 -08:00
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
const OtherPositions = () => {
|
|
|
|
if (affiliation.length === 1) return
|
|
|
|
return (
|
|
|
|
<>
|
2024-02-11 02:06:29 -08:00
|
|
|
<h1 className='text-3xl md:mt-6 mt-4 mb-2 font-serif'>
|
|
|
|
Other Positions:
|
|
|
|
</h1>
|
2024-02-10 19:29:33 -08:00
|
|
|
{affiliation.slice(1).map((a: string, i: number) => {
|
|
|
|
const position = a.split('@')[0]
|
|
|
|
const affiliation = affiliations[a.split('@')[1]].name
|
|
|
|
return (
|
2024-02-10 19:49:06 -08:00
|
|
|
<Fragment key={`${position}@${affiliation}`}>
|
2024-02-10 19:29:33 -08:00
|
|
|
<span className='text-slate-500 text-lg'>
|
|
|
|
{position} at{' '}
|
|
|
|
<Link href={`/affiliation/${a.split('@')[1]}`}>
|
|
|
|
{affiliation}
|
|
|
|
</Link>
|
|
|
|
</span>
|
2024-02-10 19:49:06 -08:00
|
|
|
</Fragment>
|
2024-02-10 19:29:33 -08:00
|
|
|
)
|
|
|
|
})}
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
const FormerPositions = () => {
|
|
|
|
if (!formerAffiliations) return null
|
|
|
|
return (
|
|
|
|
<>
|
2024-02-11 02:06:29 -08:00
|
|
|
<h1 className='text-3xl md:mt-6 mt-4 mb-2 font-serif'>
|
|
|
|
Former Positions:
|
|
|
|
</h1>
|
2024-02-10 19:29:33 -08:00
|
|
|
{formerAffiliations?.map((a: string, i: number) => {
|
|
|
|
const position = a.split('@')[0]
|
|
|
|
const affiliation = affiliations[a.split('@')[1]].name
|
|
|
|
|
|
|
|
return (
|
2024-02-10 19:49:06 -08:00
|
|
|
<Fragment key={`${position}@${affiliation}`}>
|
2024-02-10 19:29:33 -08:00
|
|
|
<span className='text-slate-500 text-lg'>
|
|
|
|
{position} at{' '}
|
|
|
|
<Link href={`/affiliation/${a.split('@')[1]}`}>
|
|
|
|
{affiliation}
|
|
|
|
</Link>
|
|
|
|
</span>
|
2024-02-10 19:49:06 -08:00
|
|
|
</Fragment>
|
2024-02-10 19:29:33 -08:00
|
|
|
)
|
|
|
|
})}
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
const NationalityDisplay = ({
|
|
|
|
nationality,
|
|
|
|
}: Readonly<{ nationality: string }>) => {
|
|
|
|
const nationalityData = nationalities[nationality]
|
|
|
|
const { demonym, flag } = nationalityData
|
|
|
|
return (
|
2024-02-10 19:49:06 -08:00
|
|
|
<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>
|
2024-02-10 19:29:33 -08:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
const Bio = () => {
|
|
|
|
const { bio } = authorData
|
|
|
|
if (!bio) return null
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
2024-02-11 02:06:29 -08:00
|
|
|
<h1 className='text-3xl md:mt-6 mt-4 mb-2 font-serif'>Bio:</h1>
|
2024-02-10 19:29:33 -08:00
|
|
|
<p>{authorData.bio}</p>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
2024-02-10 22:56:01 -08:00
|
|
|
<div className='grid grid-cols-1 md:grid-cols-2 items-center max-w-3xl mx-auto'>
|
|
|
|
<div className='aspect-square w-[60vw] md:w-[30vw] lg:w-[20vw] 2xl:w-[15vw] overflow-hidden mx-auto mb-4'>
|
2024-02-10 19:29:33 -08:00
|
|
|
<img
|
|
|
|
alt='profile picture'
|
|
|
|
className='rounded-full mx-auto object-cover w-full h-full border-slate-800 border-4'
|
|
|
|
src={image}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div>
|
2024-02-10 19:59:15 -08:00
|
|
|
<div>
|
2024-02-10 19:29:33 -08:00
|
|
|
<span
|
|
|
|
className={`${zillaSlab.className} font-bold text-5xl text-center md:text-left`}
|
|
|
|
>
|
|
|
|
{name.first}
|
|
|
|
{name.nickname ? ` "${name.nickname}"` : null} {name.last}
|
|
|
|
</span>
|
2024-02-10 19:59:15 -08:00
|
|
|
<div className='text-slate-600 text-md sm:text-lg mt-4'>
|
2024-02-10 19:29:33 -08:00
|
|
|
<MainPosition />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className='max-w-3xl mx-auto grid grid-cols-1 justify-center'>
|
|
|
|
<hr className='mx-auto w-full h-1 border-0 bg-slate-200 my-2 rounded-md' />
|
|
|
|
<OtherPositions />
|
|
|
|
<FormerPositions />
|
|
|
|
<h1 className='text-3xl md:my-6 my-4 font-serif'>
|
|
|
|
Ethnicity and Nationality:
|
|
|
|
</h1>
|
|
|
|
<div className='flex gap-2 flex-wrap'>
|
|
|
|
{nationality.map((n: string) => (
|
2024-02-10 19:49:06 -08:00
|
|
|
<Fragment key={n}>
|
|
|
|
<NationalityDisplay nationality={n} />
|
|
|
|
</Fragment>
|
2024-02-10 19:29:33 -08:00
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
<Bio />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|