From c1cfc05a9eed327e069b12733a3cc7f69a3c2f05 Mon Sep 17 00:00:00 2001 From: Felipe Cardoso Date: Wed, 5 Mar 2025 11:04:43 +0100 Subject: [PATCH] Add dynamic homepage with authentication and feature sections Replaced static placeholder homepage with a dynamic one that includes authentication checks. Redirects authenticated users to the dashboard and shows a redesigned landing page with hero, features, and footer sections for unauthenticated users. Enhances user experience and aligns with product goals. --- frontend/src/app/page.tsx | 204 ++++++++++++++++++++------------------ 1 file changed, 108 insertions(+), 96 deletions(-) diff --git a/frontend/src/app/page.tsx b/frontend/src/app/page.tsx index 585fdf4..7fcd156 100644 --- a/frontend/src/app/page.tsx +++ b/frontend/src/app/page.tsx @@ -1,101 +1,113 @@ -import Image from "next/image"; +// src/app/page.tsx +"use client"; -export default function Home() { - return ( -
-
- Next.js logo -
    -
  1. - Get started by editing{" "} - - src/app/page.tsx - - . -
  2. -
  3. Save and see your changes instantly.
  4. -
+import { useAuth } from "@/context/auth-context"; +import { useRouter } from "next/navigation"; +import { useEffect } from "react"; +import Link from "next/link"; +import Navbar from "@/components/layout/navbar"; -
- - Vercel logomark - Deploy now! - - - Read our docs - +export default function HomePage() { + const { isAuthenticated, isLoading } = useAuth(); + const router = useRouter(); + + // Redirect authenticated users to dashboard + useEffect(() => { + if (!isLoading && isAuthenticated) { + router.push("/dashboard"); + } + }, [isLoading, isAuthenticated, router]); + + // Show loading state while checking authentication + if (isLoading) { + return ( +
+
+
+

Loading...

-
- -
+ + ); + } + + // If not authenticated, show landing page + return ( + <> + +
+ {/* Hero Section */} +
+
+

+ Beautiful Digital Invitations for Special Moments +

+

+ Create stunning event pages, manage RSVPs, and share the joy with + family and friends +

+
+ + Sign In + + + Enter Invitation Code + +
+
+
+ + {/* Features Section */} +
+
+

+ Everything You Need for Your Celebrations +

+
+
+

+ Beautiful Invitations +

+

+ Create stunning digital invitations that match your event's + theme. +

+
+
+

+ Simple RSVP Management +

+

+ Track guest responses with our easy-to-use RSVP system. +

+
+
+

+ Gift Registry +

+

+ Let guests know what you'd love to receive with our gift + registry feature. +

+
+
+
+
+ + {/* Footer */} + +
+ ); }