import React, { useState } from 'react'; import { Image as ImageIcon, Sparkles, Youtube, X, Globe, Facebook, Linkedin, Instagram } from 'lucide-react'; import { Business, CATEGORIES } from '../../types'; import { generateBusinessDescription } from '../../services/geminiService'; // Helper to extract youtube ID const getYouTubeId = (url: string) => { const regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/; const match = url.match(regExp); return (match && match[2].length === 11) ? match[2] : null; }; const DashboardProfile = ({ business, setBusiness }: { business: Business, setBusiness: (b: Business) => void }) => { const [formData, setFormData] = useState(business); const [videoInput, setVideoInput] = useState(business.videoUrl || ''); const [videoPreviewId, setVideoPreviewId] = useState(getYouTubeId(business.videoUrl || '')); const [isGenerating, setIsGenerating] = useState(false); const handleInputChange = (e: React.ChangeEvent) => { setFormData({ ...formData, [e.target.name]: e.target.value }); }; const handleSocialChange = (network: keyof typeof formData.socialLinks, value: string) => { setFormData({ ...formData, socialLinks: { ...formData.socialLinks, [network]: value } }); }; const handleVideoChange = (e: React.ChangeEvent) => { const url = e.target.value; setVideoInput(url); setVideoPreviewId(getYouTubeId(url)); setFormData({ ...formData, videoUrl: url }); }; const handleAiGenerate = async () => { setIsGenerating(true); const text = await generateBusinessDescription(formData.name, formData.category, "Innovation, Qualité, Service client"); setFormData(prev => ({ ...prev, description: text })); setIsGenerating(false); }; const handleSave = () => { setBusiness(formData); alert('Profil mis à jour avec succès !'); }; return (

Éditer mon profil

{/* A. Bloc Identité Visuelle */}

Identité Visuelle

Logo actuel

Glissez votre logo ici ou cliquez pour parcourir