Skip to content

Commit cba681c

Browse files
committed
style(ui/replies): allow message content to favor longest content b/w reply and text
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent 16caae0 commit cba681c

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

ui/components/src/main/kotlin/com/getcode/ui/components/chat/messagecontents/MessageReplyContent.kt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,21 @@ internal fun MessageNodeScope.MessageReplyContent(
8282

8383
val replyPreviewPlaceable = subcompose("MessageReplyPreview") {
8484
MessageReplyPreview(
85-
modifier = Modifier
86-
.width(messageContentPlaceable.width.toDp())
87-
.noRippleClickable { onOriginalMessageClicked() },
85+
modifier = Modifier.noRippleClickable { onOriginalMessageClicked() },
8886
sender = originalMessage.sender,
8987
message = originalMessage.message,
9088
backgroundColor = Color.Black.copy(0.1f)
9189
)
92-
}.first().measure(constraints.copy(maxWidth = messageContentPlaceable.width))
90+
}.first().measure(constraints)
91+
92+
// Determine the final width based on the longer of the two components
93+
val finalWidth = maxOf(messageContentPlaceable.width, replyPreviewPlaceable.width)
9394

94-
val totalHeight =
95-
replyPreviewPlaceable.height + spacing + messageContentPlaceable.height
95+
// Calculate the total height
96+
val totalHeight = replyPreviewPlaceable.height + spacing + messageContentPlaceable.height
9697

97-
layout(messageContentPlaceable.width, totalHeight) {
98+
// Layout the components
99+
layout(finalWidth, totalHeight) {
98100
replyPreviewPlaceable.place(0, 0)
99101
messageContentPlaceable.place(0, replyPreviewPlaceable.height + spacing)
100102
}

0 commit comments

Comments
 (0)