From c154329f565eca15362817d70e1a6f7e1294430c Mon Sep 17 00:00:00 2001 From: andrewbell-ai Date: Tue, 24 Mar 2026 13:14:32 -0700 Subject: [PATCH] dark mode --- src/App.jsx | 43 ++++++++++++++++--- src/features/lists/components/ListAddTask.jsx | 8 ++-- src/features/lists/components/TaskBoard.jsx | 28 ++++++------ .../lists/components/TaskListConfig.jsx | 24 +++++------ src/features/tags/components/TagManager.jsx | 22 +++++----- .../tasks/components/GlobalTaskForm.jsx | 16 +++---- src/features/tasks/components/TaskItem.jsx | 16 +++---- src/features/tasks/components/TaskList.jsx | 4 +- src/index.css | 6 +++ 9 files changed, 102 insertions(+), 65 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 8c97719..45f0912 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,6 +1,6 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; -import { PlusIcon } from '@heroicons/react/24/outline'; +import { PlusIcon, MoonIcon, SunIcon } from '@heroicons/react/24/outline'; import { TaskProvider } from './context/TaskContext'; import { TagProvider } from './context/TagContext'; @@ -11,23 +11,54 @@ import TaskBoard from './features/lists/components/TaskBoard'; function App() { const [showInput, setShowInput] = useState(false); + const [isDarkMode, setIsDarkMode] = useState(() => { + if (typeof window === 'undefined') { + return false; + } + + const storedTheme = window.localStorage.getItem('task-dashboard.theme'); + if (storedTheme) { + return storedTheme === 'dark'; + } + + return window.matchMedia('(prefers-color-scheme: dark)').matches; + }); + + useEffect(() => { + if (typeof document !== 'undefined') { + document.documentElement.classList.toggle('dark', isDarkMode); + } + + if (typeof window !== 'undefined') { + window.localStorage.setItem('task-dashboard.theme', isDarkMode ? 'dark' : 'light'); + } + }, [isDarkMode]); return ( -
+
-

Task Dashboard

- {/* Stats will be displayed from TaskContext */} +

Task Dashboard

+
diff --git a/src/features/lists/components/ListAddTask.jsx b/src/features/lists/components/ListAddTask.jsx index 03d8cb2..eb34d2c 100644 --- a/src/features/lists/components/ListAddTask.jsx +++ b/src/features/lists/components/ListAddTask.jsx @@ -48,7 +48,7 @@ function ListAddTask({ onCancel, listFilters }) { placeholder="Add a task to this list..." value={text} onChange={(e) => setText(e.target.value)} - className="w-full py-2 px-4 pr-20 text-sm text-neutral-800 rounded-lg border border-neutral-200 focus:border-primary-400 focus:ring-1 focus:ring-primary-200 outline-hidden transition-all" + className="w-full py-2 px-4 pr-20 text-sm text-neutral-800 dark:text-neutral-100 dark:bg-neutral-800 rounded-lg border border-neutral-200 dark:border-neutral-700 focus:border-primary-400 focus:ring-1 focus:ring-primary-200 outline-hidden transition-all" autoComplete="off" data-testid="list-task-input" /> @@ -56,7 +56,7 @@ function ListAddTask({ onCancel, listFilters }) { @@ -81,7 +81,7 @@ function ListAddTask({ onCancel, listFilters }) { {/* Show tags that will be automatically applied */} {getTagFilters().length > 0 && (
-

+

Will be tagged with: {getTagFilters().join(', ')} @@ -93,4 +93,4 @@ function ListAddTask({ onCancel, listFilters }) { ); } -export default ListAddTask; \ No newline at end of file +export default ListAddTask; diff --git a/src/features/lists/components/TaskBoard.jsx b/src/features/lists/components/TaskBoard.jsx index abebd8f..00d9708 100644 --- a/src/features/lists/components/TaskBoard.jsx +++ b/src/features/lists/components/TaskBoard.jsx @@ -74,10 +74,10 @@ function TaskBoard() { return (

-

Task Lists

+

Task Lists