mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-30 19:23:17 +02:00
Adjusting the message screen to correctly display the time aligned to the right.
This commit is contained in:
@@ -54,18 +54,19 @@ fun ChatroomCompose(baseNote: Note, accountViewModel: AccountViewModel, navContr
|
||||
} else {
|
||||
note.event?.content
|
||||
}
|
||||
channel?.let {
|
||||
channel?.let { channel ->
|
||||
ChannelName(
|
||||
channelPicture = it.profilePicture(),
|
||||
channelPicture = channel.profilePicture(),
|
||||
channelTitle = {
|
||||
Text(
|
||||
"${it.info.name}",
|
||||
fontWeight = FontWeight.Bold
|
||||
"${channel.info.name}",
|
||||
fontWeight = FontWeight.Bold,
|
||||
modifier = it
|
||||
)
|
||||
},
|
||||
channelLastTime = note.event?.createdAt,
|
||||
channelLastContent = "${author?.toBestDisplayName()}: " + description,
|
||||
onClick = { navController.navigate("Channel/${it.idHex}") })
|
||||
onClick = { navController.navigate("Channel/${channel.idHex}") })
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -85,13 +86,13 @@ fun ChatroomCompose(baseNote: Note, accountViewModel: AccountViewModel, navContr
|
||||
}
|
||||
}
|
||||
|
||||
userToComposeOn?.let {
|
||||
userToComposeOn?.let { user ->
|
||||
ChannelName(
|
||||
channelPicture = it.profilePicture(),
|
||||
channelTitle = { UsernameDisplay(it) },
|
||||
channelPicture = user.profilePicture(),
|
||||
channelTitle = { UsernameDisplay(user, it) },
|
||||
channelLastTime = note.event?.createdAt,
|
||||
channelLastContent = accountViewModel.decrypt(note),
|
||||
onClick = { navController.navigate("Room/${it.pubkeyHex}") })
|
||||
onClick = { navController.navigate("Room/${user.pubkeyHex}") })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +101,7 @@ fun ChatroomCompose(baseNote: Note, accountViewModel: AccountViewModel, navContr
|
||||
@Composable
|
||||
fun ChannelName(
|
||||
channelPicture: String,
|
||||
channelTitle: @Composable () -> Unit,
|
||||
channelTitle: @Composable (Modifier) -> Unit,
|
||||
channelLastTime: Long?,
|
||||
channelLastContent: String?,
|
||||
onClick: () -> Unit
|
||||
@@ -125,7 +126,7 @@ fun ChannelName(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.padding(bottom = 4.dp)
|
||||
) {
|
||||
channelTitle()
|
||||
channelTitle(Modifier.weight(1f))
|
||||
|
||||
channelLastTime?.let {
|
||||
Text(
|
||||
|
@@ -15,7 +15,7 @@ fun timeAgo(mills: Long?): String {
|
||||
humanReadable = "now";
|
||||
}
|
||||
|
||||
return " • " + humanReadable
|
||||
return humanReadable
|
||||
.replace(" hr. ago", "h")
|
||||
.replace(" min. ago", "m")
|
||||
.replace(" days ago", "d")
|
||||
|
Reference in New Issue
Block a user