Skip to content

Commit 823c24a

Browse files
committed
Move user message metadata outside the chat bubble
Split the user message container so the gray bubble wraps only the message content. Render the timestamp and action buttons below the bubble on the white background to remove the large gray gap under short messages.
1 parent 13eeb07 commit 823c24a

1 file changed

Lines changed: 46 additions & 44 deletions

File tree

apps/web/src/components/ChatView.tsx

Lines changed: 46 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5416,50 +5416,52 @@ const MessagesTimeline = memo(function MessagesTimeline({
54165416
const canRevertAgentWork = revertTurnCountByUserMessageId.has(row.message.id);
54175417
return (
54185418
<div className="flex justify-end">
5419-
<div className="group relative max-w-[80%] rounded-2xl rounded-br-sm border border-border bg-secondary px-4 py-3">
5420-
{userImages.length > 0 && (
5421-
<div className="mb-2 grid max-w-[420px] grid-cols-2 gap-2">
5422-
{userImages.map(
5423-
(image: NonNullable<TimelineMessage["attachments"]>[number]) => (
5424-
<div
5425-
key={image.id}
5426-
className="overflow-hidden rounded-lg border border-border/80 bg-background/70"
5427-
>
5428-
{image.previewUrl ? (
5429-
<button
5430-
type="button"
5431-
className="h-full w-full cursor-zoom-in"
5432-
aria-label={`Preview ${image.name}`}
5433-
onClick={() => {
5434-
const preview = buildExpandedImagePreview(userImages, image.id);
5435-
if (!preview) return;
5436-
onImageExpand(preview);
5437-
}}
5438-
>
5439-
<img
5440-
src={image.previewUrl}
5441-
alt={image.name}
5442-
className="h-full max-h-[220px] w-full object-cover"
5443-
onLoad={onTimelineImageLoad}
5444-
onError={onTimelineImageLoad}
5445-
/>
5446-
</button>
5447-
) : (
5448-
<div className="flex min-h-[72px] items-center justify-center px-2 py-3 text-center text-[11px] text-muted-foreground/70">
5449-
{image.name}
5450-
</div>
5451-
)}
5452-
</div>
5453-
),
5454-
)}
5455-
</div>
5456-
)}
5457-
{row.message.text && (
5458-
<pre className="whitespace-pre-wrap wrap-break-word font-mono text-sm leading-relaxed text-foreground">
5459-
{row.message.text}
5460-
</pre>
5461-
)}
5462-
<div className="mt-1.5 flex items-center justify-end gap-2">
5419+
<div className="group flex max-w-[80%] flex-col items-end">
5420+
<div className="w-fit max-w-full rounded-2xl rounded-br-sm border border-border bg-secondary px-4 py-3">
5421+
{userImages.length > 0 && (
5422+
<div className="mb-2 grid max-w-[420px] grid-cols-2 gap-2">
5423+
{userImages.map(
5424+
(image: NonNullable<TimelineMessage["attachments"]>[number]) => (
5425+
<div
5426+
key={image.id}
5427+
className="overflow-hidden rounded-lg border border-border/80 bg-background/70"
5428+
>
5429+
{image.previewUrl ? (
5430+
<button
5431+
type="button"
5432+
className="h-full w-full cursor-zoom-in"
5433+
aria-label={`Preview ${image.name}`}
5434+
onClick={() => {
5435+
const preview = buildExpandedImagePreview(userImages, image.id);
5436+
if (!preview) return;
5437+
onImageExpand(preview);
5438+
}}
5439+
>
5440+
<img
5441+
src={image.previewUrl}
5442+
alt={image.name}
5443+
className="h-full max-h-[220px] w-full object-cover"
5444+
onLoad={onTimelineImageLoad}
5445+
onError={onTimelineImageLoad}
5446+
/>
5447+
</button>
5448+
) : (
5449+
<div className="flex min-h-[72px] items-center justify-center px-2 py-3 text-center text-[11px] text-muted-foreground/70">
5450+
{image.name}
5451+
</div>
5452+
)}
5453+
</div>
5454+
),
5455+
)}
5456+
</div>
5457+
)}
5458+
{row.message.text && (
5459+
<pre className="whitespace-pre-wrap wrap-break-word font-mono text-sm leading-relaxed text-foreground">
5460+
{row.message.text}
5461+
</pre>
5462+
)}
5463+
</div>
5464+
<div className="mt-1.5 flex items-center justify-end gap-2 pr-1">
54635465
<div className="flex items-center gap-1.5 opacity-0 transition-opacity duration-200 focus-within:opacity-100 group-hover:opacity-100">
54645466
{row.message.text && <MessageCopyButton text={row.message.text} />}
54655467
{canRevertAgentWork && (

0 commit comments

Comments
 (0)