This commit is contained in:
David 2026-01-16 15:44:16 +01:00
parent d9868dd49f
commit 0d814e9a94

View File

@ -21,10 +21,31 @@ import {
Anchor,
Container,
FileText,
LayoutDashboard,
} from 'lucide-react';
import { useAuth } from '@/lib/context/auth-context';
export default function LandingPage() {
const [isScrolled, setIsScrolled] = useState(false);
const { user, isAuthenticated, loading } = useAuth();
// Helper function to get user initials
const getUserInitials = () => {
if (!user) return '';
const firstInitial = user.firstName?.charAt(0)?.toUpperCase() || '';
const lastInitial = user.lastName?.charAt(0)?.toUpperCase() || '';
return firstInitial + lastInitial || user.email?.charAt(0)?.toUpperCase() || '?';
};
// Helper function to get full name
const getFullName = () => {
if (!user) return '';
if (user.firstName && user.lastName) {
return `${user.firstName} ${user.lastName}`;
}
return user.email || '';
};
const heroRef = useRef(null);
const featuresRef = useRef(null);
const statsRef = useRef(null);
@ -225,6 +246,28 @@ export default function LandingPage() {
>
Tarifs
</Link>
{/* Affichage conditionnel: connecté vs non connecté */}
{loading ? (
<div className="w-8 h-8 rounded-full bg-white/20 animate-pulse" />
) : isAuthenticated && user ? (
<Link
href="/dashboard"
className="flex items-center space-x-3 group"
>
{/* Avatar avec initiales */}
<div className="w-10 h-10 rounded-full bg-brand-turquoise flex items-center justify-center text-white font-semibold text-sm border-2 border-white/30 group-hover:border-white transition-colors">
{getUserInitials()}
</div>
{/* Nom de l'utilisateur */}
<span className="text-white font-medium group-hover:text-brand-turquoise transition-colors max-w-[150px] truncate">
{getFullName()}
</span>
{/* Icône dashboard */}
<LayoutDashboard className="w-5 h-5 text-white/70 group-hover:text-brand-turquoise transition-colors" />
</Link>
) : (
<>
<Link
href="/login"
className="text-white hover:text-brand-turquoise transition-colors font-medium"
@ -237,6 +280,8 @@ export default function LandingPage() {
>
Commencer Gratuitement
</Link>
</>
)}
</div>
</div>
</div>
@ -310,6 +355,16 @@ export default function LandingPage() {
transition={{ duration: 0.8, delay: 0.5 }}
className="flex flex-col sm:flex-row items-center justify-center space-y-4 sm:space-y-0 sm:space-x-6 mb-12"
>
{isAuthenticated && user ? (
<Link
href="/dashboard"
className="group px-8 py-4 bg-brand-turquoise text-white rounded-lg hover:bg-brand-turquoise/90 transition-all hover:shadow-2xl hover:scale-105 font-semibold text-lg w-full sm:w-auto flex items-center justify-center space-x-2"
>
<span>Accéder au Dashboard</span>
<LayoutDashboard className="w-5 h-5 group-hover:translate-x-1 transition-transform" />
</Link>
) : (
<>
<Link
href="/register"
className="group px-8 py-4 bg-brand-turquoise text-white rounded-lg hover:bg-brand-turquoise/90 transition-all hover:shadow-2xl hover:scale-105 font-semibold text-lg w-full sm:w-auto flex items-center justify-center space-x-2"
@ -323,6 +378,8 @@ export default function LandingPage() {
>
Voir la démo
</Link>
</>
)}
</motion.div>
</motion.div>
</div>
@ -703,6 +760,16 @@ export default function LandingPage() {
variants={itemVariants}
className="flex flex-col sm:flex-row items-center justify-center space-y-4 sm:space-y-0 sm:space-x-6"
>
{isAuthenticated && user ? (
<Link
href="/dashboard"
className="group px-8 py-4 bg-brand-turquoise text-white rounded-lg hover:bg-brand-turquoise/90 transition-all hover:shadow-2xl hover:scale-105 font-semibold text-lg w-full sm:w-auto flex items-center justify-center space-x-2"
>
<span>Accéder au Dashboard</span>
<LayoutDashboard className="w-5 h-5 group-hover:translate-x-1 transition-transform" />
</Link>
) : (
<>
<Link
href="/register"
className="group px-8 py-4 bg-brand-turquoise text-white rounded-lg hover:bg-brand-turquoise/90 transition-all hover:shadow-2xl hover:scale-105 font-semibold text-lg w-full sm:w-auto flex items-center justify-center space-x-2"
@ -716,6 +783,8 @@ export default function LandingPage() {
>
Se connecter
</Link>
</>
)}
</motion.div>
<motion.div
@ -779,7 +848,7 @@ export default function LandingPage() {
{/* Products */}
<div>
<h4 className="font-bold text-lg mb-4">Produits</h4>
<h4 className="font-bold text-lg mb-4 text-white">Produits</h4>
<ul className="space-y-3 text-white/70 text-sm">
<li>
<Link href="#features" className="hover:text-brand-turquoise transition-colors">
@ -814,7 +883,7 @@ export default function LandingPage() {
{/* Company */}
<div>
<h4 className="font-bold text-lg mb-4">Entreprise</h4>
<h4 className="font-bold text-lg mb-4 text-white">Entreprise</h4>
<ul className="space-y-3 text-white/70 text-sm">
<li>
<Link href="/about" className="hover:text-brand-turquoise transition-colors">
@ -846,7 +915,7 @@ export default function LandingPage() {
{/* Legal */}
<div>
<h4 className="font-bold text-lg mb-4">Légal</h4>
<h4 className="font-bold text-lg mb-4 text-white">Légal</h4>
<ul className="space-y-3 text-white/70 text-sm">
<li>
<Link href="/privacy" className="hover:text-brand-turquoise transition-colors">