ajout de la gestion des favoris
All checks were successful
Build and Push App / build (push) Successful in 13m38s
All checks were successful
Build and Push App / build (push) Successful in 13m38s
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
import React, { useState, useEffect, Suspense } from 'react';
|
||||
import Link from 'next/link';
|
||||
import { LayoutDashboard, Edit3, ShoppingBag, CreditCard, LogOut, Eye, MessageSquare, User as UserIcon, Rocket, ShieldAlert } from 'lucide-react';
|
||||
import { LayoutDashboard, Edit3, ShoppingBag, CreditCard, LogOut, Eye, MessageSquare, User as UserIcon, Rocket, ShieldAlert, Heart } from 'lucide-react';
|
||||
import { useRouter, useSearchParams } from 'next/navigation';
|
||||
import { User } from '../../types';
|
||||
import DashboardOverview from '../../components/dashboard/DashboardOverview';
|
||||
@@ -12,6 +12,7 @@ import DashboardProfileClient from '../../components/dashboard/DashboardProfileC
|
||||
import DashboardMessages from '../../components/dashboard/DashboardMessages';
|
||||
import DashboardOffers from '../../components/dashboard/DashboardOffers';
|
||||
import PricingSection from '../../components/PricingSection';
|
||||
import DashboardFavorites from '../../components/dashboard/DashboardFavorites';
|
||||
import { useUser } from '../../components/UserProvider';
|
||||
|
||||
const DashboardContent = () => {
|
||||
@@ -21,7 +22,7 @@ const DashboardContent = () => {
|
||||
const searchParams = useSearchParams();
|
||||
const chatId = searchParams.get('chatId') || searchParams.get('chat');
|
||||
|
||||
const [currentView, setCurrentView] = useState<'overview' | 'profile' | 'offers' | 'subscription' | 'messages' | 'personal-profile'>('overview');
|
||||
const [currentView, setCurrentView] = useState<'overview' | 'profile' | 'offers' | 'subscription' | 'messages' | 'personal-profile' | 'favorites'>('overview');
|
||||
const [business, setBusiness] = useState<any>(null);
|
||||
const [stats, setStats] = useState<{ totalViews: number, contactClicks: number, dailyStats: any[] } | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
@@ -33,7 +34,7 @@ const DashboardContent = () => {
|
||||
|
||||
// Handle view from URL
|
||||
const viewParam = searchParams.get('view');
|
||||
if (viewParam && ['overview', 'profile', 'offers', 'subscription', 'messages', 'personal-profile'].includes(viewParam)) {
|
||||
if (viewParam && ['overview', 'profile', 'offers', 'subscription', 'messages', 'personal-profile', 'favorites'].includes(viewParam)) {
|
||||
setCurrentView(viewParam as any);
|
||||
}
|
||||
}, [searchParams]);
|
||||
@@ -220,6 +221,11 @@ const DashboardContent = () => {
|
||||
Mon Profil Client
|
||||
</button>
|
||||
|
||||
<button onClick={() => setCurrentView('favorites')} className={`${currentView === 'favorites' ? 'bg-brand-50 text-brand-700' : 'text-gray-600 hover:bg-gray-50 hover:text-gray-900'} group flex items-center px-2 py-2 text-sm font-medium rounded-md w-full`}>
|
||||
<Heart className={`${currentView === 'favorites' ? 'text-brand-500' : 'text-gray-400 group-hover:text-gray-500'} mr-3 flex-shrink-0 h-5 w-5`} />
|
||||
Mes Favoris
|
||||
</button>
|
||||
|
||||
<div className="pt-4 pb-2">
|
||||
<p className="px-3 text-[10px] font-semibold text-gray-400 uppercase tracking-wider">Espace Business</p>
|
||||
</div>
|
||||
@@ -267,6 +273,7 @@ const DashboardContent = () => {
|
||||
{currentView === 'overview' && 'Vue d\'ensemble'}
|
||||
{currentView === 'messages' && 'Mes Messages'}
|
||||
{currentView === 'personal-profile' && 'Mon Profil Client'}
|
||||
{currentView === 'favorites' && 'Mes Favoris'}
|
||||
{currentView === 'profile' && (user.role === 'ENTREPRENEUR' ? 'Ma Fiche Entreprise' : 'Créer mon Business')}
|
||||
{currentView === 'offers' && 'Gestion des Offres'}
|
||||
{currentView === 'subscription' && 'Mon Abonnement'}
|
||||
@@ -302,6 +309,7 @@ const DashboardContent = () => {
|
||||
{currentView === 'overview' && <DashboardOverview business={displayBusiness} stats={stats} />}
|
||||
{currentView === 'messages' && <DashboardMessages onMessagesRead={fetchUnreadCount} initialConversationId={chatId} />}
|
||||
{currentView === 'personal-profile' && <DashboardProfileClient />}
|
||||
{currentView === 'favorites' && <DashboardFavorites />}
|
||||
{currentView === 'profile' && <DashboardProfile business={displayBusiness} setBusiness={setBusiness} />}
|
||||
{currentView === 'offers' && <DashboardOffers businessId={displayBusiness.id} plan={displayBusiness.plan} />}
|
||||
{currentView === 'subscription' && (
|
||||
|
||||
Reference in New Issue
Block a user