--- import Layout from '../../layouts/Layout.astro'; import { Icon } from 'astro-icon/components'; import { spectacles, agenda } from '../../data'; export function getStaticPaths() { return spectacles.map(s => ({ params: { id: s.id }, })); } const { id } = Astro.params; const spectacle = spectacles.find(s => s.id === id)!; const upcomingDates = agenda .filter(event => event.spectacleId === id) .sort((a, b) => new Date(a.date).getTime() - new Date(b.date).getTime()); ---
Tous les spectacles
{spectacle.title}
{spectacle.retired && (
Spectacle retraité
)}

{spectacle.title}

{spectacle.age}
{spectacle.duration && (
{spectacle.duration}
)}
{spectacle.summary && (

{spectacle.summary}

)} {spectacle.credits && (

{spectacle.credits}

)} {spectacle.dossierPro && spectacle.dossierPro !== '#' && ( Dossier Pédagogique )}
{spectacle.gallery.length > 0 && (

Galerie

{spectacle.gallery.map((img, index) => (
{`${spectacle.title}
))}
)} {upcomingDates.length > 0 && (

Prochaines dates

{upcomingDates.map(event => { const dateObj = new Date(event.date); return (
{dateObj.toLocaleString('fr-FR', { month: 'short' })} {dateObj.getDate()}
{dateObj.toLocaleString('fr-FR', { weekday: 'long', hour: '2-digit', minute: '2-digit' })}
{event.location}
{event.bookingLink && ( Réserver )}
); })}
)}