import { authors, affiliations, nationalities } from '../../db/data' import { navigate } from '../../actions' import { Zilla_Slab } from 'next/font/google' import Link from 'next/link' const zillaSlab = Zilla_Slab({ subsets: ['latin'], weight: ['500'] }) export default function Page({ params, }: Readonly<{ params: { author: string } }>) { const authorData = authors[params.author] console.log(authorData) if (!authorData) { navigate('/404') return } 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 ( <> {mainPosition} at {mainAffiliation.name} ) } const OtherPositions = () => { if (affiliation.length === 1) return return ( <>

Other Positions:

{affiliation.slice(1).map((a: string, i: number) => { const position = a.split('@')[0] const affiliation = affiliations[a.split('@')[1]].name return ( <> {position} at{' '} {affiliation} ) })} ) } const FormerPositions = () => { if (!formerAffiliations) return null return ( <> {formerAffiliations?.map((a: string, i: number) => { const position = a.split('@')[0] const affiliation = affiliations[a.split('@')[1]].name return ( <>

Former Positions:

{position} at{' '} {affiliation} ) })} ) } const NationalityDisplay = ({ nationality, }: Readonly<{ nationality: string }>) => { const nationalityData = nationalities[nationality] const { demonym, flag } = nationalityData return ( <>
{demonym}
) } const Bio = () => { const { bio } = authorData if (!bio) return null return ( <>

Bio:

{authorData.website ? (

You can visit me at:{' '} {authorData.website}

) : null}

{authorData.bio}

) } return (
profile picture
{name.first} {name.nickname ? ` "${name.nickname}"` : null} {name.last}

Ethnicity and Nationality:

{nationality.map((n: string) => ( ))}
) }