.
This commit is contained in:
@@ -4,7 +4,7 @@ import Link from 'next/link';
|
||||
import { User as UserIcon, Award, Briefcase, MapPin, ArrowRight } from 'lucide-react';
|
||||
import { Business } from '../types';
|
||||
|
||||
const DirectoryHero = ({ featuredBusiness }: { featuredBusiness: Business }) => {
|
||||
const AnnuaireHero = ({ featuredBusiness }: { featuredBusiness: Business }) => {
|
||||
if (!featuredBusiness) return null;
|
||||
|
||||
return (
|
||||
@@ -75,7 +75,7 @@ const DirectoryHero = ({ featuredBusiness }: { featuredBusiness: Business }) =>
|
||||
|
||||
<div className="flex flex-col sm:flex-row gap-4">
|
||||
<Link
|
||||
href={`/directory/${featuredBusiness.id}`}
|
||||
href={`/annuaire/${featuredBusiness.slug || featuredBusiness.id}`}
|
||||
className="inline-flex items-center justify-center px-6 py-3 border border-transparent text-base font-medium rounded-md text-white bg-brand-600 hover:bg-brand-700 shadow-lg hover:shadow-xl transition-all"
|
||||
>
|
||||
Voir la fiche complète
|
||||
@@ -91,4 +91,4 @@ const DirectoryHero = ({ featuredBusiness }: { featuredBusiness: Business }) =>
|
||||
);
|
||||
};
|
||||
|
||||
export default DirectoryHero;
|
||||
export default AnnuaireHero;
|
||||
@@ -5,6 +5,7 @@ import React, { useState } from 'react';
|
||||
import Link from 'next/link';
|
||||
import { CheckCircle, MapPin, Star, Phone, Share2, Facebook, Linkedin, Instagram, Twitter } from 'lucide-react';
|
||||
import { Business } from '../types';
|
||||
import { toast } from 'react-hot-toast';
|
||||
|
||||
const BusinessCard: React.FC<{ business: Business }> = ({ business }) => {
|
||||
const [isShareOpen, setIsShareOpen] = useState(false);
|
||||
@@ -16,7 +17,7 @@ const BusinessCard: React.FC<{ business: Business }> = ({ business }) => {
|
||||
};
|
||||
|
||||
const handleShare = (platform: string) => {
|
||||
const url = encodeURIComponent(`${window.location.origin}/#/directory/${business.id}`);
|
||||
const url = encodeURIComponent(`${window.location.origin}/annuaire/${business.id}`);
|
||||
const text = encodeURIComponent(`Découvrez ${business.name} sur Afropreunariat`);
|
||||
|
||||
let shareLink = '';
|
||||
@@ -30,11 +31,11 @@ const BusinessCard: React.FC<{ business: Business }> = ({ business }) => {
|
||||
case 'linkedin':
|
||||
shareLink = `https://www.linkedin.com/sharing/share-offsite/?url=${url}`;
|
||||
break;
|
||||
case 'instagram':
|
||||
// Instagram web share is limited, alerting user
|
||||
alert("Pour partager sur Instagram, copiez le lien ou faites une capture d'écran.");
|
||||
setIsShareOpen(false);
|
||||
return;
|
||||
case 'instagram':
|
||||
// Instagram web share is limited, alerting user
|
||||
toast("Pour partager sur Instagram, copiez le lien ou faites une capture d'écran.", { icon: '📸' });
|
||||
setIsShareOpen(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (shareLink) {
|
||||
@@ -100,13 +101,13 @@ const BusinessCard: React.FC<{ business: Business }> = ({ business }) => {
|
||||
<img src={business.logoUrl} alt={business.name} className="w-full h-full object-cover rounded-md bg-gray-50" />
|
||||
</div>
|
||||
|
||||
<Link href={`/directory/${business.id}`} className="absolute inset-0 z-0" aria-label={`Voir ${business.name}`} />
|
||||
<Link href={`/annuaire/${business.slug || business.id}`} className="absolute inset-0 z-0" aria-label={`Voir ${business.name}`} />
|
||||
</div>
|
||||
|
||||
{/* Body */}
|
||||
<div className="pt-8 px-4 pb-4 flex-1 flex flex-col">
|
||||
<div className="flex justify-between items-start">
|
||||
<Link href={`/directory/${business.id}`} className="font-bold text-lg text-gray-900 truncate hover:text-brand-600 transition-colors">
|
||||
<Link href={`/annuaire/${business.slug || business.id}`} className="font-bold text-lg text-gray-900 truncate hover:text-brand-600 transition-colors">
|
||||
{business.name}
|
||||
</Link>
|
||||
{business.verified && <CheckCircle className="w-5 h-5 text-blue-500 flex-shrink-0 ml-1" />}
|
||||
@@ -124,7 +125,7 @@ const BusinessCard: React.FC<{ business: Business }> = ({ business }) => {
|
||||
<span className="text-sm font-bold ml-1 text-gray-700">{business.rating}</span>
|
||||
<span className="text-xs text-gray-400 ml-1">({business.viewCount} vues)</span>
|
||||
</div>
|
||||
<Link href={`/directory/${business.id}`} className="text-brand-600 text-sm font-medium hover:underline">Voir la fiche</Link>
|
||||
<Link href={`/annuaire/${business.slug || business.id}`} className="text-brand-600 text-sm font-medium hover:underline">Voir la fiche</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -23,7 +23,7 @@ const Footer = () => {
|
||||
<div>
|
||||
<h4 className="font-bold text-lg mb-4">Liens Rapides</h4>
|
||||
<ul className="space-y-2 text-gray-400 text-sm">
|
||||
<li><Link href="/directory" className="hover:text-brand-500">Rechercher une entreprise</Link></li>
|
||||
<li><Link href="/annuaire" className="hover:text-brand-500">Rechercher une entreprise</Link></li>
|
||||
<li><Link href="/login" className="hover:text-brand-500">Inscrire mon entreprise</Link></li>
|
||||
<li><Link href="/blog" className="hover:text-brand-500">Actualités & Conseils</Link></li>
|
||||
</ul>
|
||||
|
||||
@@ -27,7 +27,7 @@ const Navbar = () => {
|
||||
<Link href="/" className={`inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium ${pathname === '/' ? 'border-brand-500 text-gray-900' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'}`}>
|
||||
Accueil
|
||||
</Link>
|
||||
<Link href="/directory" className={`inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium ${pathname.startsWith('/directory') ? 'border-brand-500 text-gray-900' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'}`}>
|
||||
<Link href="/annuaire" className={`inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium ${pathname.startsWith('/annuaire') ? 'border-brand-500 text-gray-900' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'}`}>
|
||||
Annuaire
|
||||
</Link>
|
||||
<Link href="/afrolife" className={`inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium ${pathname.startsWith('/afrolife') ? 'border-brand-500 text-brand-600' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'}`}>
|
||||
@@ -66,7 +66,7 @@ const Navbar = () => {
|
||||
<div className="sm:hidden bg-white border-t">
|
||||
<div className="pt-2 pb-3 space-y-1">
|
||||
<Link href="/" className="block pl-3 pr-4 py-2 border-l-4 border-transparent text-base font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-50 hover:border-gray-300" onClick={() => setIsOpen(false)}>Accueil</Link>
|
||||
<Link href="/directory" className="block pl-3 pr-4 py-2 border-l-4 border-transparent text-base font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-50 hover:border-gray-300" onClick={() => setIsOpen(false)}>Annuaire</Link>
|
||||
<Link href="/annuaire" className="block pl-3 pr-4 py-2 border-l-4 border-transparent text-base font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-50 hover:border-gray-300" onClick={() => setIsOpen(false)}>Annuaire</Link>
|
||||
<Link href="/afrolife" className="block pl-3 pr-4 py-2 border-l-4 border-brand-500 text-base font-medium text-brand-700 bg-brand-50" onClick={() => setIsOpen(false)}>Afro Life</Link>
|
||||
<Link href="/blog" className="block pl-3 pr-4 py-2 border-l-4 border-transparent text-base font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-50 hover:border-gray-300" onClick={() => setIsOpen(false)}>Blog</Link>
|
||||
{user ? (
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user