Skip to content

Commit e0daa0d

Browse files
committed
fix(web): image-only bubbles have equal padding
A single image no longer leaves an empty grid column, and the last block in a bubble drops its bottom margin.
1 parent 9005f64 commit e0daa0d

1 file changed

Lines changed: 23 additions & 12 deletions

File tree

‎apps/web/src/components/chat/TimelineUserMessageRow.tsx‎

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,16 @@ function UserTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "message"
486486
)}
487487
>
488488
{(regularImages.length > 0 || userVideos.length > 0) && (
489-
<div className="mb-2 grid max-w-[210px] grid-cols-2 gap-2">
489+
<div
490+
className={cn(
491+
"mb-2 grid gap-2 last:mb-0",
492+
// One tile keeps its size without leaving an empty second column in the bubble.
493+
regularImages.length + userVideos.length === 1 &&
494+
regularImages[0]?.source?.kind !== "snap-shot"
495+
? "w-[101px] grid-cols-1"
496+
: "max-w-[210px] grid-cols-2",
497+
)}
498+
>
490499
{regularImages.map((image) => (
491500
<div
492501
key={image.id}
@@ -534,7 +543,7 @@ function UserTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "message"
534543
</div>
535544
)}
536545
{userAudio.length > 0 ? (
537-
<div className="mb-2 flex max-w-full flex-col gap-1">
546+
<div className="mb-2 flex max-w-full flex-col gap-1 last:mb-0">
538547
{userAudio.map((file) => (
539548
<InlineAudioPreview
540549
key={file.id}
@@ -553,7 +562,7 @@ function UserTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "message"
553562
</div>
554563
) : null}
555564
{unchippedFiles.length > 0 || unknownAttachments.length > 0 ? (
556-
<div className="mb-2 flex flex-col gap-1">
565+
<div className="mb-2 flex flex-col gap-1 last:mb-0">
557566
{unchippedFiles.map((file) => {
558567
const fileIdentity = (
559568
<>
@@ -614,15 +623,17 @@ function UserTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "message"
614623
))}
615624
</div>
616625
) : null}
617-
<div onCopyCapture={onBodyCopyCapture}>
618-
<CollapsibleUserMessageBody
619-
text={resolvedContext.text}
620-
renderContextReference={renderContextReference}
621-
skills={ctx.skills}
622-
markdownCwd={ctx.markdownCwd}
623-
collapsible={!folded}
624-
/>
625-
</div>
626+
{resolvedContext.text.trim().length > 0 ? (
627+
<div onCopyCapture={onBodyCopyCapture}>
628+
<CollapsibleUserMessageBody
629+
text={resolvedContext.text}
630+
renderContextReference={renderContextReference}
631+
skills={ctx.skills}
632+
markdownCwd={ctx.markdownCwd}
633+
collapsible={!folded}
634+
/>
635+
</div>
636+
) : null}
626637
</div>
627638
) : null}
628639
</div>

0 commit comments

Comments
 (0)