diff --git a/src/components/EventCard.astro b/src/components/EventCard.astro new file mode 100644 index 0000000..d349b05 --- /dev/null +++ b/src/components/EventCard.astro @@ -0,0 +1,134 @@ +--- +// src/components/EventCard.astro +const { frontmatter } = Astro.props; +const { title, date, location, target_date, participants, summary, status } = + frontmatter; +--- + +
+
+
+ ÉVÉNEMENT IRL + {status} +
+ +
+
{location}
+

{title}

+
+ +
+ Projet prévu pour : {target_date} +
+ +
+

{summary}

+ +
+ Membres impliqués : +
+ {participants.map((p) => {p})} +
+
+
+ + +
+
+ + diff --git a/src/pages/[...id].astro b/src/pages/[...id].astro index 07685d6..95ba9d7 100644 --- a/src/pages/[...id].astro +++ b/src/pages/[...id].astro @@ -3,85 +3,131 @@ import { getCollection } from "astro:content"; import Layout from "../layouts/Layout.astro"; import TimelineBoard from "../components/TimelineBoard.astro"; import Card from "../components/Card.astro"; +import EventCard from "../components/EventCard.astro"; export async function getStaticPaths() { const allHumans = await getCollection("humans"); - const sortedEntries = allHumans.sort( + const allEvents = await getCollection("events"); + + const sortedHumans = allHumans.sort( (a, b) => new Date(b.data.date).getTime() - new Date(a.data.date).getTime(), ); - return allHumans.map((entry) => ({ + + const humanPaths = allHumans.map((entry) => ({ params: { id: entry.id.replace(/\.md$/, "") }, - props: { entry, sortedEntries }, + props: { entry, sortedEntries: sortedHumans, type: "human" }, })); + + const eventPaths = allEvents.map((entry) => ({ + params: { id: entry.id.replace(/\.md$/, "") }, + props: { entry, sortedEntries: [], type: "event" }, + })); + + return [...humanPaths, ...eventPaths]; } -const { entry, sortedEntries } = Astro.props; -const manifestations = entry.data.manifestations || []; +const { entry, sortedEntries, type } = Astro.props; +const { Content } = await entry.render(); -// Groupement des manifestations par catégorie (cercle) +const manifestations = entry.data.manifestations || []; const groupedManifestations = manifestations.reduce((acc, m) => { - if (!acc[m.cercle]) { - acc[m.cercle] = []; - } + if (!acc[m.cercle]) acc[m.cercle] = []; acc[m.cercle].push(m); return acc; }, {}); -// Définition de l'ordre d'affichage des cercles const circleOrder = ["PRO", "SAN", "HYG", "SOC", "FLX"]; --- - +
← Retour à la collection
+
- + { + type === "human" ? ( + + ) : ( + + ) + }