fix: sroll down button overlaping chat input (#564)

This commit is contained in:
Aldo Santiago 2023-04-18 08:28:19 -06:00 committed by GitHub
parent 51fa461965
commit 00f6189a42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 11 deletions

View File

@ -1,4 +1,4 @@
import { IconArrowDown, IconClearAll, IconSettings } from '@tabler/icons-react'; import { IconClearAll, IconSettings } from '@tabler/icons-react';
import { import {
MutableRefObject, MutableRefObject,
memo, memo,
@ -492,24 +492,16 @@ export const Chat = memo(({ stopConversationRef }: Props) => {
setCurrentMessage(message); setCurrentMessage(message);
handleSend(message, 0, plugin); handleSend(message, 0, plugin);
}} }}
onScrollDownClick={handleScrollDown}
onRegenerate={() => { onRegenerate={() => {
if (currentMessage) { if (currentMessage) {
handleSend(currentMessage, 2, null); handleSend(currentMessage, 2, null);
} }
}} }}
showScrollDownButton={showScrollDownButton}
/> />
</> </>
)} )}
{showScrollDownButton && (
<div className="absolute bottom-0 right-0 mb-4 mr-4 pb-20">
<button
className="flex h-7 w-7 items-center justify-center rounded-full bg-neutral-300 text-gray-800 shadow-md hover:shadow-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-neutral-200"
onClick={handleScrollDown}
>
<IconArrowDown size={18} />
</button>
</div>
)}
</div> </div>
); );
}); });

View File

@ -1,4 +1,5 @@
import { import {
IconArrowDown,
IconBolt, IconBolt,
IconBrandGoogle, IconBrandGoogle,
IconPlayerStop, IconPlayerStop,
@ -30,15 +31,19 @@ import { VariableModal } from './VariableModal';
interface Props { interface Props {
onSend: (message: Message, plugin: Plugin | null) => void; onSend: (message: Message, plugin: Plugin | null) => void;
onRegenerate: () => void; onRegenerate: () => void;
onScrollDownClick: () => void;
stopConversationRef: MutableRefObject<boolean>; stopConversationRef: MutableRefObject<boolean>;
textareaRef: MutableRefObject<HTMLTextAreaElement | null>; textareaRef: MutableRefObject<HTMLTextAreaElement | null>;
showScrollDownButton: boolean;
} }
export const ChatInput = ({ export const ChatInput = ({
onSend, onSend,
onRegenerate, onRegenerate,
onScrollDownClick,
stopConversationRef, stopConversationRef,
textareaRef, textareaRef,
showScrollDownButton
}: Props) => { }: Props) => {
const { t } = useTranslation('chat'); const { t } = useTranslation('chat');
@ -341,6 +346,17 @@ export const ChatInput = ({
)} )}
</button> </button>
{showScrollDownButton && (
<div className="absolute bottom-12 right-0 lg:bottom-0 lg:-right-10">
<button
className="flex h-7 w-7 items-center justify-center rounded-full bg-neutral-300 text-gray-800 shadow-md hover:shadow-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-neutral-200"
onClick={onScrollDownClick}
>
<IconArrowDown size={18} />
</button>
</div>
)}
{showPromptList && filteredPrompts.length > 0 && ( {showPromptList && filteredPrompts.length > 0 && (
<div className="absolute bottom-12 w-full"> <div className="absolute bottom-12 w-full">
<PromptList <PromptList