update ui

This commit is contained in:
2026-07-21 10:43:30 +07:00
parent d7ed51d79d
commit 13a7ee942d

View File

@@ -25,6 +25,8 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Badge
import androidx.compose.material3.BadgedBox
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
@@ -662,6 +664,15 @@ fun NewRequests(requests: List<Room>) {
navigator.navigate(Screen.RequestList)
},
leadingContent = {
BadgedBox(
badge = {
if (totalUnread > 0) {
Badge {
Text(totalUnread.toString())
}
}
}
) {
Box(
modifier = Modifier
.size(48.dp)
@@ -681,6 +692,7 @@ fun NewRequests(requests: List<Room>) {
}
}
}
}
},
headlineContent = {
Text(
@@ -703,13 +715,6 @@ fun NewRequests(requests: List<Room>) {
)
}
},
trailingContent = {
if (totalUnread > 0) {
androidx.compose.material3.Badge {
Text(totalUnread.toString())
}
}
},
colors = ListItemDefaults.colors(
containerColor = MaterialTheme.colorScheme.surface
)
@@ -726,12 +731,22 @@ fun ChatRoom(room: Room, onClick: () -> Unit) {
ListItem(
modifier = Modifier.clickable(onClick = onClick),
leadingContent = {
BadgedBox(
badge = {
if (room.unreadCount > 0) {
Badge {
Text(room.unreadCount.toString())
}
}
}
) {
Avatar(picture = roomState.picture, description = roomState.picture)
}
},
headlineContent = {
Row(
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically
verticalAlignment = Alignment.CenterVertically,
) {
Text(
text = roomState.name,
@@ -743,7 +758,8 @@ fun ChatRoom(room: Room, onClick: () -> Unit) {
Text(
text = room.createdAt.ago(),
style = MaterialTheme.typography.bodySmall,
color = if (room.unreadCount > 0) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.outline
color = MaterialTheme.colorScheme.outline,
textAlign = TextAlign.End,
)
}
},
@@ -760,13 +776,6 @@ fun ChatRoom(room: Room, onClick: () -> Unit) {
)
}
},
trailingContent = {
if (room.unreadCount > 0) {
androidx.compose.material3.Badge {
Text(room.unreadCount.toString())
}
}
},
colors = ListItemDefaults.colors(
containerColor = MaterialTheme.colorScheme.surface
)