--- // src/components/EventCard.astro const { frontmatter } = Astro.props; const { title, date, location, target_date, participants, summary, status, circle, type, image, } = frontmatter; // Définition des couleurs par catégorie const categoryColors = { Festival: "#f59e0b", IRL: "#a1be18", Amical: "#8b5cf6", SI_Arbitrage: "violet", SI_Applicatif: "#5ca6e8", SI_Logistique: "Gold", SI_Strategie: "Grey", default: "#ec4899", }; const accentColor = categoryColors[type] || categoryColors["default"]; // --- LOGIQUE DE NOTIFICATION DE STATUT --- const today = new Date(); const eventDate = new Date(date); // Mise à zéro des heures pour comparer uniquement les jours today.setHours(0, 0, 0, 0); const compareDate = new Date(eventDate); compareDate.setHours(0, 0, 0, 0); const diffTime = compareDate - today; const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); let dynamicStatus = { label: status, color: "rgba(255,255,255,0.3)", icon: "" }; if (status === "Terminé") { dynamicStatus = { label: "Terminé", color: "#10b981" }; } else if (diffDays < 0) { dynamicStatus = { label: "En retard", color: "#ef4444" }; } else if (diffDays === 0) { dynamicStatus = { label: "Aujourd'hui", color: "#3b82f6" }; } else if (diffDays > 0 && diffDays <= 7) { dynamicStatus = { label: "Imminent", color: "#f59e0b" }; } ---
{type.toUpperCase()} { dynamicStatus.icon && ( {dynamicStatus.icon} ) } {dynamicStatus.label}
{location}

{title}

Prévu le : {new Date(date).toLocaleDateString("fr-FR")}

{summary}

{ type === "Festival" ? "Artistes invités :" : "Membres impliqués :" }
{participants.map((p) => {p})}