Skip to content

Commit 8ccdf44

Browse files
committed
Added no chat text
1 parent 7ee94c7 commit 8ccdf44

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

LocalMind-Backend/src/chats/ChatList.jsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useEffect, useRef } from 'react';
22
import ChatMessage from './ChatMessage';
33
import TypingIndicator from './TypingIndicator';
44

5-
export default function ChatList({ messages = [], isTyping = false }) {
5+
export default function ChatList({ messages = [], isTyping = false, onStartNewChat }) {
66
const containerRef = useRef(null);
77

88
useEffect(() => {
@@ -12,6 +12,25 @@ export default function ChatList({ messages = [], isTyping = false }) {
1212
container.scrollTo({ top: container.scrollHeight, behavior: 'smooth' });
1313
}, [messages, isTyping]);
1414

15+
// Show empty state when no messages exist
16+
if (messages.length === 0) {
17+
return (
18+
<main className="flex-1 flex flex-col items-center justify-center px-4 py-6">
19+
<div className="text-center max-w-xs">
20+
<p className="text-gray-500 mb-4">No chats yet. Start a new conversation!</p>
21+
{onStartNewChat && (
22+
<button
23+
onClick={onStartNewChat}
24+
className="px-4 py-2 bg-blue-500 text-white rounded-md hover:bg-blue-600 transition-colors"
25+
>
26+
New Chat
27+
</button>
28+
)}
29+
</div>
30+
</main>
31+
);
32+
}
33+
1534
return (
1635
<main ref={containerRef} className="flex-1 overflow-y-auto px-4 py-6 space-y-4 scroll-smooth">
1736
<div className="flex flex-col gap-4">

0 commit comments

Comments
 (0)