forked from React-Group/interstellar_ai
fixed scrol
This commit is contained in:
parent
ee6f699a8a
commit
40eddcd195
1 changed files with 7 additions and 7 deletions
|
@ -16,17 +16,17 @@ interface ConversationProps {
|
|||
const ConversationFrontend = React.forwardRef<HTMLDivElement, ConversationProps>(
|
||||
({ messages, onResendClick, onEditClick, onCopyClick, isClicked }, ref: ForwardedRef<HTMLDivElement>) => {
|
||||
|
||||
const messagesEndRef = useRef<HTMLDivElement|null>(null)
|
||||
const messagesEndRef = useRef<HTMLDivElement | null>(null)
|
||||
|
||||
useEffect(() => {
|
||||
messagesEndRef.current?.scrollIntoView()
|
||||
},[messages])
|
||||
}, [messages])
|
||||
|
||||
return (
|
||||
<div className="output" ref={ref}>
|
||||
<div className="conversation resize" id="conversation">
|
||||
{messages.map((message, index) => {
|
||||
if (index >= 1){
|
||||
if (index >= 1) {
|
||||
|
||||
return (
|
||||
<div
|
||||
|
@ -49,11 +49,11 @@ const ConversationFrontend = React.forwardRef<HTMLDivElement, ConversationProps>
|
|||
<button type="button" onClick={onCopyClick}>
|
||||
<img src="/img/copy.svg" alt="copy" />
|
||||
</button>
|
||||
<p id="copiedText" style={{opacity:isClicked?"1":"0", transition:"all 0.3s ease-in-out"}}>Copied!</p>
|
||||
</div>
|
||||
<p id="copiedText" style={{ opacity: isClicked ? "1" : "0", transition: "all 0.3s ease-in-out" }}>Copied!</p>
|
||||
</div>
|
||||
<div ref={messagesEndRef} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue