mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Add a shared NotificationCountBadge view
Extract the unread notification count capsule from the room list cell into its own view so it can be reused elsewhere. It caps the displayed value at 99+ and comes in a medium size (used by the room list) and a small size.
This commit is contained in:
@@ -146,13 +146,7 @@ struct HomeScreenRoomCell: View {
|
||||
|
||||
if room.badges.isDotShown {
|
||||
if room.isHighlighted, room.badges.notificationCount > 0 {
|
||||
Text(formattedNotificationCount)
|
||||
.font(.compound.bodySMSemibold)
|
||||
.foregroundColor(.compound.textOnSolidPrimary)
|
||||
.lineLimit(1)
|
||||
.padding(.horizontal, 6)
|
||||
.frame(minWidth: 20, minHeight: 20)
|
||||
.background(.compound.iconAccentPrimary, in: .capsule)
|
||||
NotificationCountBadge(count: Int(room.badges.notificationCount))
|
||||
.accessibilityLabel(L10n.a11yNotificationsNewMessages)
|
||||
} else {
|
||||
Circle()
|
||||
@@ -170,10 +164,6 @@ struct HomeScreenRoomCell: View {
|
||||
.accessibilityLabel(L10n.a11yNotificationsNewMentions)
|
||||
}
|
||||
|
||||
private var formattedNotificationCount: String {
|
||||
room.badges.notificationCount > 99 ? "99+" : "\(room.badges.notificationCount)"
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var lastMessage: some View {
|
||||
if let displayedLastMessage = room.displayedLastMessage {
|
||||
|
||||
Reference in New Issue
Block a user