knock requests : add formatted date

This commit is contained in:
ganfra
2024-12-04 13:48:15 +01:00
parent c79962f58c
commit affd0570dc
3 changed files with 24 additions and 9 deletions

View File

@@ -17,6 +17,7 @@ data class KnockRequest(
val displayName: String?,
val avatarUrl: String?,
val reason: String?,
val formattedDate: String?,
)
fun KnockRequest.getAvatarData(size: AvatarSize) = AvatarData(

View File

@@ -106,11 +106,13 @@ fun aKnockRequest(
displayName: String? = "Jacob Ross",
avatarUrl: String? = null,
reason: String? = "Hi, I would like to get access to this room please.",
formattedDate: String = "20 Nov 2024",
) = KnockRequest(
userId = userId,
displayName = displayName,
avatarUrl = avatarUrl,
reason = reason,
formattedDate = formattedDate,
)
fun aKnockRequestsListState(

View File

@@ -222,15 +222,27 @@ private fun KnockRequestItem(
Avatar(knockRequest.getAvatarData(AvatarSize.KnockRequestItem))
Spacer(modifier = Modifier.width(16.dp))
Column {
// Name
Text(
modifier = Modifier.clipToBounds(),
text = knockRequest.getBestName(),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
color = MaterialTheme.colorScheme.primary,
style = ElementTheme.typography.fontBodyLgMedium,
)
// Name and date
Row {
Text(
modifier = Modifier
.clipToBounds()
.weight(1f),
text = knockRequest.getBestName(),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
color = MaterialTheme.colorScheme.primary,
style = ElementTheme.typography.fontBodyLgMedium,
)
if (!knockRequest.formattedDate.isNullOrEmpty()) {
Spacer(modifier = Modifier.width(8.dp))
Text(
text = knockRequest.formattedDate,
color = MaterialTheme.colorScheme.secondary,
style = ElementTheme.typography.fontBodySmRegular,
)
}
}
// UserId
if (!knockRequest.displayName.isNullOrEmpty()) {
Text(