Skip to content
Snippets Groups Projects
Commit 293c7cdb authored by LarsLolies's avatar LarsLolies
Browse files

feat: experiment page changed payload to english, changed helper function

parent 009198d3
No related tags found
No related merge requests found
......@@ -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">
......
......@@ -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} />
))
)
: (
......
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'
......
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} />
......
......@@ -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,
......
......@@ -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;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment