fix
This commit is contained in:
parent
d9868dd49f
commit
0d814e9a94
@ -21,10 +21,31 @@ import {
|
|||||||
Anchor,
|
Anchor,
|
||||||
Container,
|
Container,
|
||||||
FileText,
|
FileText,
|
||||||
|
LayoutDashboard,
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
|
import { useAuth } from '@/lib/context/auth-context';
|
||||||
|
|
||||||
export default function LandingPage() {
|
export default function LandingPage() {
|
||||||
const [isScrolled, setIsScrolled] = useState(false);
|
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 heroRef = useRef(null);
|
||||||
const featuresRef = useRef(null);
|
const featuresRef = useRef(null);
|
||||||
const statsRef = useRef(null);
|
const statsRef = useRef(null);
|
||||||
@ -225,6 +246,28 @@ export default function LandingPage() {
|
|||||||
>
|
>
|
||||||
Tarifs
|
Tarifs
|
||||||
</Link>
|
</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
|
<Link
|
||||||
href="/login"
|
href="/login"
|
||||||
className="text-white hover:text-brand-turquoise transition-colors font-medium"
|
className="text-white hover:text-brand-turquoise transition-colors font-medium"
|
||||||
@ -237,6 +280,8 @@ export default function LandingPage() {
|
|||||||
>
|
>
|
||||||
Commencer Gratuitement
|
Commencer Gratuitement
|
||||||
</Link>
|
</Link>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -310,6 +355,16 @@ export default function LandingPage() {
|
|||||||
transition={{ duration: 0.8, delay: 0.5 }}
|
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"
|
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
|
<Link
|
||||||
href="/register"
|
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"
|
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
|
Voir la démo
|
||||||
</Link>
|
</Link>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</motion.div>
|
</motion.div>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
</div>
|
</div>
|
||||||
@ -703,6 +760,16 @@ export default function LandingPage() {
|
|||||||
variants={itemVariants}
|
variants={itemVariants}
|
||||||
className="flex flex-col sm:flex-row items-center justify-center space-y-4 sm:space-y-0 sm:space-x-6"
|
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
|
<Link
|
||||||
href="/register"
|
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"
|
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
|
Se connecter
|
||||||
</Link>
|
</Link>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</motion.div>
|
</motion.div>
|
||||||
|
|
||||||
<motion.div
|
<motion.div
|
||||||
@ -779,7 +848,7 @@ export default function LandingPage() {
|
|||||||
|
|
||||||
{/* Products */}
|
{/* Products */}
|
||||||
<div>
|
<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">
|
<ul className="space-y-3 text-white/70 text-sm">
|
||||||
<li>
|
<li>
|
||||||
<Link href="#features" className="hover:text-brand-turquoise transition-colors">
|
<Link href="#features" className="hover:text-brand-turquoise transition-colors">
|
||||||
@ -814,7 +883,7 @@ export default function LandingPage() {
|
|||||||
|
|
||||||
{/* Company */}
|
{/* Company */}
|
||||||
<div>
|
<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">
|
<ul className="space-y-3 text-white/70 text-sm">
|
||||||
<li>
|
<li>
|
||||||
<Link href="/about" className="hover:text-brand-turquoise transition-colors">
|
<Link href="/about" className="hover:text-brand-turquoise transition-colors">
|
||||||
@ -846,7 +915,7 @@ export default function LandingPage() {
|
|||||||
|
|
||||||
{/* Legal */}
|
{/* Legal */}
|
||||||
<div>
|
<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">
|
<ul className="space-y-3 text-white/70 text-sm">
|
||||||
<li>
|
<li>
|
||||||
<Link href="/privacy" className="hover:text-brand-turquoise transition-colors">
|
<Link href="/privacy" className="hover:text-brand-turquoise transition-colors">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user