diff --git a/apps/frontend/app/page.tsx b/apps/frontend/app/page.tsx index 9c0444e..fcf910f 100644 --- a/apps/frontend/app/page.tsx +++ b/apps/frontend/app/page.tsx @@ -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,18 +246,42 @@ export default function LandingPage() { > Tarifs - - Connexion - - - Commencer Gratuitement - + + {/* Affichage conditionnel: connecté vs non connecté */} + {loading ? ( +
+ ) : isAuthenticated && user ? ( + + {/* Avatar avec initiales */} +
+ {getUserInitials()} +
+ {/* Nom de l'utilisateur */} + + {getFullName()} + + {/* Icône dashboard */} + + + ) : ( + <> + + Connexion + + + Commencer Gratuitement + + + )}
@@ -310,19 +355,31 @@ 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" > - - Créer un compte gratuit - - - - Voir la démo - + {isAuthenticated && user ? ( + + Accéder au Dashboard + + + ) : ( + <> + + Créer un compte gratuit + + + + Voir la démo + + + )} @@ -703,19 +760,31 @@ 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" > - - Créer un compte gratuit - - - - Se connecter - + {isAuthenticated && user ? ( + + Accéder au Dashboard + + + ) : ( + <> + + Créer un compte gratuit + + + + Se connecter + + + )} -

Produits

+

Produits

  • @@ -814,7 +883,7 @@ export default function LandingPage() { {/* Company */}
    -

    Entreprise

    +

    Entreprise

    • @@ -846,7 +915,7 @@ export default function LandingPage() { {/* Legal */}
      -

      Légal

      +

      Légal