// ----------------------------------------------------------------------------- // Groupe KA — shared component (rent-ka edition, bilingual matching) // components/AmenityIco.tsx : icône contextuelle d'une commodité ou inclusion. // Fini l'icône unique répétée dix fois : chaque libellé est associé par // mots-clés (accents neutralisés) à l'un des ~30 pictos maison — trait 1.8, // 24×24, currentColor. Repli : ✓ (confirmé) ou étoile (mention libre). // ----------------------------------------------------------------------------- import { ReactNode } from "react"; const ICONS: Record = { heat: (<>), bolt: , droplet: (<>), wifi: , dishwasher: (<>), washer: (<>), fridge: (<>), snow: , elevator: (<>), balcony: , pool: , gym: , laundry: , box: , parking: (<>), garage: , sofa: , nosmoke: , paw: (<>), fire: (<>), tree: , spa: , shield: (<>), eye: (<>), waves: , calendar: (<>), ruler: , bed: , bath: , people: (<>), stairs: , door: (<>), home: , sun: (<>), check: , spark: , }; /** [pattern (on lowercase accent-stripped label), icon key] — order = priority. * Bilingual: sources publish in English AND French across Canada. */ const RULES: [RegExp, string][] = [ [/lave-?vaisselle|dish ?washer/, "dishwasher"], [/laveuse|secheuse|lessive|washer|dryer|in-?(suite|unit) laundry/, "washer"], [/buanderie|laundry/, "laundry"], [/electromenager|frigo|refrigerateur|cuisiniere|four incl|poele|appliance|fridge|refrigerator|stove|oven incl/, "fridge"], [/climatis|air clim|thermopompe|echangeur d.air|\ba\/?c\b|air condition|heat pump|central air/, "snow"], [/chauff|\bheat\b|heating|heated/, "heat"], [/eau chaude|hot water/, "droplet"], [/electric|eclair|hydro|utilities/, "bolt"], [/internet|wi-?fi|cablodistribution|\bcable\b|fibre|fiber/, "wifi"], [/ascenseur|elevator|lift/, "elevator"], [/balcon|terrasse|patio|loggia|veranda|terrace|deck/, "balcony"], [/piscine|pool/, "pool"], [/gym|salle d.entrainement|exercice|fitness|exercise/, "gym"], [/rangement|locker|entreposage|walk-?in|penderie|storage|closet/, "box"], [/garage/, "garage"], [/stationnement|parking|abri d.auto|carport/, "parking"], [/meuble|furnished/, "sofa"], [/non-?fumeur|sans fumee|non-?smoking|smoke-?free/, "nosmoke"], [/animau|chat|chien|\bpets?\b|\bcats?\b|\bdogs?\b/, "paw"], [/foyer|cheminee|poele a bois|fireplace|wood stove/, "fire"], [/spa\b|jacuzzi|sauna|bain tourbillon|hot tub|whirlpool/, "spa"], [/securite|surveill|camera|alarme|interphone|concierge|portier|security|intercom|doorman/, "shield"], [/\bvue\b|panoram|\bview\b/, "eye"], [/bord de l.eau|acces au lac|\blac\b|riviere|plage|navigable|waterfront|\blake\b|river|beach/, "waves"], [/cour|jardin|arbre|boise|verdure|gazon|amenagement paysager|yard|garden|landscap|green space/, "tree"], [/ensoleill|luminosite|lumineux|solarium|sunny|bright|natural light/, "sun"], [/dispo|libre |libre$|available/, "calendar"], [/pi2|pieds carres|superficie|\bm2\b|sq ?ft|square (feet|foot)/, "ruler"], [/chambre|bedroom/, "bed"], [/salle[s]? de bain|salle[s]? d.eau|douche|\bsdb\b|bathroom|shower|ensuite/, "bath"], [/occupant|personne|colocataire|roommate/, "people"], [/etage|niveau|escalier|mezzanine|\bfloor\b|stairs/, "stairs"], [/studio|loft|(^|\s)\d ?1\/2|½|bachelor/, "door"], [/maison|plain-?pied|unifamiliale|house|bungalow|townhouse/, "home"], [/egout|septique|fosse|sewer|septic/, "waves"], [/aqueduc|approvisionnement en eau|puits|water supply|\bwell\b/, "droplet"], [/construction|neuve|fondation|toiture|revetement|renov|newly built|roof/, "home"], [/commerce|zonage|usage|zoning/, "box"], ]; /** minuscules + accents neutralisés, pour un appariement robuste */ const norm = (s: string) => s.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, ""); export function amenityKey(label: string, fallback = "check"): string { const n = norm(label); for (const [re, key] of RULES) if (re.test(n)) return key; return fallback; } export default function AmenityIco({ label, size = 16, fallback = "check" }: { label: string; size?: number; fallback?: string }) { return ( ); }