--- import { getCollection } from "astro:content"; import Layout from "../layouts/Layout.astro"; import Card from "../components/Card.astro"; import EventCard from "../components/EventCard.astro"; import BankCard from "../components/BankCard.astro"; // Import du nouveau composant const allHumans = await getCollection("humans"); const myHumans = allHumans.filter((entry: any) => entry.id.startsWith("latchimynicolas/")); const allEvents = await getCollection("events"); const allBanks = await getCollection("banks"); // Récupération des cartes banques/objets // 1. Tri chronologique global const sortedEntries = allHumans.sort( (a: any, b: any) => new Date(b.data.date).getTime() - new Date(a.data.date).getTime() ); const sortedEvents = allEvents.sort( (a: any, b: any) => new Date(a.data.date).getTime() - new Date(b.data.date).getTime(), ); const sortedBanks = allBanks.sort( (a: any, b: any) => a.data.name.localeCompare(b.data.name)); // 2. Groupement par utilisateur const groupedHumans = sortedEntries.reduce((acc: any, entry: any) => { const userName = entry.data.name; if (!acc[userName]) acc[userName] = []; acc[userName].push(entry); return acc; }, {}); ---
← Retour au flux

Collection

{/* SECTION HUMAINS */} { Object.entries(groupedHumans).map(([userName, cards]) => (

{userName} ({(cards as any[]).length} souffles)

{ (cards as any[]).map((entry) => (
)) }

)) } {/* SECTION ÉVÉNEMENTS (Même structure que les humains) */} { sortedEvents.length > 0 && (

Événements ({sortedEvents.length} cartes)

{sortedEvents.map((event) => (
))}

Trésoreries (Sources de Flux)

{ sortedBanks.map((bank) => ( )) }
) }