From 2a62320a44d958f28b7379321f5fdfbb7c578e9f Mon Sep 17 00:00:00 2001 From: Jaswanth Kumar Date: Thu, 9 Jul 2026 08:47:41 +0530 Subject: [PATCH 1/2] Modified Routing Option in Index Page --- src/common/components/Footer/Footer.tsx | 2 +- src/common/components/Header/Header.tsx | 32 +++++++++++++++++++++---- src/pages/index.tsx | 21 ++++++++++++++-- tailwind.config.js | 1 + 4 files changed, 49 insertions(+), 7 deletions(-) diff --git a/src/common/components/Footer/Footer.tsx b/src/common/components/Footer/Footer.tsx index 30a6f10..ac19edd 100644 --- a/src/common/components/Footer/Footer.tsx +++ b/src/common/components/Footer/Footer.tsx @@ -30,7 +30,7 @@ export default function Footer() { - + diff --git a/src/common/components/Header/Header.tsx b/src/common/components/Header/Header.tsx index f992fd1..e657b4c 100644 --- a/src/common/components/Header/Header.tsx +++ b/src/common/components/Header/Header.tsx @@ -4,8 +4,24 @@ import Image from "next/image"; import * as ROUTES from "../../../constants/routes"; import NotificationBell from "../NotificationBell/NotificationBell"; import styles from "./Header.module.css"; +import { useState,useEffect } from "react"; export default function Header() { + + const [userDetails , setUserdetails] = useState(null); + + useEffect(() => { + try{ + const data = localStorage.getItem("authUser"); + + if(data){ + setUserdetails(JSON.parse(data)); + }; + }catch (e){ + console.log(e); + } + },[]) + return ( <>
@@ -31,10 +47,18 @@ export default function Header() {
-
    -
  • Signup
  • -
  • Login
  • -
+ {(userDetails)? + ( +
    +
  • Dashboard : {userDetails.displayName}
  • +
+ ) : + (
    +
  • Login
  • +
  • Signup
  • +
+ ) + }
diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 826eded..1b9beb2 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -14,6 +14,8 @@ import dynamic from "next/dynamic"; import Loading from "../common/components/Loading/Loading"; import Link from "next/link"; +import { useState,useEffect } from "react"; + const DynamicHeader = dynamic(() => import("../common/components/Header/Header"), { loading: () => }); @@ -23,6 +25,21 @@ const DynamicFooter = dynamic(() => import("../common/components/Footer/Footer") }); export default function Home() { + + const [userDetail, setUserDetail] = useState(null); + + useEffect(() => { + try { + const data = localStorage.getItem("authUser"); + + if (data) { + setUserDetail(JSON.parse(data)); + } + } catch (e) { + console.log(e); + } + }, []); + return (
@@ -45,14 +62,14 @@ export default function Home() {

{/* Explore Button*/} - + {/* Dashboard Button*/} - + )}
@@ -451,7 +451,7 @@ export default function Profile({ userId }: ProfileProps) {