Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added public/leader11.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
161 changes: 161 additions & 0 deletions public/leaderimage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions public/stage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/Components/Chat.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

.window_div_outer {
width: 100%;
background-image: url("https://i.pinimg.com/originals/a7/99/61/a79961637e3d670135579a9138176fcf.gif");
/* background-image: url("https://i.pinimg.com/originals/a7/99/61/a79961637e3d670135579a9138176fcf.gif"); */
}

.chat_window {
Expand Down Expand Up @@ -110,7 +110,7 @@
}

.no_chat_outer {
background-image: url("https://i.pinimg.com/originals/a7/99/61/a79961637e3d670135579a9138176fcf.gif");
/* background-image: url("https://i.pinimg.com/originals/a7/99/61/a79961637e3d670135579a9138176fcf.gif"); */
}

.no_chat_inner {
Expand Down
4 changes: 2 additions & 2 deletions src/Components/ChatWindow.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
object-fit: cover;
background-repeat: no-repeat;
/* background: linear-gradient(270deg, #010720, #1b0639, #2f0644); */
background-image: url("https://i.pinimg.com/originals/70/eb/0b/70eb0b53eb57c91db403928c5d02a19a.gif");
/* background-image: url("https://i.pinimg.com/originals/70/eb/0b/70eb0b53eb57c91db403928c5d02a19a.gif"); */
}

