diff --git a/src/components/Card.astro b/src/components/Card.astro index 7aa75bc..92e2720 100644 --- a/src/components/Card.astro +++ b/src/components/Card.astro @@ -476,8 +476,7 @@ const manualLayer = [ align-items: center; } .med-tag { - font-size: 0.9rem; - filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.5)); + font-size: 0.6rem; cursor: help; } diff --git a/src/pages/index.astro b/src/pages/index.astro index 18fd3a0..478e6ea 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -4,23 +4,22 @@ import Layout from "../layouts/Layout.astro"; import Card from "../components/Card.astro"; import EventCard from "../components/EventCard.astro"; -// 1. Récupération des deux types de contenu +// 1. Récupération des données const allHumans = await getCollection("humans", ({ id }) => { return id.startsWith("latchimynicolas/"); }); const allEvents = await getCollection("events"); -// 2. Tri par date décroissante pour les humains +// 2. Tris temporels const sortedAll = allHumans.sort( (a, b) => new Date(b.data.date).getTime() - new Date(a.data.date).getTime(), ); -// 3. Récupération du dernier événement (ex: Camping Châteauroux) const latestEvent = allEvents.sort( (a, b) => new Date(b.data.date).getTime() - new Date(a.data.date).getTime(), )[0]; -// 4. Fonction de calcul de Streak (Série) [cite: 94] +// 3. Logique de Streak (Série) const getStreak = (name, entries) => { const userDates = entries .filter((e) => e.data.name === name) @@ -35,7 +34,6 @@ const getStreak = (name, entries) => { .reverse(); let streak = 0; let today = new Date(); - // Utiliser Date.UTC pour aligner la date locale avec le format ISO UTC des collections let checkDate = new Date( Date.UTC(today.getFullYear(), today.getMonth(), today.getDate()), ); @@ -49,8 +47,9 @@ const getStreak = (name, entries) => { } else { if (i === 0) { checkDate.setUTCDate(checkDate.getUTCDate() - 1); - const yesterdayStr = checkDate.toISOString().split("T")[0]; - if (uniqueDates.includes(yesterdayStr)) { + if ( + uniqueDates.includes(checkDate.toISOString().split("T")[0]) + ) { todaySkipped = true; continue; } @@ -59,7 +58,6 @@ const getStreak = (name, entries) => { } } - // Malus HYG [cite: 103, 106] const shiftDays = todaySkipped ? 1 : 0; const last7Days = Array.from({ length: 7 }, (_, j) => { let d = new Date( @@ -77,7 +75,7 @@ const getStreak = (name, entries) => { return streak; }; -// 5. Unicité par utilisateur [cite: 107] +// 4. Sélection de la carte principale const latestPerUser = Array.from( sortedAll .reduce((map, obj) => { @@ -86,10 +84,22 @@ const latestPerUser = Array.from( }, new Map()) .values(), ); + +// 5. CALCUL DE SYNERGIE +const activeSynergies = latestPerUser.map((user) => { + const matchingManifestation = user.data.manifestations?.find( + (m) => m.cercle === latestEvent?.data.circle, + ); + return { + userName: user.data.name, + hasSynergy: !!matchingManifestation, + cercle: latestEvent?.data.circle, + type: matchingManifestation?.type, + }; +}); --- - -

Ambient

+
-
- {/* Affichage des cartes Humains (Hebel) [cite: 110] */} - { - latestPerUser.map((entry) => { - const currentStreak = getStreak(entry.data.name, allHumans); - return ( +
+

Ambient

+ +
+ { + latestPerUser.map((entry) => { + const currentStreak = getStreak(entry.data.name, allHumans); + return ( +
+ + +
+ ); + }) + } + + { + latestEvent && (
- +
- ); - }) - } + ) + } +
- {/* Insertion de la carte Événement */} - { - latestEvent && ( -
- -
-