--- import Layout from '../../layouts/Layout.astro'; import { Icon } from 'astro-icon/components'; import { fetchSpectacles, fetchAgenda } from '../../lib/storyblok'; const [spectacles, agenda] = await Promise.all([fetchSpectacles(), fetchAgenda()]); const sortedAgenda = [...agenda].sort((a, b) => new Date(a.date).getTime() - new Date(b.date).getTime()); const now = new Date(); ---

L'Agenda

Venez nous voir sur scène ! Chaque date est une nouvelle aventure.

{sortedAgenda.map((event, index) => { const spectacle = spectacles.find(s => s.id === event.spectacleId); const dateObj = new Date(event.date); const isPast = dateObj < now; return (
{/* Mobile */}
{/* Date — info principale */}
{dateObj.toLocaleString('fr-FR', { month: 'short' })} {dateObj.getDate()} {dateObj.getFullYear()}
{/* Titre + lieu */}
{isPast && ( Passé )}

{spectacle?.title}

{event.location}
{event.bookingLink && ( Réserver )}
{/* Affiche — repère visuel */} {spectacle?.affiche && ( {`Affiche )}
{/* Desktop: ligne horizontale */}
); })}
{sortedAgenda.length === 0 && (

Le nuage se prépare pour de nouveaux voyages...

)}