import { authors, affiliations, nationalities } from '../../db/data' import { Zilla_Slab } from 'next/font/google' import Link from 'next/link' import { notFound } from 'next/navigation' import { Fragment } from 'react' const zillaSlab = Zilla_Slab({ subsets: ['latin'], weight: ['500'] }) export function generateStaticParams() { const authorsList = Object.keys(authors) return authorsList.map((author) => ({ author })) } export default function Page({ params, }: Readonly<{ params: { author: string } }>) { const authorData = authors[params.author] // console.log(authorData) if (!authorData) { notFound() } 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} {authorData.website ? (
Visit{' '} {authorData.name.nickname ? authorData.name.nickname : authorData.name.first}{' '} at:{' '} {authorData.website}
) : null}
{affiliation.map((a: string) => ( {affiliations[a.split('@')[1]].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 ( <>

Former Positions:

{formerAffiliations?.map((a: string, i: number) => { const position = a.split('@')[0] const affiliation = affiliations[a.split('@')[1]].name return ( {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.bio}

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

Ethnicity and Nationality:

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