design(talk): пузыри чата и вложения 1:1 по живой теме

_mobile-spreed.css: автор — внутрь пузыря (12/600 чёрный, было зелёное
имя над пузырём), паддинг пузыря 8×10 (был 8×12), зазор сообщений 4px;
вложение-файл — круглая иконка типа 49dp из локальных assets/filetypes
+ имя 14/500 #3F3F3F (был смайлик 📄 зелёным). Радиус r8 и цвета
пузырей (#FDFDFD/#E0F8C9) уже совпадали.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
b-dev-mobile
2026-07-09 21:15:48 +00:00
parent bbfb6ae424
commit bc9a31a026
@@ -911,12 +911,26 @@ fun TalkMessageBody(
) )
} }
if (!message.attachmentFileName.isNullOrBlank() && !message.hasImageAttachment) { if (!message.attachmentFileName.isNullOrBlank() && !message.hasImageAttachment) {
Text( // Живая тема: карточка файла — круглая иконка типа 49dp + имя 14/500
"📄 ${message.attachmentFileName}", // (иконки типов — общие assets/filetypes из модуля files, мержатся в APK)
style = MaterialTheme.typography.bodyMedium, Row(
color = F7Colors.Primary, verticalAlignment = Alignment.CenterVertically,
fontWeight = FontWeight.Medium, horizontalArrangement = Arrangement.spacedBy(10.dp),
) ) {
AsyncImage(
model = "file:///android_asset/filetypes/${talkFileTypeIcon(message.attachmentFileName!!)}.svg",
contentDescription = null,
modifier = Modifier.size(49.dp),
)
Text(
message.attachmentFileName!!,
style = MaterialTheme.typography.bodyMedium,
color = F7Colors.ChatText,
fontWeight = FontWeight.Medium,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
}
} }
val display = buildMessageDisplayText(message.text) val display = buildMessageDisplayText(message.text)
if (display.text.isNotBlank()) { if (display.text.isNotBlank()) {
@@ -966,18 +980,10 @@ fun TalkMessageGroupRow(
group.messages.forEachIndexed { index, message -> group.messages.forEachIndexed { index, message ->
val showAuthor = group.showAuthor && index == 0 && group.outgoing.not() val showAuthor = group.showAuthor && index == 0 && group.outgoing.not()
Column( Column(
modifier = Modifier.padding(vertical = 1.dp), // Живая тема: зазор между сообщениями 4px (--f7-msg-gap)
modifier = Modifier.padding(vertical = 2.dp),
horizontalAlignment = if (group.outgoing) Alignment.End else Alignment.Start, horizontalAlignment = if (group.outgoing) Alignment.End else Alignment.Start,
) { ) {
if (showAuthor) {
Text(
message.actorDisplayName,
fontSize = 12.sp,
color = F7Colors.Primary,
fontWeight = FontWeight.Medium,
modifier = Modifier.padding(start = 4.dp, bottom = 2.dp),
)
}
Box( Box(
modifier = Modifier modifier = Modifier
.shadow( .shadow(
@@ -1004,9 +1010,22 @@ fun TalkMessageGroupRow(
onClick = {}, onClick = {},
onLongClick = { onLongPress?.invoke(message) }, onLongClick = { onLongPress?.invoke(message) },
) )
.padding(horizontal = 12.dp, vertical = 8.dp), // Живая тема: паддинг пузыря 8px 10px
.padding(horizontal = 10.dp, vertical = 8.dp),
) { ) {
TalkMessageBody(session = session, message = message) Column {
if (showAuthor) {
// Живая тема: автор ВНУТРИ пузыря, 12/600 чёрным
Text(
message.actorDisplayName,
fontSize = 12.sp,
color = F7Colors.TextPrimary,
fontWeight = FontWeight.SemiBold,
modifier = Modifier.padding(bottom = 2.dp),
)
}
TalkMessageBody(session = session, message = message)
}
} }
if (message.reactions.isNotEmpty()) { if (message.reactions.isNotEmpty()) {
Row( Row(
@@ -1592,3 +1611,18 @@ fun TalkCreateRoomSheet(
} }
} }
} }
/** Иконка типа файла для вложений чата (тот же набор assets/filetypes, что в Файлах). */
internal fun talkFileTypeIcon(name: String): String =
when (name.substringAfterLast('.', "").lowercase()) {
"doc", "docx", "dot", "dotx", "odt", "rtf" -> "word"
"xls", "xlsx", "xlsm", "ods", "csv" -> "spreadsheet"
"ppt", "pptx", "odp" -> "presentation"
"pdf" -> "pdf"
"jpg", "jpeg", "png", "gif", "webp", "bmp", "svg", "heic" -> "image"
"mp3", "wav", "ogg", "flac", "aac" -> "audio"
"mp4", "mkv", "avi", "mov", "webm" -> "video"
"zip", "rar", "7z", "tar", "gz" -> "archive"
"txt", "md", "log" -> "text"
else -> "file"
}