Skip to content

Commit

Permalink
Improve message display with better overflow han
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] authored Sep 5, 2024
1 parent 354565a commit c183306
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions sweep_chat/components/MessageDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,28 +61,30 @@ const UserMessageDisplay = ({
)}
 
<div
className="bg-zinc-800 transition-color text-sm p-3 rounded-xl mb-4 inline-block max-w-[80%] hover:bg-zinc-700 hover:cursor-pointer text-left"
className="bg-zinc-800 transition-color text-sm p-3 rounded-xl mb-4 inline-block max-w-[80%] hover:bg-zinc-700 hover:cursor-pointer text-left max-h-[600px] overflow-y-auto"
onClick={handleClick}
>
<div className={`text-sm text-white`}>
{isEditing ? (
<Textarea
className="w-full mb-4 bg-transparent text-white max-w-[800px] w-[800px] hover:bg-initial"
className="w-full mb-4 bg-transparent text-white max-w-[800px] w-[800px] hover:bg-initial max-h-[500px] overflow-y-auto"
ref={textareaRef}
value={editedContent}
onChange={(e) => {
setEditedContent(e.target.value)
e.target.style.height = 'auto'
e.target.style.height = `${e.target.scrollHeight}px`
e.target.style.height = `${Math.min(e.target.scrollHeight, 500)}px`
}}
style={{ height: (editedContent.split('\n').length + 1) * 16 }}
style={{ height: Math.min((editedContent.split('\n').length + 1) * 16, 500) }}
autoFocus
/>
) : (
<MarkdownRenderer
content={message.content.trim()}
className="userMessage"
/>
<div className="max-h-[500px] overflow-y-auto">
<MarkdownRenderer
content={message.content.trim()}
className="userMessage"
/>
</div>
)}
</div>
{isEditing && (
Expand Down

0 comments on commit c183306

Please sign in to comment.