Skip to content

Commit

Permalink
Merge pull request #8492 from marcRDZ/fix-8381_chip-abbreviation
Browse files Browse the repository at this point in the history
Extract chip initials from display name
  • Loading branch information
wmontwe authored Nov 11, 2024
2 parents 2ea48ca + 213371d commit 8668fab
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ internal fun AccountAvatar(
.border(2.dp, MainTheme.colors.surfaceContainerLowest, CircleShape),
) {
Placeholder(
email = account.account.email,
displayName = account.account.displayName,
)
// TODO: Add image loading
}
Expand All @@ -64,11 +64,11 @@ internal fun AccountAvatar(

@Composable
private fun Placeholder(
email: String,
displayName: String,
modifier: Modifier = Modifier,
) {
TextTitleMedium(
text = extractDomainInitials(email).uppercase(),
text = extractNameInitials(displayName).uppercase(),
modifier = modifier,
)
}
Expand Down Expand Up @@ -102,6 +102,6 @@ private fun UnreadBadge(
}
}

private fun extractDomainInitials(email: String): String {
return email.split("@")[1].take(2)
private fun extractNameInitials(displayName: String): String {
return displayName.take(2)
}

0 comments on commit 8668fab

Please sign in to comment.