chore: migrate pages and media to be cms controlled.
This commit is contained in:
@@ -2,7 +2,9 @@ import React, { useState } from 'react'
|
||||
import { useParams, Link } from '@/spa/router'
|
||||
import { motion } from 'framer-motion'
|
||||
import { Calendar, MapPin, Clock, Bell, BellOff, ArrowLeft, ChevronRight, Users, Tag } from 'lucide-react'
|
||||
import { getEventBySlug, EventUpdate, UpdateType } from '@/spa/data/events'
|
||||
import { getEventBySlug, EventUpdate, UpdateType, type BmpEvent } from '@/spa/data/events'
|
||||
import { useCmsRoute } from '@/spa/cmsRoute'
|
||||
import { docImageUrl } from '@/spa/cmsMediaField'
|
||||
import { useIsMobile } from '@/spa/hooks/useIsMobile'
|
||||
|
||||
const NAVY = '#111D55'
|
||||
@@ -75,7 +77,24 @@ function UpdateCard({ update, index }: { update: EventUpdate; index: number }) {
|
||||
// ── Main Component ────────────────────────────────────────────────────────────
|
||||
export default function EventDetail() {
|
||||
const { slug } = useParams<{ slug: string }>()
|
||||
const event = getEventBySlug(slug ?? '')
|
||||
const route = useCmsRoute()
|
||||
const cmsEvent = route?.collection === 'events' ? route.doc : undefined
|
||||
const event = getEventBySlug(slug ?? '') || (cmsEvent ? {
|
||||
slug: String(cmsEvent.slug || slug),
|
||||
title: String(cmsEvent.title || 'Event'),
|
||||
subtitle: String(cmsEvent.subtitle || cmsEvent.description || cmsEvent.meta?.description || ''),
|
||||
date: String(cmsEvent.date || 'Termin folgt'),
|
||||
time: String(cmsEvent.time || 'Uhrzeit folgt'),
|
||||
location: String(cmsEvent.location || 'Bayern'),
|
||||
venue: String(cmsEvent.venue || 'Ort folgt'),
|
||||
category: String(cmsEvent.category || 'Event'),
|
||||
status: (cmsEvent.status as any) || 'geplant',
|
||||
img: docImageUrl(cmsEvent, '/images/buehne-moderatoren.jpg'),
|
||||
description: String(cmsEvent.description || cmsEvent.meta?.description || ''),
|
||||
longDescription: String(cmsEvent.longDescription || cmsEvent.description || cmsEvent.meta?.description || 'Dieses Event wird aus Payload CMS geladen.'),
|
||||
eckdaten: Array.isArray(cmsEvent.eckdaten) ? cmsEvent.eckdaten as any : [],
|
||||
updates: Array.isArray(cmsEvent.updates) ? cmsEvent.updates as any : [],
|
||||
} as BmpEvent : undefined)
|
||||
const [subscribed, setSubscribed] = useState(false)
|
||||
const isMobile = useIsMobile()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user