--- 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 Cliquer sur une carte pour en voir les détails. {/* SECTION HUMAINS */} { Object.entries(groupedHumans).map(([userName, cards]) => ( {userName} ({(cards as any[]).length} souffles) { (cards as any[]).map((entry) => ( {new Date(entry.data.date).toLocaleDateString("fr-FR")} )) } )) } {/* SECTION ÉVÉNEMENTS (Même structure que les humains) */} { sortedEvents.length > 0 && ( Événements ({sortedEvents.length} cartes) {sortedEvents.map((event) => ( Détecté le :{" "} {event.data.target_date} ))} Trésoreries (Sources de Flux) { sortedBanks.map((bank) => ( {bank.data.sub_category === "finances" ? ( ) : ( /* Autre type de stuff si nécessaire */ Objet: {bank.data.name} )} )) } ) }
Cliquer sur une carte pour en voir les détails.
{new Date(entry.data.date).toLocaleDateString("fr-FR")}
Détecté le :{" "} {event.data.target_date}