.chat_head_inner {
Expand All @@ -112,7 +112,7 @@
.chat_outer {
position: relative;
display: flex;
background-image: url("https://i.pinimg.com/originals/a7/99/61/a79961637e3d670135579a9138176fcf.gif");
/* background-image: url("https://i.pinimg.com/originals/a7/99/61/a79961637e3d670135579a9138176fcf.gif"); */
}

.chat_inner {
Expand Down
167 changes: 34 additions & 133 deletions src/Components/Feed.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,73 +20,10 @@ const Feed = () => {
const [quote, setQuote] = useState("");
const [topStreaks, setTopStreaks] = useState([]);
const userId = localStorage.getItem("userId");
const cardRef = useRef(null);
const card_top_ref = useRef(null);

useEffect(() => {
const card = cardRef.current;

const handleMouseMove = (e) => {
const { width, height, left, top } = card.getBoundingClientRect();
const x = e.clientX - left;
const y = e.clientY - top;

const rotateX = (y / height - 0.5) * 20;
const rotateY = (x / width - 0.5) * -20;

card.style.transform = `perspective(1000px) rotateX(${rotateX}deg) rotateY(${rotateY}deg)`;
};

const handleMouseLeave = () => {
card.style.transform = "perspective(1000px) rotateX(0) rotateY(0)";
};

if (card) {
card.addEventListener("mousemove", handleMouseMove);
card.addEventListener("mouseleave", handleMouseLeave);
}

return () => {
if (card) {
card.removeEventListener("mousemove", handleMouseMove);
card.removeEventListener("mouseleave", handleMouseLeave);
}
};
}, []);

useEffect(() => {
const card_top = card_top_ref.current;
const handleMouseMove = (e) => {
const { width, height, left, top } = card_top.getBoundingClientRect();
const x = e.clientX - left;
const y = e.clientY - top;

const rotateX = (y / height - 0.5) * 20;
const rotateY = (x / width - 0.5) * -20;

card_top.style.transform = `perspective(1000px) rotateX(${rotateX}deg) rotateY(${rotateY}deg)`;
};

const handleMouseLeave = () => {
card_top.style.transform = "perspective(1000px) rotateX(0) rotateY(0)";
};

if (card_top) {
card_top.addEventListener("mousemove", handleMouseMove);
card_top.addEventListener("mouseleave", handleMouseLeave);
}

// return () => {
// if (card_top) {
// card_top.removeEventListener("mousemove", handleMouseMove);
// card_top.removeEventListener("mouseleave", handleMouseLeave);
// }
// };
}, []);

const fetchUsername = async (userId) => {
try {
const userRef = ref(realDb, `users/${userId}`);
const userRef = ref(realDb, 'users/${userId}');
const snapshot = await get(userRef);
if (snapshot.exists()) {
const userData = snapshot.val();
Expand Down Expand Up @@ -143,8 +80,7 @@ const Feed = () => {
}))
.sort(
(a, b) =>
Object.keys(b.likes || {}).length -
Object.keys(a.likes || {}).length
Object.keys(b.likes || {}).length - Object.keys(a.likes || {}).length
)
: [];
setPosts(postsArray);
Expand All @@ -154,103 +90,68 @@ const Feed = () => {
}, [userId]);

return (
<div className={styles.feed_outer}>
<Navbar></Navbar>
<div className="min-h-screen" style={{ marginLeft: "250px" }}>
<div className="min-h-screen bg-gray-50 flex" >
<Navbar />
{/* Main content */}
<div className="flex-grow bg-white" style={{marginLeft:"250px"}}>
{/* Quote Header */}
<div className={`text-white ${styles.quote_outer}`}>
<div className={`max-w-6xl py-4 mx-auto px-4 ${styles.quote_inner}`}>
<p className="text-xl italic font-semibold font-light text-center">
{quote}
</p>
<div className="bg-gradient-to-r from-blue-600 to-blue-800 text-white py-6">
<div className="max-w-6xl mx-auto px-4">
<p className="text-xl italic font-light text-center">{quote}</p>
</div>
</div>

{/* Main Content */}
<div className={`max-w-6xl mx-auto px-12 py-8 ${styles.feed_inner}`}>
<div className="max-w-6xl mx-auto px-4 py-8">
{userId && username ? (
<div className="flex gap-8">
{/* Left Column - Posts */}
<div className={`flex-grow max-w-3xl`}>
<div>
<h2 className="text-2xl font-bold mb-6 text-gray-800"></h2>
<PostList
posts={posts}
user={{ uid: userId, displayName: username }}
/>
</div>
<div className="flex-grow max-w-3xl">
<h2 className="text-2xl font-bold mb-6 text-gray-800"></h2>
<PostList posts={posts} user={{ uid: userId, displayName: username }} />
</div>

{/* Right Column - Add Post & Streaks */}
<div className="w-80 space-y-6">
{/* Add Post Section */}
<div
ref={cardRef}
className={`bg-white rounded-xl shadow-sm ${styles.post_form_outer}`}
>
<div className={`${styles.post_form_inner} rounded-xl`}>
<AddPost />
</div>
<div className="bg-white rounded-xl shadow-sm p-4">
<h3 className="text-lg font-semibold mb-4 text-gray-800">Share Thoughts</h3>
<AddPost />
</div>

{/* Top Streaks Section */}
<div
ref={card_top_ref}
className={`${styles.top_streak_outer}`}
>
<div className={styles.top_streak_inner}>
<h3 className="text-3xl font-semibold mb-4 ml-2 text-white inline-flex items-center">
Top Streaks{" "}
<img
src="fire.svg"
className="h-8 w-8 ml-2"
alt="fire icon"
/>
</h3>

<div className="space-y-3">
{topStreaks.map((user, index) => (
<div
key={index}
className={`flex items-center justify-between p-2 hover:bg-gray-50 rounded-lg ${styles.top_li}`}
>
<div className="flex items-center space-x-3">
<div className={styles.flip_card}>
{user.username.charAt(0).toUpperCase()}
</div>
<span className="font-medium text-gray-400">
{user.username}
</span>
</div>
<div className="flex items-center space-x-1">
<span className="text-white font-semibold">
{user.streak}
</span>
<span className="text-orange-500">
<img
src="fire2.svg"
className="h-5 w-5 ml-1"
></img>
</span>
<div className="bg-white rounded-xl shadow-sm p-4">
<h3 className="text-lg font-semibold mb-4 text-gray-800">Top Streaks 🔥</h3>
<div className="space-y-3">
{topStreaks.map((user, index) => (
<div key={index} className="flex items-center justify-between p-2 hover:bg-gray-50 rounded-lg">
<div className="flex items-center space-x-3">
<div className="w-8 h-8 bg-gradient-to-r from-blue-500 to-blue-600 rounded-full flex items-center justify-center text-white font-medium">
{user.username.charAt(0).toUpperCase()}
</div>
<span className="font-medium text-gray-700">{user.username}</span>
</div>
<div className="flex items-center space-x-1">
<span className="text-orange-500 font-semibold">{user.streak}</span>
<span className="text-orange-500">🔥</span>
</div>
))}
</div>
</div>
))}
</div>
</div>
</div>
</div>
) : (
<div className={`text-center py-56 ${styles.feed_inner_load}`}>
<div className="text-center py-12">
<div className="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-blue-500 mx-auto"></div>
<p className="text-gray-600 mt-4">Loading your feed...</p>
</div>
)}
</div>
<Footer />
</div>
<Footer></Footer>
</div>
);
};

export default Feed;
export default Feed;
6 changes: 3 additions & 3 deletions src/Components/Feed.module.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.flip_card {
/* .flip_card {
width: 2rem;
height: 2rem;
background: linear-gradient(
Expand Down Expand Up @@ -73,9 +73,9 @@

.top_li:hover {
/* background: linear-gradient(#340274,#6600ff,#9aa2ff); */
background-color: rgba(229, 202, 255, 0.1);
/* background-color: rgba(229, 202, 255, 0.1);
}

.feed_inner_load {
height: 100vw;
}
} */
12 changes: 6 additions & 6 deletions src/Components/LeaderBoard.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ const LeaderBoard = () => {
<div>
<Navbar />
<div className="container mx-auto p-8" style={{ paddingLeft: "280px" }}>
<h1 className="text-3xl font-bold text-center mb-10 mt-10">
<h1 className="text-5xl font-bold text-center mb-10 mt-10">
LeaderBoard
</h1>

{/* Logged-in User's Rank */}
{loggedInUserRank ? (
<div className="bg-white shadow-lg rounded-lg p-4 mb-6">
<h2 className="text-xl font-bold mb-2">
<div className="bg-white shadow-lg rounded-lg p-6 mb-6">
<h2 className="text-2xl font-bold mb-2">
Your Rank: {loggedInUserRank.rank}
</h2>
<div className="flex items-center gap-4">
Expand All @@ -115,13 +115,13 @@ const LeaderBoard = () => {
className="w-12 h-12 rounded-full object-cover"
/>
<div>
<p className="text-gray-600 text-sm font-semibold mb-1">
<p className="text-gray-600 text-xl font-semibold mb-1">
Username: {loggedInUserRank.username}
</p>
<p className="text-gray-600 text-sm font-semibold mb-1">
<p className="text-gray-600 text-xl font-semibold mb-1">
Tasks Completed: {loggedInUserRank.completedTasks}
</p>
<p className="text-gray-600 text-sm font-semibold mb-1">
<p className="text-gray-600 text-xl font-semibold mb-1">
Score: {loggedInUserRank.score}
</p>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/Components/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import styles from "./Navbar.module.css";
const Navbar = () => {
return (
<div className={styles.navbar_outer}>

<div className={styles.navbar}>
<nav>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Navbar.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
background-color: rgba(31, 7, 60, 0.751);
backdrop-filter: blur(100px);
/* background-image: url("https://i.pinimg.com/originals/37/d8/fd/37d8fd385021566890f0df2e253a0901.gif"); */
box-shadow: 0 5px 10px black;
/* box-shadow: 0 5px 10px black; */
transform: scale(1.05);
}

Expand Down
Loading