import styles from "./styles.module.scss" import { ContactPerson, Document, Event, Location } from '@/payload-types' import { Section } from '@/components/Section/Section' import { Title } from '@/components/Title/Title' import { Container } from '@/components/Container/Container' import { Col } from '@/components/Flex/Col' import { Pill } from '@/components/Pill/Pill' import { useDate } from '@/hooks/useCompactDate' import { readableDateTime } from '@/utils/readableDate' import { TextDiv } from '@/components/Text/TextDiv' import { Button } from '@/components/Button/Button' import Image, { StaticImageData } from 'next/image' import { locationString } from '@/utils/dto/location' import { ContactPerson2 } from '@/components/ContactPerson2/ContactPerson2' import { getPhoto } from '@/utils/dto/gallery' import { AdminMenu } from '@/components/AdminMenu/AdminMenu' import { EventRow } from '@/components/EventRow/EventRow' import { Row } from '@/components/Flex/Row' import classNames from 'classnames' type UpcomingOccurrence = { id: string date: string end?: string title: string href: string location: string cancelled: boolean } type EventProps = { id: string, title: string, date: string, endDateTime?: string, createdAt: string, cancelled: boolean, recurrenceType?: Event['recurrenceType'], recurrenceDescription?: string, location: string | Location, description: string, shortDescription: string, contact?: string | ContactPerson, group?: string, flyer?: Document, photo?: StaticImageData, rsvpLink?: string, isAuthenticated: boolean, upcomingOccurrences?: UpcomingOccurrence[], } export function EventPage( { id, title, date, endDateTime, createdAt, cancelled, recurrenceType, recurrenceDescription, location, description, shortDescription, contact, flyer, group, photo, rsvpLink, isAuthenticated, upcomingOccurrences, }: EventProps ) { const published = useDate(createdAt) const readableDate = readableDateTime(date, endDateTime) const where = locationString(location); const contactPersonPhoto = typeof contact === "object" ? getPhoto("thumbnail", contact.photo) : undefined; const isRecurring = recurrenceType && recurrenceType !== 'none' const hasOccurrences = upcomingOccurrences && upcomingOccurrences.length > 0; const dateOrRecurrence = recurrenceDescription ?? readableDate return ( <> {shortDescription} Publiziert am {published} { isRecurring && Regelmäßig } { cancelled && Abgesagt } { photo && } { typeof contact !== "undefined" && <> > } { (typeof flyer === "object" || group || rsvpLink) && { rsvpLink && Anmelden } { typeof flyer === "object" && flyer.url && Flyer herunterladen } { group && Erfahre mehr zur Gruppe } } { upcomingOccurrences && upcomingOccurrences.length > 0 && { upcomingOccurrences.map(o => )} } > ) }
{shortDescription}
Publiziert am {published}