Skip to content

Commit 2a7105b

Browse files
authored
Merge pull request #24 from LAKSHYA9941/main
Error Fix and Profile
2 parents 6f07c8e + 574d2e3 commit 2a7105b

File tree

12 files changed

+200
-187
lines changed

12 files changed

+200
-187
lines changed

webapp_front/package-lock.json

Lines changed: 24 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webapp_front/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"react-icons": "^5.5.0",
2222
"react-router": "^7.2.0",
2323
"react-router-dom": "^7.2.0",
24+
"swiper": "^11.2.10",
2425
"tailwind-merge": "^3.0.2",
2526
"zustand": "^5.0.3"
2627
},
@@ -38,6 +39,6 @@
3839
"tailwindcss": "^4.0.17",
3940
"typescript": "~5.7.2",
4041
"typescript-eslint": "^8.24.1",
41-
"vite": "^6.3.3"
42+
"vite": "^6.3.5"
4243
}
4344
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { useAuthDataStore } from "../_stores/user_auth_data";
2+
3+
const Profile = () => {
4+
const user = useAuthDataStore((state) => state.signInData?.user);
5+
6+
if (!user) return null;
7+
8+
// Extract initials
9+
const initials = user.displayName
10+
?.split(" ")
11+
.map((n) => n[0])
12+
.join("")
13+
.toUpperCase();
14+
15+
return (
16+
<div className="flex items-center gap-3 bg-white px-4 py-2 rounded-xl shadow-sm">
17+
<div className="w-10 h-10 bg-accent text-secondary font-bold rounded-full flex items-center justify-center text-sm">
18+
{initials}
19+
</div>
20+
<span className="text-md font-bold text-primary">{user.displayName}</span>
21+
</div>
22+
);
23+
};
24+
25+
export default Profile;

webapp_front/src/_components/goodbye.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const Goodbye = () => {
22
return (
3-
<div className="min-h-screen flex flex-col justify-center items-center text-center text-6xl font-bold text-primary pb-[10%]">
3+
<div className="min-h-screen flex flex-col justify-center items-center text-center text-4xl font-bold text-primary pb-[10%]">
44
👋 Thanks for checking out!
55
<p className="text-3xl mt-4">See you next time!</p>
66
</div>

webapp_front/src/_components/home.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const Home = ({
102102
))}
103103

104104
{/* Hero text */}
105-
<em className="text-3xl text-primary text-center z-10 home-page-text" >
105+
<em className="text-3xl text-primary text-center z-10 home-page-text font-bold" >
106106
{
107107
punchLines[Math.floor(punchLines.length*Math.random())]
108108
}

webapp_front/src/_components/navbar.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { twMerge } from "tailwind-merge";
33
import { signOut } from "firebase/auth";
44
import { Menu as MenuIcon, Globe, Gamepad, QrCode, LogOut } from "lucide-react"; //User
55
import { useState, useRef, useEffect } from "react";
6+
import Profile from "../_components/Profile";
67

78
import { auth } from "../_libs/firebase";
89

@@ -40,7 +41,7 @@ const Navbar = () => {
4041
const items = [
4142
// { id: "profile", icon: User, to: "/socialize/profile", color: 'text-primary' },
4243
{ id: "explore", icon: Globe, to: "/socialize/explore", color: 'text-primary' },
43-
{ id: "games", icon: Gamepad, to: "/socialize/games", color: 'text-primary' },
44+
{ id: "games", icon: Gamepad, to: "/socialize/games", color: 'text-primary' },
4445
{
4546
id: "qr",
4647
icon: QrCode,
@@ -53,7 +54,7 @@ const Navbar = () => {
5354
];
5455

5556
return (
56-
<nav className="relative flex justify-between items-center w-full h-[10%] p-3 px-6 max-w-[1440px] mx-auto text-primary">
57+
<nav className="relative flex justify-between items-center w-full h-[10%] p-3 px-6 mx-auto text-primary shadow-md bg-white/80 z-50">
5758
<h1 className={twMerge("navs", "text-3xl")}>
5859
<Link to="/" className="flex items-center">
5960
{/* <img src={ChaiLogo} className="w-[3%]" /> */}
@@ -77,7 +78,10 @@ const Navbar = () => {
7778
</Link>
7879
</section>
7980
) : (
80-
<div className="relative" ref={menuRef}>
81+
<div className="flex items-center gap-4" ref={menuRef}>
82+
{/* Profile */}
83+
{signInData && <Profile />}
84+
8185
{/* Hamburger */}
8286
<button
8387
onClick={() => setMenuOpen((o) => !o)}
@@ -88,7 +92,7 @@ const Navbar = () => {
8892
</button>
8993

9094
{/* Icon‐only menu */}
91-
<div className="absolute flex flex-col items-center space-y-6 translate-x-half left-1/2 top-[270%] z-10">
95+
<div className="absolute right-0 top-full m-3 p-2 flex flex-col items-end space-y-3 z-10">
9296
{items.map((item, idx) => {
9397
const Icon = item.icon;
9498
const delayMs = idx * 80;

webapp_front/src/_components/socializing/auth.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { useState } from "react";
22
import { useNavigate } from "react-router-dom";
3-
43
import { signInWithGoogle, storeEmailOnly } from "../../_libs/firebase";
4+
import { useAuthDataStore } from "../../_stores/user_auth_data";
55

66

77
const Auth = () => {
88
// Setup navigation (to move to different pages like /home)
99
const navigate = useNavigate();
10-
10+
const useAuthStore = useAuthDataStore();
11+
1112

1213
// State variables
1314

@@ -43,10 +44,9 @@ const Auth = () => {
4344

4445
if (success) {
4546
console.log("✅ Email saved:", email);
47+
useAuthStore.setSignInData({ email }); // Set pseudo-auth state for email-only users
4648
setFormSubmitted(true); // Trigger form animation
47-
setTimeout(() => {
48-
navigate("explore"); // Navigate after short delay for animation
49-
}, 500); // 0.5 second delay
49+
navigate("explore"); //navigating to /socialize/explore
5050
} else {
5151
console.error("❌ Failed to save email");
5252
}
@@ -56,7 +56,7 @@ const Auth = () => {
5656
<div className="flex flex-col items-center h-screen gap-6 text-3xl py-[20vh]">
5757

5858
{/* Heading Text */}
59-
<p className="text-3xl text-primary">
59+
<p className="text-3xl text-primary text-center px-2">
6060
Share and explore moments over a cup of chai. ☕
6161
</p>
6262

0 commit comments

Comments
 (0)