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 ( +
+
+
+ profile +
+
+ + {short} + +
{name}
+
+
+ ) +} + +const Page = () => { + const allAffiliations = getAffiliations() + + return ( +
+

+ Affiliations +

+
+ {allAffiliations.map((affiliationShortName) => { + const { name, short, image } = affiliations[affiliationShortName] + return ( + + + + ) + })} +
+
+ ) +} + +export default Page