feat: Add padding to chat container and focus on input on mount
Add a padding to the top of the chat container to prevent the first message from being hidden behind the input field. Also, focus on the input field when the chat panel mounts for better user experience.
This commit is contained in:
parent
5bcd1fa42f
commit
3d34a364bc
@ -104,6 +104,10 @@ const chatPanel = () => {
|
||||
const scrollToBottom = () =>
|
||||
scrollViewport?.current?.scrollTo({ top: scrollViewport.current.scrollHeight, behavior: 'smooth' });
|
||||
|
||||
useEffect(() => {
|
||||
inputRef.current.focus();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (generating) {
|
||||
// new a bot message
|
||||
@ -250,11 +254,12 @@ const chatPanel = () => {
|
||||
ref={chatContainerRef}
|
||||
sx={{
|
||||
height: '100%',
|
||||
paddingTop: 10,
|
||||
backgroundColor: theme.colors.gray[0],
|
||||
}}
|
||||
onClick={handleContainerClick}>
|
||||
<ScrollArea
|
||||
h={height - px('4rem')}
|
||||
h={height - px('5rem')}
|
||||
type="never"
|
||||
viewportRef={scrollViewport}>
|
||||
{messageList.length > 0 ? messageList : defaultMessages}
|
||||
|
Loading…
x
Reference in New Issue
Block a user