feat(chat): created basic chat layout

This commit is contained in:
JK-le-dev 2025-10-18 15:22:13 -05:00
commit 8ba67f1080
10 changed files with 154 additions and 26 deletions

View file

@ -0,0 +1,34 @@
import React, { useState } from "react";
import ChatHeader from "./ChatHeader";
import ChatWindow from "./ChatWindow";
import MessageInput from "./MessageInput";
export default function ChatLayout() {
const [messages, setMessages] = useState([
{
role: "assistant",
content: "Hello — I can help you with code, explanations, and more.",
},
]);
function handleSend(text) {
const userMsg = { role: "user", content: text };
setMessages((s) => [...s, userMsg]);
// fake assistant reply after short delay
setTimeout(() => {
setMessages((s) => [
...s,
{ role: "assistant", content: `You said: ${text}` },
]);
}, 600);
}
return (
<div className="flex flex-col h-[80vh] w-full max-w-3xl mx-auto rounded-lg overflow-hidden shadow-lg border border-slate-700">
<ChatHeader />
<ChatWindow messages={messages} />
<MessageInput onSend={handleSend} />
</div>
);
}