From af311c762ee05db2b8b76e9dde0f31f8437e5140 Mon Sep 17 00:00:00 2001 From: Ananth Venkatesh <46249765+quantum9Innovation@users.noreply.github.com> Date: Fri, 16 Feb 2024 22:43:25 +0000 Subject: [PATCH] Partially revamp affiliations --- src/app/affiliation/getAffiliations.ts | 14 ++++++ src/app/affiliation/page.tsx | 70 ++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 src/app/affiliation/getAffiliations.ts create mode 100644 src/app/affiliation/page.tsx diff --git a/src/app/affiliation/getAffiliations.ts b/src/app/affiliation/getAffiliations.ts new file mode 100644 index 0000000..32fdd68 --- /dev/null +++ b/src/app/affiliation/getAffiliations.ts @@ -0,0 +1,14 @@ +import { authors } from '@/app/db/data' + +export default function getAffiliations(): string[] { + const affiliations: string[] = [] + for (const [_key, value] of Object.entries(authors)) { + for (const affiliation of value.affiliation) { + const id = affiliation.split('@')[1] + if (!affiliations.includes(id)) { + affiliations.push(id) + } + } + } + return affiliations +} diff --git a/src/app/affiliation/page.tsx b/src/app/affiliation/page.tsx new file mode 100644 index 0000000..187eb13 --- /dev/null +++ b/src/app/affiliation/page.tsx @@ -0,0 +1,70 @@ +import { affiliations } from '@/app/db/data' +import { notFound } from 'next/navigation' +import { Zilla_Slab } from 'next/font/google' +import getAffiliations from './getAffiliations' +import { Fragment } from 'react' + +const zillaSlab = Zilla_Slab({ subsets: ['latin'], weight: ['500'] }) + +export function generateStaticParams() { + const affiliationsList = Object.keys(affiliations) + return affiliationsList.map((shortName) => ({ shortName })) +} + +const AffiliationCard = ({ + params, +}: Readonly<{ params: { shortName: string } }>) => { + const { shortName } = params + const { name, short, image } = affiliations[shortName] + if (!name) { + notFound() + } + + return ( +