Skip to content

Commit d15d663

Browse files
committed
fix: attachment icon cropped for first message
1 parent 5b4eb45 commit d15d663

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

src/components/chat/ChatMessage.tsx

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,9 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
5050
`;
5151

5252
return (
53-
<div
54-
className={`flex ${isUser ? "justify-end" : "justify-start"} mb-2 relative`}
55-
>
53+
<>
5654
{message.attachments && message.attachments.length > 0 && (
57-
<div className="flex absolute -top-4 right-0 gap-1 items-center">
55+
<div className="flex gap-1 items-center !-mb-2 ml-auto w-fit">
5856
<span className="text-neutral-500 text-xs">Attached</span>
5957
<div className="flex gap-1 items-center">
6058
{message.attachments.map((attachment) => {
@@ -68,34 +66,36 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
6866
</div>
6967
</div>
7068
)}
71-
<div className={bubbleClasses}>
72-
<div className={markdownProseClasses}>
73-
<ReactMarkdown remarkPlugins={[remarkGfm]}>
74-
{message.content as string}
75-
</ReactMarkdown>
76-
{isStreaming && !isUser && (
77-
<span className="inline-block w-2 h-4 bg-gray-400 animate-pulse ml-1 align-text-bottom" />
69+
<div className={`flex ${isUser ? "justify-end" : "justify-start"} mb-2`}>
70+
<div className={bubbleClasses}>
71+
<div className={markdownProseClasses}>
72+
<ReactMarkdown remarkPlugins={[remarkGfm]}>
73+
{message.content as string}
74+
</ReactMarkdown>
75+
{isStreaming && !isUser && (
76+
<span className="inline-block w-2 h-4 bg-gray-400 animate-pulse ml-1 align-text-bottom" />
77+
)}
78+
</div>
79+
80+
{!isUser && (
81+
<div className="flex mt-2 space-x-2">
82+
<button
83+
onClick={() => copyToClipboard(message.content as string)}
84+
className="p-1 text-neutral-500 hover:text-neutral-700"
85+
title={isCopied ? "Copied!" : "Copy to clipboard"}
86+
>
87+
<Image
88+
src={isCopied ? "/img/tick_icon.svg" : "/img/copy-icon.png"}
89+
width={12}
90+
height={12}
91+
alt={isCopied ? "copied" : "copy-icon"}
92+
/>
93+
</button>
94+
</div>
7895
)}
7996
</div>
80-
81-
{!isUser && (
82-
<div className="flex mt-2 space-x-2">
83-
<button
84-
onClick={() => copyToClipboard(message.content as string)}
85-
className="p-1 text-neutral-500 hover:text-neutral-700"
86-
title={isCopied ? "Copied!" : "Copy to clipboard"}
87-
>
88-
<Image
89-
src={isCopied ? "/img/tick_icon.svg" : "/img/copy-icon.png"}
90-
width={12}
91-
height={12}
92-
alt={isCopied ? "copied" : "copy-icon"}
93-
/>
94-
</button>
95-
</div>
96-
)}
9797
</div>
98-
</div>
98+
</>
9999
);
100100
};
101101

0 commit comments

Comments
 (0)