@@ -81,6 +81,10 @@ import {
8181import { UserMessageContextReferenceChip } from "./UserMessageContextChips" ;
8282import { resolvePreviewAnnotationImage } from "./TimelineUserMessageRow.logic" ;
8383
84+ // Drawn inside the media so dark screenshots keep an edge on the dark background.
85+ const MEDIA_EDGE_CLASS_NAME =
86+ "relative after:pointer-events-none after:absolute after:inset-0 after:z-10 after:rounded-[inherit] after:ring-1 after:ring-inset after:ring-black/9 dark:after:ring-white/12" ;
87+
8488const BUBBLE_CHIP_CLASS_NAME =
8589 "[&_[data-slot=context-chip]]:[--context-chip-ink:var(--context-chip-message,var(--context-chip-accent))]" ;
8690
@@ -353,6 +357,12 @@ function UserTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "message"
353357 userVideos . length === 0 &&
354358 regularImages . length === 1 &&
355359 regularImages [ 0 ] ! . source ?. kind !== "snap-shot" ;
360+ // Several images sent without words share one rounded shape, split by hairlines.
361+ const collage =
362+ mediaOnly &&
363+ userVideos . length === 0 &&
364+ regularImages . length > 1 &&
365+ regularImages . every ( ( image ) => image . source ?. kind !== "snap-shot" ) ;
356366 const annotationRecordIds = resolvedContext . records
357367 . filter ( ( record ) => record . kind === "preview-annotation" )
358368 . map ( ( record ) => record . contextId ) ;
@@ -519,25 +529,43 @@ function UserTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "message"
519529 { ( regularImages . length > 0 || userVideos . length > 0 ) && (
520530 < div
521531 className = { cn (
522- "grid gap-2 " ,
532+ "grid" ,
523533 ! mediaOnly
524- ? "mb-2 max-w-[210px] grid-cols-2"
534+ ? "mb-2 max-w-[210px] grid-cols-2 gap-2 "
525535 : loneImage
526536 ? "max-w-full"
527- : "w-80 max-w-full grid-cols-2" ,
537+ : collage
538+ ? cn (
539+ MEDIA_EDGE_CLASS_NAME ,
540+ "w-80 max-w-full gap-px overflow-hidden rounded-2xl bg-black/9 dark:bg-white/12" ,
541+ regularImages . length === 2
542+ ? "auto-rows-[12rem] grid-cols-2"
543+ : regularImages . length === 3
544+ ? "auto-rows-[calc(6rem-0.5px)] grid-cols-[3fr_2fr]"
545+ : "auto-rows-[6rem] grid-cols-2" ,
546+ )
547+ : "w-80 max-w-full grid-cols-2 gap-2" ,
528548 ) }
529549 >
530- { regularImages . map ( ( image ) => (
550+ { regularImages . map ( ( image , index ) => (
531551 < div
532552 key = { image . id }
533553 className = { cn (
534554 "bg-background/70" ,
535555 image . source ?. kind === "snap-shot" && image . previewUrl
536556 ? cn ( SNAP_SHOT_ATTACHMENT_FRAME_CLASS , "col-span-2" )
537- : cn (
538- "overflow-hidden rounded-lg border border-border/80" ,
539- ! loneImage && "aspect-[4/3]" ,
540- ) ,
557+ : loneImage
558+ ? cn ( MEDIA_EDGE_CLASS_NAME , "overflow-hidden rounded-2xl" )
559+ : collage
560+ ? cn (
561+ "overflow-hidden bg-background" ,
562+ regularImages . length === 3 && index === 0 && "row-span-2" ,
563+ regularImages . length > 3 &&
564+ regularImages . length % 2 === 1 &&
565+ index === regularImages . length - 1 &&
566+ "col-span-2" ,
567+ )
568+ : "aspect-[4/3] overflow-hidden rounded-lg border border-border/80" ,
541569 ) }
542570 >
543571 { image . previewUrl ? (
@@ -573,6 +601,7 @@ function UserTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "message"
573601 className = { cn (
574602 "flex min-h-[72px] items-center justify-center px-2 py-3 text-center text-2xs text-muted-foreground/70" ,
575603 loneImage && "h-48 w-64 max-w-full" ,
604+ collage && "h-full" ,
576605 ) }
577606 >
578607 { image . name }
0 commit comments