import { Worship } from '@/payload-types' import { EventRowProps } from '@/components/EventRow/EventRow' /** * Transform the worship category to a readable string */ export const transformCategory = (category: "MASS" | "FAMILY" | "WORD"): string => { const type = { 'MASS': 'Eucharistiefeier', 'FAMILY': 'Familienmesse', 'WORD': 'Wort-Gottes-Feier', } return type[category] } /** * Transform worship data to `EventRow` component properties */ export const tranformWorship = (worship: Worship[]): EventRowProps[] => { return worship.map(w => { return { id: w.id, title: transformCategory(w.type), date: w.date, href: `/gottesdienst/${w.id}`, location: typeof w.location === 'string' ? w.location : w.location.name, cancelled: w.cancelled, } }) }