118118 < a class ="nav-link " href ="/myaccount/jobsforyou "> Jobs for you</ a >
119119 </ li >
120120 < li class ="nav-item ">
121- < a class ="nav-link " href ="/myaccount/ "> My account</ a >
121+ < a class ="nav-link " id =" myaccount-2 " href ="/myaccount/ "> My account</ a >
122122 </ li >
123123 < li class ="nav-item login-btn ">
124124 < a class ="nav-link " id ="login-button " href ="/login "> Login</ a >
175175 font-size: 1.1rem;
176176 margin-bottom: 8px;
177177 "
178- > < a class ="nav-link " href ="/myaccount/ "> My Account</ a > </ span >
178+ > < a class ="nav-link " id =" myaccount-1 " href ="/myaccount/ "> My Account</ a > </ span >
179179 </ span >
180180</ div >
181181
@@ -457,16 +457,25 @@ <h5 class="modal-title" id="exampleModalLabel">
457457 const welcomeText = document . getElementById ( "welcome-text" ) ;
458458 const userMail = document . getElementById ( "user-mail" ) ;
459459
460+
461+
460462 if ( user ) {
461463 // Save email to localStorage
462464 localStorage . setItem ( "email" , user . email ) ;
465+ const userProfileRef = doc ( db , "user_profile" , user . email ) ;
466+ const docSnap = await getDoc ( userProfileRef ) ;
467+ let name = "" ;
468+ if ( docSnap . exists ( ) ) {
469+ name = docSnap . data ( ) . about . firstname + " " + docSnap . data ( ) . about . lastname || "" ;
470+ }
463471
464472 // Hide the signup button and show "Logout"
465473 document . getElementById ( "login-button" ) . innerHTML = "Logout" ;
466474 signupButton . style . display = "none" ;
467475
468476 // Retrieve the display name (username)
469- let username = user . displayName ; // For Google Sign-In or if saved during registration
477+ let username = user . displayName ;
478+ // console.log(username) // For Google Sign-In or if saved during registration
470479
471480 // If username is not available in displayName, fetch it from Firestore
472481 if ( ! username ) {
@@ -486,7 +495,10 @@ <h5 class="modal-title" id="exampleModalLabel">
486495 localStorage . setItem ( "username" , username ) ;
487496
488497 // Update welcome text with the username
489- if ( username )
498+ if ( name ) {
499+ welcomeText . innerHTML = `Hii, ${ name } ` ;
500+ }
501+ else if ( username )
490502 welcomeText . innerHTML = `Hii, ${ username } ` ;
491503 else {
492504 userMail . innerHTML = username ; // Optionally update email
0 commit comments