From e6701bd4a1b153188da16c8206832b54a6cad30f Mon Sep 17 00:00:00 2001 From: Ramzi Abidi Date: Sun, 5 Jul 2026 16:09:08 +0100 Subject: [PATCH] feat: implement dark mode support and theme toggle functionality - Added dark mode configuration in Tailwind CSS. - Introduced useTheme hook for managing theme state and toggling between light and dark modes. - Updated App component to integrate theme management. - Enhanced various components to support dark mode styling, ensuring consistent UI across light and dark themes. --- client/src/App.tsx | 6 +++- client/src/components/chat/ChatArea.tsx | 28 +++++++++++++---- client/src/components/chat/ChatInput.tsx | 10 ++++--- client/src/components/chat/ChatList.tsx | 29 +++++++++++------- client/src/components/chat/MessageBubble.tsx | 11 ++++--- client/src/components/chat/MessageList.tsx | 8 ++--- .../src/components/documents/DocumentList.tsx | 20 +++++++------ client/src/components/layout/MobileDrawer.tsx | 8 ++--- .../modals/DocumentPreviewModal.tsx | 20 ++++++++----- client/src/components/modals/UploadModal.tsx | 21 ++++++++----- client/src/components/ui/toast.tsx | 25 ++++++++-------- client/src/hooks/useTheme.ts | 30 +++++++++++++++++++ client/tailwind.config.js | 1 + 13 files changed, 146 insertions(+), 71 deletions(-) create mode 100644 client/src/hooks/useTheme.ts diff --git a/client/src/App.tsx b/client/src/App.tsx index a5d1d23..133fde7 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -3,6 +3,7 @@ import { ask, uploadDocs, listDocs, deleteDoc, Document, SessionMetadata } from import { Toaster } from '@/components/ui/toast'; import { useToast } from '@/hooks/useToast'; import { useSession, Message } from './hooks/useSession'; +import { useTheme } from './hooks/useTheme'; import { DocumentList } from './components/documents/DocumentList'; import { ChatArea } from './components/chat/ChatArea'; import { ChatList } from './components/chat/ChatList'; @@ -22,6 +23,7 @@ export default function App() { const [previewDocument, setPreviewDocument] = useState(null); const [mobilePanel, setMobilePanel] = useState(null); const { toasts, toast, dismiss } = useToast(); + const { theme, toggleTheme } = useTheme(); const closePreview = useCallback(() => setPreviewDocument(null), []); const closeMobilePanel = useCallback(() => setMobilePanel(null), []); @@ -120,7 +122,7 @@ export default function App() { }; return ( -
+
setMobilePanel('docs')} onOpenChats={() => setMobilePanel('chats')} + theme={theme} + onToggleTheme={toggleTheme} /> void; onOpenDocs?: () => void; onOpenChats?: () => void; + theme: 'light' | 'dark'; + onToggleTheme: () => void; } export function ChatArea({ @@ -25,39 +27,53 @@ export function ChatArea({ onNewChat, onOpenDocs, onOpenChats, + theme, + onToggleTheme, }: ChatAreaProps) { return (
-
+
{onOpenDocs ? ( ) : null} -

RTFM For Me

+

+ RTFM For Me +

{onOpenChats ? ( ) : null} + +