// ----------------------------------------------------------------------------- // Forma-Ka — Agrégateur de formations (province de Québec) // Auteur : Simon-Pierre Boucher — contact@spboucher.ai // components/FormationCard.tsx : carte de formation (grille de résultats) // Pas d'image imposée (rare dans le domaine) : monogramme de la source + // type de formation en badge, détails clés (mode, durée, ville, date). // ----------------------------------------------------------------------------- import { Link } from "react-router-dom"; import { Formation, MODE_ICONS, fmtDate, fmtHours, fmtPrice, sourceName } from "../api"; /** Couleur stable dérivée du domaine (pour le bandeau du monogramme). */ const HUES = [14, 36, 88, 152, 196, 226, 262, 318]; function hue(s: string): number { let h = 0; for (let i = 0; i < s.length; i++) h = (h * 31 + s.charCodeAt(i)) | 0; return HUES[Math.abs(h) % HUES.length]; } export default function FormationCard({ f }: { f: Formation }) { const img = f.images && f.images.length > 0 ? f.images[0] : null; const start = fmtDate(f.start_date); const dur = f.duration || fmtHours(f.duration_hours); const h = hue(f.category || f.source); return (