|
|
@@ -1,4 +1,3 @@
|
|
|
-import { Card, CardBody } from "@nextui-org/react";
|
|
|
import React, { useEffect, useRef } from "react";
|
|
|
import { IoMdChatbubbles } from "react-icons/io";
|
|
|
import { useSelector } from "react-redux";
|
|
|
@@ -38,25 +37,29 @@ function TypingChat() {
|
|
|
});
|
|
|
|
|
|
return (
|
|
|
- <Card className="bg-neutral-500">
|
|
|
- <CardBody>{messageContent}</CardBody>
|
|
|
- </Card>
|
|
|
+ <div className="flex max-w-[90%]">
|
|
|
+ <div className="flex mb-0 min-w-0">
|
|
|
+ <div className="bg-neutral-500 rounded-lg">
|
|
|
+ <div className="p-3">{messageContent}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
);
|
|
|
}
|
|
|
|
|
|
function ChatBubble({ msg }: IChatBubbleProps): JSX.Element {
|
|
|
return (
|
|
|
<div
|
|
|
- className={`flex mb-2.5 pr-5 pl-5 max-w-[90%] ${msg?.sender === "user" ? "self-end" : ""}`}
|
|
|
+ className={`flex max-w-[90%] ${msg?.sender === "user" ? "self-end" : ""}`}
|
|
|
>
|
|
|
<div
|
|
|
- className={`flex mt-2.5 mb-0 min-w-0 ${msg?.sender === "user" && "flex-row-reverse ml-auto"}`}
|
|
|
+ className={`flex mb-0 min-w-0 ${msg?.sender === "user" && "flex-row-reverse ml-auto"}`}
|
|
|
>
|
|
|
- <Card
|
|
|
- className={`${msg?.sender === "user" ? "bg-neutral-700" : "bg-neutral-500"}`}
|
|
|
+ <div
|
|
|
+ className={`${msg?.sender === "user" ? "bg-neutral-700" : "bg-neutral-500"} rounded-lg`}
|
|
|
>
|
|
|
- <CardBody>{msg?.content}</CardBody>
|
|
|
- </Card>
|
|
|
+ <div className="p-3">{msg?.content}</div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
);
|
|
|
@@ -95,19 +98,15 @@ function MessageList(): JSX.Element {
|
|
|
}, [typeThis]);
|
|
|
|
|
|
return (
|
|
|
- <div className="flex-1 overflow-y-auto flex flex-col">
|
|
|
- {newChatSequence.map((msg, index) => (
|
|
|
- <ChatBubble key={index} msg={msg} />
|
|
|
- ))}
|
|
|
-
|
|
|
- {typingActive && (
|
|
|
- <div className="flex mb-2.5 pr-5 pl-5 max-w-[90%]">
|
|
|
- <div className="flex mt-2.5 mb-0 min-w-0 ">
|
|
|
- <TypingChat />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- )}
|
|
|
- <div ref={messagesEndRef} />
|
|
|
+ <div className="flex-1 flex flex-col gap-3 pt-3 px-3 relative min-h-0">
|
|
|
+ <div className="overflow-y-auto flex flex-col h-full gap-3">
|
|
|
+ {newChatSequence.map((msg, index) => (
|
|
|
+ <ChatBubble key={index} msg={msg} />
|
|
|
+ ))}
|
|
|
+ {typingActive && <TypingChat />}
|
|
|
+ <div ref={messagesEndRef} />
|
|
|
+ </div>
|
|
|
+ <div className="absolute bottom-0 left-0 right-0 h-4 bg-gradient-to-b from-transparent to-neutral-800" />
|
|
|
</div>
|
|
|
);
|
|
|
}
|