|
| 1 | +import { notFound } from "next/navigation"; |
| 2 | +import Image from "next/image"; |
| 3 | +import { CalendarIcon, MapPinIcon, Clock } from "lucide-react"; |
| 4 | +import { format } from "date-fns"; |
| 5 | +import { TicketSelector } from "@/components/TicketSelector"; |
| 6 | +import eventsData from "@/const/data.json"; |
| 7 | + |
| 8 | +async function getEventById(id: string) { |
| 9 | + // In a real app, this would be a DB or API call |
| 10 | + const event = eventsData.events.find((event) => event.id === id); |
| 11 | + if (!event) return null; |
| 12 | + return event; |
| 13 | +} |
| 14 | + |
| 15 | +export default async function EventDetailsPage({ |
| 16 | + params, |
| 17 | +}: { |
| 18 | + params: { id: string }; |
| 19 | +}) { |
| 20 | + const event = await getEventById(params.id); |
| 21 | + |
| 22 | + if (!event) { |
| 23 | + notFound(); |
| 24 | + } |
| 25 | + |
| 26 | + return ( |
| 27 | + <div className="min-h-screen bg-gray-50"> |
| 28 | + {/* Hero Section */} |
| 29 | + <div className="relative h-[400px] w-full"> |
| 30 | + <Image |
| 31 | + src={event.headerImage} |
| 32 | + alt={event.name} |
| 33 | + fill |
| 34 | + className="object-cover" |
| 35 | + priority |
| 36 | + /> |
| 37 | + <div className="absolute inset-0 bg-black/50" /> |
| 38 | + <div className="absolute bottom-8 left-8"> |
| 39 | + <span className="inline-block px-3 py-1 mb-4 text-sm font-medium text-white bg-[#099C77] rounded-full"> |
| 40 | + {event.type} |
| 41 | + </span> |
| 42 | + <h1 className="text-4xl font-bold text-white">{event.name}</h1> |
| 43 | + </div> |
| 44 | + </div> |
| 45 | + |
| 46 | + {/* Content Section */} |
| 47 | + <div className="container mx-auto px-4 py-8"> |
| 48 | + <div className="grid grid-cols-1 lg:grid-cols-3 gap-8"> |
| 49 | + {/* Main Content */} |
| 50 | + <div className="lg:col-span-2 space-y-8"> |
| 51 | + {/* Event Details */} |
| 52 | + <section className="bg-white rounded-xl p-6 shadow-sm"> |
| 53 | + <h2 className="text-2xl font-semibold mb-4">Event Details</h2> |
| 54 | + <div className="space-y-4"> |
| 55 | + <div className="flex items-center gap-3"> |
| 56 | + <CalendarIcon className="w-5 h-5 text-[#099C77]" /> |
| 57 | + <span> |
| 58 | + {format(new Date(event.dateTime), "MMMM d, yyyy")} |
| 59 | + </span> |
| 60 | + </div> |
| 61 | + <div className="flex items-center gap-3"> |
| 62 | + <Clock className="w-5 h-5 text-[#099C77]" /> |
| 63 | + <span> |
| 64 | + {format(new Date(event.dateTime), "h:mm a")} -{" "} |
| 65 | + {format(new Date(event.endDateTime), "h:mm a")} |
| 66 | + </span> |
| 67 | + </div> |
| 68 | + <div className="flex items-center gap-3"> |
| 69 | + <MapPinIcon className="w-5 h-5 text-[#099C77]" /> |
| 70 | + <span> |
| 71 | + {event.location.venue}, {event.location.city},{" "} |
| 72 | + {event.location.country} |
| 73 | + </span> |
| 74 | + </div> |
| 75 | + </div> |
| 76 | + </section> |
| 77 | + |
| 78 | + {/* About Section */} |
| 79 | + <section className="bg-white rounded-xl p-6 shadow-sm"> |
| 80 | + <h2 className="text-2xl font-semibold mb-4">About the Event</h2> |
| 81 | + <p className="text-gray-600">{event.organizer.description}</p> |
| 82 | + </section> |
| 83 | + |
| 84 | + {/* Organizer Section */} |
| 85 | + <section className="bg-white rounded-xl p-6 shadow-sm"> |
| 86 | + <h2 className="text-2xl font-semibold mb-4">Organizer</h2> |
| 87 | + <div className="flex items-center gap-4"> |
| 88 | + <div className="relative h-16 w-16 rounded-full overflow-hidden"> |
| 89 | + <Image |
| 90 | + src={event.organizer.logo} |
| 91 | + alt={event.organizer.name} |
| 92 | + fill |
| 93 | + className="object-cover" |
| 94 | + /> |
| 95 | + </div> |
| 96 | + <div> |
| 97 | + <h3 className="font-semibold">{event.organizer.name}</h3> |
| 98 | + <p className="text-sm text-gray-600">Event Organizer</p> |
| 99 | + </div> |
| 100 | + </div> |
| 101 | + </section> |
| 102 | + </div> |
| 103 | + |
| 104 | + {/* Ticket Selection Sidebar */} |
| 105 | + <div className="lg:col-span-1"> |
| 106 | + <TicketSelector event={event} /> |
| 107 | + </div> |
| 108 | + </div> |
| 109 | + </div> |
| 110 | + </div> |
| 111 | + ); |
| 112 | +} |
0 commit comments