fix: website crash when typing / followed with non prompt name (#262)

* fix: froward slash crash

* added the rounded corners when editing folder/chat
This commit is contained in:
Syed Muzamil 2023-03-28 19:30:07 +05:30 committed by GitHub
parent cd49445491
commit a70ae8799d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 30 deletions

View File

@ -107,11 +107,13 @@ export const ChatInput: FC<Props> = ({
const handleInitModal = () => { const handleInitModal = () => {
const selectedPrompt = filteredPrompts[activePromptIndex]; const selectedPrompt = filteredPrompts[activePromptIndex];
if (selectedPrompt) {
setContent((prevContent) => { setContent((prevContent) => {
const newContent = prevContent?.replace(/\/\w*$/, selectedPrompt.content); const newContent = prevContent?.replace(/\/\w*$/, selectedPrompt.content);
return newContent; return newContent;
}); });
handlePromptSelect(selectedPrompt); handlePromptSelect(selectedPrompt);
}
setShowPromptList(false); setShowPromptList(false);
}; };
@ -209,8 +211,7 @@ export const ChatInput: FC<Props> = ({
if (textareaRef && textareaRef.current) { if (textareaRef && textareaRef.current) {
textareaRef.current.style.height = 'inherit'; textareaRef.current.style.height = 'inherit';
textareaRef.current.style.height = `${textareaRef.current?.scrollHeight}px`; textareaRef.current.style.height = `${textareaRef.current?.scrollHeight}px`;
textareaRef.current.style.overflow = `${ textareaRef.current.style.overflow = `${textareaRef?.current?.scrollHeight > 400 ? 'auto' : 'hidden'
textareaRef?.current?.scrollHeight > 400 ? 'auto' : 'hidden'
}`; }`;
} }
}, [content]); }, [content]);
@ -261,8 +262,7 @@ export const ChatInput: FC<Props> = ({
resize: 'none', resize: 'none',
bottom: `${textareaRef?.current?.scrollHeight}px`, bottom: `${textareaRef?.current?.scrollHeight}px`,
maxHeight: '400px', maxHeight: '400px',
overflow: `${ overflow: `${textareaRef.current && textareaRef.current.scrollHeight > 400
textareaRef.current && textareaRef.current.scrollHeight > 400
? 'auto' ? 'auto'
: 'hidden' : 'hidden'
}`, }`,

View File

@ -68,7 +68,7 @@ export const ConversationComponent: FC<Props> = ({
return ( return (
<div className="relative flex items-center"> <div className="relative flex items-center">
{isRenaming && selectedConversation.id === conversation.id ? ( {isRenaming && selectedConversation.id === conversation.id ? (
<div className="flex w-full items-center gap-3 bg-[#343541]/90 p-3"> <div className="flex w-full items-center gap-3 bg-[#343541]/90 p-3 rounded-lg">
<IconMessage size={18} /> <IconMessage size={18} />
<input <input
className="mr-12 flex-1 overflow-hidden overflow-ellipsis border-neutral-400 bg-transparent text-left text-[12.5px] leading-3 text-white outline-none focus:border-neutral-100" className="mr-12 flex-1 overflow-hidden overflow-ellipsis border-neutral-400 bg-transparent text-left text-[12.5px] leading-3 text-white outline-none focus:border-neutral-100"

View File

@ -103,7 +103,7 @@ export const ChatFolder: FC<Props> = ({
<> <>
<div className="relative flex items-center"> <div className="relative flex items-center">
{isRenaming ? ( {isRenaming ? (
<div className="flex w-full items-center gap-3 bg-[#343541]/90 p-3"> <div className="flex w-full items-center gap-3 bg-[#343541]/90 p-3 rounded-lg">
{isOpen ? ( {isOpen ? (
<IconCaretDown size={18} /> <IconCaretDown size={18} />
) : ( ) : (