Merge pull request 'main' (#38) from React-Group/interstellar_ai:main into main

Reviewed-on: https://interstellardevelopment.org/code/code/YasinOnm08/interstellar_ai/pulls/38
This commit is contained in:
YasinOnm08 2024-10-01 11:58:20 +02:00
commit e6ce45b9c4

View file

@ -16,17 +16,17 @@ interface ConversationProps {
const ConversationFrontend = React.forwardRef<HTMLDivElement, ConversationProps>( const ConversationFrontend = React.forwardRef<HTMLDivElement, ConversationProps>(
({ messages, onResendClick, onEditClick, onCopyClick, isClicked }, ref: ForwardedRef<HTMLDivElement>) => { ({ messages, onResendClick, onEditClick, onCopyClick, isClicked }, ref: ForwardedRef<HTMLDivElement>) => {
const messagesEndRef = useRef<HTMLDivElement|null>(null) const messagesEndRef = useRef<HTMLDivElement | null>(null)
useEffect(() => { useEffect(() => {
messagesEndRef.current?.scrollIntoView() messagesEndRef.current?.scrollIntoView()
},[messages]) }, [messages])
return ( return (
<div className="output" ref={ref}> <div className="output" ref={ref}>
<div className="conversation resize" id="conversation"> <div className="conversation resize" id="conversation">
{messages.map((message, index) => { {messages.map((message, index) => {
if (index >= 1){ if (index >= 1) {
return ( return (
<div <div
@ -49,11 +49,11 @@ const ConversationFrontend = React.forwardRef<HTMLDivElement, ConversationProps>
<button type="button" onClick={onCopyClick}> <button type="button" onClick={onCopyClick}>
<img src="/img/copy.svg" alt="copy" /> <img src="/img/copy.svg" alt="copy" />
</button> </button>
<p id="copiedText" style={{opacity:isClicked?"1":"0", transition:"all 0.3s ease-in-out"}}>Copied!</p> <p id="copiedText" style={{ opacity: isClicked ? "1" : "0", transition: "all 0.3s ease-in-out" }}>Copied!</p>
</div>
</div> </div>
<div ref={messagesEndRef} /> <div ref={messagesEndRef} />
</div> </div>
</div>
); );
} }
); );