import Link from 'next/link'; import { useRouter } from 'next/router'; import Name, { PersonalDetails } from 'src/interfaces/shared/name'; import styles from 'src/styles/modules/components/name/info.module.scss'; type Props = { info: PersonalDetails; accolades: Name['accolades']; }; const PersonalDetails = ({ info, accolades }: Props) => { const { query: { nameId }, } = useRouter(); return (

Accolades

{accolades.awards && (

Won {accolades.awards.wins} {accolades.awards.name} (out of {accolades.awards.nominations} nominations)

)}

{accolades.wins} wins and {accolades.nominations} nominations in total

View all awards

Personal details

{!!info.officialSites.length && (

Official sites: {info.officialSites.map((site, i) => ( {!!i && ', '} {site.name} ))}

)} {!!info.alsoKnownAs.length && (

Also known as: {info.alsoKnownAs.join(', ')}

)} {info.height && (

Height: {info.height}

)} {info.birth && (

Born: {info.birth.date} {' '} in{' '} {info.birth.location}

)} {info.death.date && (

Died: {info.death.date} {' '} in{' '} {info.death.location}

)} {info.death.cause && (

Death cause: {info.death.cause}

)} {!!info.spouses?.length && (

Spouses: {info.spouses.map((spouse, i) => ( <> {!!i && ', '} {renderPersonNameWithLink(spouse)} {spouse.range} ( {spouse.attributes.join(', ')}) ))}

)} {!!info.children?.length && (

Children: {info.children.map((child, i) => ( <> {!!i && ', '} {renderPersonNameWithLink(child)} ))}

)} {!!info.parents?.length && (

Parents: {info.parents.map((parent, i) => ( <> {!!i && ', '} {renderPersonNameWithLink(parent)} ))}

)} {!!info.relatives?.length && (

Relatives: {info.relatives.map((relative, i) => ( <> {!!i && ', '} {renderPersonNameWithLink(relative)} ({relative.relation}) ))}

)} {!!info.otherWorks?.length && (

Other Works: {info.otherWorks.map((work, i) => ( <> {!!i && ', '} ))}

)} {!!info.publicity.total && (

Publicity Listings: {info.publicity.articles} Articles,{' '} {info.publicity.interviews} Interviews,{' '} {info.publicity.magazines} Magazines,{' '} {info.publicity.pictorials} Pictorials,{' '} {info.publicity.printBiographies} Print biographies, and{' '} {info.publicity.filmBiographies} Biographies

)}
); }; export default PersonalDetails; const renderPersonNameWithLink = (person: { name: string; id: string | null }) => person.id ? ( {person.name} ) : ( {person.name} );