--- 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"; 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"); // 1. Tri 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 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)
)) } {/* SECTION ÉVÉNEMENTS */} { sortedEvents.length > 0 && (
Événements ({sortedEvents.length} cartes)
{sortedEvents.map((event) => (
))}

) } {/* SECTION TRÉSORERIES */}
Trésoreries (Sources de Flux)
{ sortedBanks.map((bank) => ( )) }