mirror of
https://github.com/0xShay/ticketchain.git
synced 2026-01-11 05:03:26 +00:00
🎫 Add event details on event page
This commit is contained in:
@@ -4,37 +4,19 @@ import { useParams } from 'next/navigation';
|
||||
import Header from '../../../components/custom/header';
|
||||
import Footer from '../../../components/custom/footer';
|
||||
import EventDescription from '../../../components/custom/EventDescription';
|
||||
import { fetchEventDetails } from '@/lib/fetchEventDetails';
|
||||
|
||||
const ListingPage: React.FC = () => {
|
||||
const { eventId } = useParams();
|
||||
const [eventDetails, setEventDetails] = useState<any>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchEventDetails = async (id: number) => {
|
||||
alert(`Fetching details for event ID: ${id}`);
|
||||
// Dummy Response
|
||||
const details = {
|
||||
EventID: id,
|
||||
name: 'Example Event Name',
|
||||
date: '2023-12-01',
|
||||
location: 'Example Location',
|
||||
ticketPrice: 100,
|
||||
description: 'Detailed description of the event.',
|
||||
capacity: 300,
|
||||
ticketsSold: 295,
|
||||
imageUrl: [
|
||||
'https://via.placeholder.com/150',
|
||||
'https://via.placeholder.com/150',
|
||||
],
|
||||
host: 'Example Host',
|
||||
tickets: [1, 2, 3, 4],
|
||||
};
|
||||
return details;
|
||||
};
|
||||
|
||||
const getEventDetails = async () => {
|
||||
if (eventId) {
|
||||
const details = await fetchEventDetails(Number(eventId));
|
||||
const details = await fetchEventDetails({
|
||||
eventID: Number(eventId),
|
||||
toast: ({ title, variant }: any) => {alert(title);}});
|
||||
console.log(details)
|
||||
setEventDetails(details);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -48,21 +48,21 @@ const EventDescription: React.FC<EventDescriptionProps> = ({
|
||||
variant="outline"
|
||||
className="text-blue-600 bg-blue-100 px-3 py-1 rounded-full"
|
||||
>
|
||||
Price: ${eventDetails.ticketPrice}
|
||||
Price: ${eventDetails.ticketPrice.toFixed(2)}
|
||||
</Badge>
|
||||
</CardHeader>
|
||||
|
||||
<CardContent className="flex flex-col md:flex-row items-start space-y-8 md:space-y-0 md:space-x-10">
|
||||
<div className="md:w-1/2 flex justify-center">
|
||||
<ImageCarousel images={eventDetails.imageUrl} />
|
||||
<ImageCarousel images={eventDetails.imageUrl || []} />
|
||||
</div>
|
||||
<div className="md:w-1/2 text-gray-700">
|
||||
<Separator className="my-4" />
|
||||
<p className="leading-relaxed">{eventDetails.description}</p>
|
||||
<Separator className="my-4" />
|
||||
<p>Location: {eventDetails.location}</p>
|
||||
<p>Date: {eventDetails.date}</p>
|
||||
<p>Host: {eventDetails.host}</p>
|
||||
<p><b>Location:</b><br />{eventDetails.location}</p><br />
|
||||
<p><b>Date:</b><br />{eventDetails.date}</p><br />
|
||||
<p><b>Host:</b><br />{eventDetails.host}</p>
|
||||
{eventDetails.ticketsSold / eventDetails.capacity >= 0.9 && (
|
||||
<div className="mt-2 p-2 bg-yellow-300 text-black rounded">
|
||||
Limited Tickets Remaining!
|
||||
|
||||
Reference in New Issue
Block a user