From f9062e4baa37c098c0a559a29ccc14518bd5b69b Mon Sep 17 00:00:00 2001 From: faizaanjum7 Date: Sun, 17 May 2026 19:18:03 +0530 Subject: [PATCH 1/4] feat: implement dark mode across application --- frontend/src/App.jsx | 2 +- .../components/Dashboard/DashboardTasks.jsx | 12 +++---- .../src/components/Dashboard/TaskPreview.jsx | 12 +++---- frontend/src/components/EmptyState.jsx | 3 +- frontend/src/components/Navbar.jsx | 32 ++++++----------- .../src/components/Routine/TaskLibrary.jsx | 12 +++---- .../src/components/Task/TaskFormModal.jsx | 8 ++--- frontend/src/components/Task/TaskItem.jsx | 10 +++--- frontend/src/components/ThemeToggle.jsx | 36 +++++++++++++++++++ frontend/src/context/ThemeContext.jsx | 10 ++++++ frontend/src/index.css | 12 ++++++- frontend/src/pages/Dashboard.jsx | 6 ++-- frontend/src/pages/Login.jsx | 12 +++++-- frontend/src/pages/RoutineBuilder.jsx | 4 +-- frontend/src/pages/Signup.jsx | 15 ++++++-- frontend/src/pages/Tasks.jsx | 8 ++--- 16 files changed, 129 insertions(+), 65 deletions(-) create mode 100644 frontend/src/components/ThemeToggle.jsx diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 460483e3..6e844d71 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -16,7 +16,7 @@ const App = () => { return ( -
+
} /> } /> diff --git a/frontend/src/components/Dashboard/DashboardTasks.jsx b/frontend/src/components/Dashboard/DashboardTasks.jsx index 3b285701..ba859860 100644 --- a/frontend/src/components/Dashboard/DashboardTasks.jsx +++ b/frontend/src/components/Dashboard/DashboardTasks.jsx @@ -42,7 +42,7 @@ export default function DashboardTasks({ tasks, updateTask }) { diff --git a/frontend/src/components/EmptyState.jsx b/frontend/src/components/EmptyState.jsx index 947512cb..fc0a94df 100644 --- a/frontend/src/components/EmptyState.jsx +++ b/frontend/src/components/EmptyState.jsx @@ -39,6 +39,7 @@ const CONFIG = { export default function EmptyState({ type = "tasks", onAction }) { const [hovered, setHovered] = useState(false); const cfg = CONFIG[type] ?? CONFIG.tasks; + const isDark = document.documentElement.classList.contains("dark"); return (
@@ -60,4 +61,4 @@ export default function EmptyState({ type = "tasks", onAction }) {
); -} \ No newline at end of file +} diff --git a/frontend/src/components/Navbar.jsx b/frontend/src/components/Navbar.jsx index 859cba8e..8ef31f09 100644 --- a/frontend/src/components/Navbar.jsx +++ b/frontend/src/components/Navbar.jsx @@ -2,11 +2,12 @@ import { useState, useContext, useEffect } from "react"; import { Link, NavLink, useLocation } from "react-router-dom"; // eslint-disable-next-line no-unused-vars import { motion, AnimatePresence } from "framer-motion"; -import { Menu, X, LayoutDashboard, CheckSquare, Calendar, LogOut, LogIn, UserPlus, Sun, Moon } from "lucide-react"; +import { Menu, X, LayoutDashboard, CheckSquare, Calendar, LogOut, LogIn, UserPlus } from "lucide-react"; import { AuthContext } from "../context/AuthContext"; import { ThemeContext } from "../context/ThemeContext"; import { clsx } from "clsx"; import { twMerge } from "tailwind-merge"; +import ThemeToggle from "./ThemeToggle"; // Utility for merging tailwind classes safely function cn(...inputs) { @@ -91,7 +92,7 @@ const Navbar = () => { "px-4 py-2 rounded-xl text-sm font-medium transition-all duration-200 flex items-center gap-2", isActive ? "bg-[#d0f6e3] text-[#3b8ea0] shadow-sm" - : "text-[#4eb7b3] hover:bg-[#d0f6e3]/50 hover:text-[#3b8ea0]" + : "text-[#4eb7b3] hover:bg-[#d0f6e3]/50 hover:text-[#3b8ea0] dark:text-gray-300 dark:hover:bg-gray-800" ) } > @@ -104,26 +105,12 @@ const Navbar = () => { {/* Desktop Auth Buttons */}
- {/* Premium Dark Mode Toggle */} - - {theme === "dark" ? ( - - ) : ( - - )} - - + {!token ? ( <> Login @@ -147,9 +134,10 @@ const Navbar = () => { {/* Mobile Menu Toggle Button */}
+