diff --git a/src/app/(frontend)/experiment/ExperimentCard.tsx b/src/app/(frontend)/experiment/ExperimentCard.tsx index ff89b27d75c36de0371622b90309765223ccfe4a..9342d8fd260a9dc8f1db7d6e28c827023bc6dc89 100644 --- a/src/app/(frontend)/experiment/ExperimentCard.tsx +++ b/src/app/(frontend)/experiment/ExperimentCard.tsx @@ -4,15 +4,14 @@ import type { Experiment } from '@/payload-types' import { Button, Card } from 'flowbite-react' interface ExperimentProps { - experiments: Experiment[] + experiment: Experiment[] } -export default function experimentCard({ experiments }: ExperimentProps) { +export default function experimentCard({ experiment }: ExperimentProps) { return ( <Card className="w-full max-w-full p-6 my-4 shadow-none"> <h5 className="text-2xl font-bold tracking-tight text-gray-900 dark:text-white"> - {experiments.titel} - + {experiment.title} </h5> <p className="font-normal text-gray-700 dark:text-gray-400"> diff --git a/src/app/(frontend)/experiment/ExperimentSection.tsx b/src/app/(frontend)/experiment/ExperimentSection.tsx index 87ec06b6bf2e48cc59c23b3e76b8907580f2b09b..a56d43f342f7e80ff661758c06b173f9663aa3c0 100644 --- a/src/app/(frontend)/experiment/ExperimentSection.tsx +++ b/src/app/(frontend)/experiment/ExperimentSection.tsx @@ -27,14 +27,14 @@ export default function ExperimentSection({ experiments }: ExperimentProps) { type="search" icon={HiSearch} placeholder="Search Experiments..." - onChange={e => debounce(() => { startTransition(() => setSearchQuery(e.target.value)) }, 'publicationSearch')} + onChange={e => debounce(() => { startTransition(() => setSearchQuery(e.target.value)) }, 'experimentSearch')} className="md:w-2/3 md:pt-8 p-8 w-5/6 pt-20" /> {filteredExperiments.length > 0 ? ( filteredExperiments.map(experiment => ( - <ExperimentCard key={experiment.id} experiments={experiment} /> + <ExperimentCard key={experiment.id} experiment={experiment} /> )) ) : ( diff --git a/src/app/(frontend)/experiment/page.tsx b/src/app/(frontend)/experiment/page.tsx index 580db65735ca871d6b5afc1baeda830dd1911a31..3a2386ff279d725bfb2fce0eced4c99e7a12e34c 100644 --- a/src/app/(frontend)/experiment/page.tsx +++ b/src/app/(frontend)/experiment/page.tsx @@ -1,15 +1,19 @@ -import ExperimentsTableServer from './ExperimentsTableServer' +import type { Experiment } from '@/payload-types' +import { getCollection } from '../../../lib/asyncHelperFunctions' +import ExperimentSection from './ExperimentSection' -function ExperimentsTable() { +async function Experiments() { + const experiments = (await getCollection('experiments')).docs as Experiment[] return ( + <> <div>testpage</div> - <ExperimentsTableServer /> + <ExperimentSection experiments={experiments} /> </> ) } -export default ExperimentsTable +export default Experiments /** import config from '@payload-config' diff --git a/src/app/(frontend)/publications/page.tsx b/src/app/(frontend)/publications/page.tsx index 5bb52821b55ff02df541adf3e149e14fdf62fda7..dc656df0098a54de5c750cf597843cf6f1f221c2 100644 --- a/src/app/(frontend)/publications/page.tsx +++ b/src/app/(frontend)/publications/page.tsx @@ -1,11 +1,11 @@ import type { Publication } from '@/payload-types' -import { getPublications } from '../../../lib/asyncHelperFunctions' +import { getCollection } from '../../../lib/asyncHelperFunctions' import PublicationsSection from '../components/PublicationsSection' // import './publications.css' export default async function Publications() { - const publications = (await getPublications('publications')).docs as Publication[] + const publications = (await getCollection('publications')).docs as Publication[] return ( <PublicationsSection publications={publications} /> diff --git a/src/lib/asyncHelperFunctions.ts b/src/lib/asyncHelperFunctions.ts index a32eea6210a663b414381feae0de5cdc0909e400..5d470427c14bb76228d985fb899d7b96edacbf1d 100644 --- a/src/lib/asyncHelperFunctions.ts +++ b/src/lib/asyncHelperFunctions.ts @@ -6,7 +6,7 @@ import { getPayload } from 'payload' * collectionSlug is the slug of the collection to be retrieved * @returns collection via the payload API */ -export async function getPublications(collectionSlug: CollectionSlug) { +export async function getCollection(collectionSlug: CollectionSlug) { const payload = await getPayload({ config }) return await payload.find({ collection: collectionSlug, diff --git a/src/payload-types.ts b/src/payload-types.ts index 414f5a8e1b5e294b2f411b147453bd21d1e62ca8..e9d74f2e0121717a83d1b2ea9512fe1b70787e04 100644 --- a/src/payload-types.ts +++ b/src/payload-types.ts @@ -169,8 +169,8 @@ export interface NewsArticle { export interface Experiment { id: string; nummer: number; - titel?: string | null; - jahr: number; + title?: string; + year: number; speaker?: | { name: string; @@ -178,7 +178,7 @@ export interface Experiment { id?: string | null; }[] | null; - leiter: { + teamleader: { name: string; email: string; };