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
43 changes: 43 additions & 0 deletions backend/node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions frontend/src/Componets/ThemeToggle.css
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,23 @@
border-color: #1e90ff;
box-shadow: 0 0 5px #1e90ff;
}
/* ===============================
Global Light/Dark Background
=============================== */

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Centralizes background and text color transitions to avoid duplication and keep theme switching smooth and consistent

/* Light mode (default) */
.light body,
.light .Home {
background-color: #ffffff !important;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid excessive !important usage to prevent future styling conflicts and allow component-level text color overrides

color: #000000 !important;
transition: background-color 0.4s ease, color 0.4s ease;
}

/* Dark mode */
.dark body,
.dark .Home {
background-color: #0d0d0d !important; /* or #121212 for a softer dark */
color: #f0f0f0 !important;
transition: background-color 0.4s ease, color 0.4s ease;
}

21 changes: 11 additions & 10 deletions frontend/src/Pages/Home/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,21 @@ export const Home = () => {
const token = localStorage.getItem("token");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensures API request is made only when a valid token exists, preventing unnecessary or unauthorized backend calls

if (token) {
axios.get(`${import.meta.env.VITE_API_URL}/users/me`, {
headers: { Authorization: `Bearer ${token}` },
})
.then(res => {
setUser(res.data.user);
localStorage.setItem("user", JSON.stringify(res.data.user)); // ✅ Keep in sync
})
.catch(err => console.error("Error fetching user:", err));
axios
.get(`${import.meta.env.VITE_API_URL}/users/me`, {
headers: { Authorization: `Bearer ${token}` },
})
.then((res) => {
setUser(res.data.user);
localStorage.setItem("user", JSON.stringify(res.data.user)); // ✅ Keep in sync
})
.catch((err) => console.error("Error fetching user:", err));
}
}, []);

return (
<div>
<div id="top"></div> {/* Add this line */}
<div className="Home">
<div id="top"></div>
<Header />

{/* ✅ Show user info if logged in */}
Expand Down