This commit is contained in:
2026-04-11 23:30:14 +02:00
parent 10ca8c3e8c
commit b73939d381
1574 changed files with 621 additions and 57974 deletions

View File

@@ -5,6 +5,7 @@ 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 '../../lib/geminiService';
import { toast } from 'react-hot-toast';
// Helper to extract youtube ID
const getYouTubeId = (url: string) => {
@@ -73,15 +74,15 @@ const DashboardProfile = ({ business, setBusiness }: { business: Business, setBu
const data = await res.json();
if (data.error) {
alert('Erreur: ' + data.error);
toast.error(data.error);
} else {
setBusiness(data);
alert('Profil mis à jour avec succès !');
// Optional: refresh page to show in directory
toast.success('Profil mis à jour avec succès !');
// Optional: refresh page to show in annuaire
}
} catch (error) {
console.error('Save error:', error);
alert('Erreur lors de la sauvegarde');
toast.error('Erreur lors de la sauvegarde');
}
};
@@ -111,6 +112,26 @@ const DashboardProfile = ({ business, setBusiness }: { business: Business, setBu
<label className="block text-sm font-medium text-gray-700">Nom de l'entreprise</label>
<input type="text" name="name" value={formData.name} onChange={handleInputChange} className="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:ring-brand-500 focus:border-brand-500 sm:text-sm" />
</div>
<div className="sm:col-span-3">
<label className="block text-sm font-medium text-gray-700">Lien personnalisé (URL)</label>
<div className="mt-1 flex rounded-md shadow-sm">
<span className="inline-flex items-center px-3 rounded-l-md border border-r-0 border-gray-300 bg-gray-50 text-gray-500 text-xs">
/annuaire/
</span>
<input
type="text"
name="slug"
placeholder="mon-entreprise"
value={formData.slug || ''}
onChange={(e) => {
const val = e.target.value.toLowerCase().replace(/[^a-z0-9-]/g, '-');
setFormData({ ...formData, slug: val });
}}
className="flex-1 block w-full border border-gray-300 rounded-none rounded-r-md py-2 px-3 focus:ring-brand-500 focus:border-brand-500 sm:text-sm"
/>
</div>
<p className="mt-1 text-xs text-gray-500">Uniquement lettres, chiffres et tirets. Laissez vide pour utiliser l'ID par défaut.</p>
</div>
<div className="sm:col-span-3">
<label className="block text-sm font-medium text-gray-700">Secteur d'activité</label>
<select name="category" value={formData.category} onChange={handleInputChange} className="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:ring-brand-500 focus:border-brand-500 sm:text-sm">