import React, { useEffect, useMemo, useState } from 'react'; import { useParams, Link } from 'react-router-dom'; import { ArrowLeft, MapPin, Globe, Mail, Phone, CheckCircle, Star, Facebook, Linkedin, Instagram, Play, Share2, Send, Award, Quote } from 'lucide-react'; import { MOCK_BUSINESSES, MOCK_OFFERS } from '../services/mockData'; import { OfferType } from '../types'; const BusinessDetailPage = () => { const { id } = useParams(); const business = MOCK_BUSINESSES.find(b => b.id === id); const [contactForm, setContactForm] = useState({ name: '', email: '', message: '' }); const [formStatus, setFormStatus] = useState<'idle' | 'sending' | 'success'>('idle'); const businessOffers = useMemo(() => { return MOCK_OFFERS.filter(o => o.businessId === id && o.active); }, [id]); useEffect(() => { window.scrollTo(0, 0); }, [id]); if (!business) { return (

Entreprise introuvable

Retour à l'annuaire
); } // Helper to get YouTube embed URL const getEmbedUrl = (url: string) => { const regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/; const match = url.match(regExp); return (match && match[2].length === 11) ? `https://www.youtube.com/embed/${match[2]}` : null; }; const videoEmbedUrl = business.videoUrl ? getEmbedUrl(business.videoUrl) : null; const handleContactSubmit = (e: React.FormEvent) => { e.preventDefault(); setFormStatus('sending'); // Simulate API call setTimeout(() => { setFormStatus('success'); setContactForm({ name: '', email: '', message: '' }); // Reset status after 3 seconds setTimeout(() => setFormStatus('idle'), 3000); }, 1500); }; return (
{/* Header Banner */}
Retour
{/* Profile Header */}
{business.name} {business.isFeatured && (
)}

{business.name}

{business.verified && }
{business.category}
{business.isFeatured && (
ENTREPRENEUR DU MOIS
)}
Contacter
{business.location}
{business.rating} ({business.viewCount} vues)
{business.tags.map(tag => ( #{tag} ))}
{/* Left Column: Main Content */}
{/* Presentation */}

À propos

{business.description}

{/* Founder Section (Specifically for Featured or if data exists) */} {(business.founderName || business.founderImageUrl) && (

Le Fondateur

{business.founderImageUrl && ( {business.founderName} )}

{business.founderName}

CEO & Fondateur

"Notre mission est d'apporter des solutions concrètes et adaptées aux réalités locales, tout en visant l'excellence internationale."

{business.keyMetric && (
🚀 {business.keyMetric}
)}
)} {/* Video */} {videoEmbedUrl && (

Présentation Vidéo

)} {/* Offers */} {businessOffers.length > 0 && (

Produits & Services

{businessOffers.map(offer => (
{offer.title} {offer.type === OfferType.PRODUCT ? 'Produit' : 'Service'}

{offer.title}

{new Intl.NumberFormat('fr-FR').format(offer.price)} {offer.currency}

))}
)}
{/* Right Column: Sidebar */}
{/* Contact Card */}

Contact

{/* Direct Info */}
{business.contactEmail}
{business.contactPhone && (
{business.contactPhone}
)} {business.socialLinks?.website && (
Site Web
)}
{/* Contact Form */}

Envoyer un message

{formStatus === 'success' ? (
Message envoyé avec succès !
) : (
setContactForm({...contactForm, name: e.target.value})} />
setContactForm({...contactForm, email: e.target.value})} />