mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-20 00:24:43 +02:00
App Layout: added space invites in space bottom sheet
This commit is contained in:
+1
@@ -48,6 +48,7 @@ struct SpaceSelector: View {
|
||||
icon: item.icon,
|
||||
displayName: item.displayName,
|
||||
hasSubItems: item.hasSubItems,
|
||||
isJoined: item.isJoined,
|
||||
isSelected: item.id == viewModel.viewState.selectedSpaceId,
|
||||
notificationCount: item.notificationCount,
|
||||
highlightedNotificationCount: item.highlightedNotificationCount,
|
||||
|
||||
+25
-15
@@ -29,6 +29,7 @@ struct SpaceSelectorListRow: View {
|
||||
let icon: UIImage?
|
||||
let displayName: String?
|
||||
let hasSubItems: Bool
|
||||
let isJoined: Bool
|
||||
let isSelected: Bool
|
||||
let notificationCount: UInt
|
||||
let highlightedNotificationCount: UInt
|
||||
@@ -61,17 +62,15 @@ struct SpaceSelectorListRow: View {
|
||||
.accessibility(identifier: "itemName")
|
||||
Spacer()
|
||||
if notificationCount > 0 {
|
||||
Text("\(notificationCount)")
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundColor(theme.colors.background)
|
||||
.font(theme.fonts.footnote)
|
||||
.padding(.vertical, 2)
|
||||
.padding(.horizontal, 6)
|
||||
.background(highlightedNotificationCount > 0 ? theme.colors.alert : theme.colors.secondaryContent)
|
||||
.clipShape(Capsule())
|
||||
.accessibility(identifier: "notificationBadge")
|
||||
badge(with: "\(notificationCount)", color: highlightedNotificationCount > 0 ? theme.colors.alert : theme.colors.secondaryContent)
|
||||
}
|
||||
if hasSubItems {
|
||||
if !isJoined {
|
||||
badge(with: "! ", color: theme.colors.alert)
|
||||
Image(systemName: "chevron.right")
|
||||
.renderingMode(.template)
|
||||
.foregroundColor(theme.colors.secondaryContent)
|
||||
}
|
||||
if hasSubItems && isJoined {
|
||||
Button {
|
||||
disclosureAction?()
|
||||
} label: {
|
||||
@@ -91,6 +90,17 @@ struct SpaceSelectorListRow: View {
|
||||
.background(theme.colors.background)
|
||||
}
|
||||
|
||||
private func badge(with text: String, color: Color) -> some View {
|
||||
return Text(text)
|
||||
.multilineTextAlignment(.center)
|
||||
.foregroundColor(theme.colors.background)
|
||||
.font(theme.fonts.footnote)
|
||||
.padding(.vertical, 2)
|
||||
.padding(.horizontal, 6)
|
||||
.background(color)
|
||||
.clipShape(Capsule())
|
||||
.accessibility(identifier: "notificationBadge")
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Previews
|
||||
@@ -104,11 +114,11 @@ struct SpaceSelectorListRow_Previews: PreviewProvider {
|
||||
|
||||
static var sampleView: some View {
|
||||
VStack(spacing: 8) {
|
||||
SpaceSelectorListRow(avatar: nil, icon: UIImage(systemName: "house"), displayName: "Space name", hasSubItems: false, isSelected: false, notificationCount: 0, highlightedNotificationCount: 0, disclosureAction: nil)
|
||||
SpaceSelectorListRow(avatar: nil, icon: UIImage(systemName: "house"), displayName: "Space name", hasSubItems: true, isSelected: false, notificationCount: 0, highlightedNotificationCount: 0, disclosureAction: nil)
|
||||
SpaceSelectorListRow(avatar: nil, icon: UIImage(systemName: "house"), displayName: "Space name", hasSubItems: true, isSelected: false, notificationCount: 99, highlightedNotificationCount: 0, disclosureAction: nil)
|
||||
SpaceSelectorListRow(avatar: nil, icon: UIImage(systemName: "house"), displayName: "Space name", hasSubItems: false, isSelected: false, notificationCount: 99, highlightedNotificationCount: 1, disclosureAction: nil)
|
||||
SpaceSelectorListRow(avatar: nil, icon: UIImage(systemName: "house"), displayName: "Space name", hasSubItems: true, isSelected: true, notificationCount: 99, highlightedNotificationCount: 1, disclosureAction: nil)
|
||||
SpaceSelectorListRow(avatar: nil, icon: UIImage(systemName: "house"), displayName: "Space name", hasSubItems: false, isJoined: true, isSelected: false, notificationCount: 0, highlightedNotificationCount: 0, disclosureAction: nil)
|
||||
SpaceSelectorListRow(avatar: nil, icon: UIImage(systemName: "house"), displayName: "Space name", hasSubItems: true, isJoined: true, isSelected: false, notificationCount: 0, highlightedNotificationCount: 0, disclosureAction: nil)
|
||||
SpaceSelectorListRow(avatar: nil, icon: UIImage(systemName: "house"), displayName: "Space name", hasSubItems: true, isJoined: true, isSelected: false, notificationCount: 99, highlightedNotificationCount: 0, disclosureAction: nil)
|
||||
SpaceSelectorListRow(avatar: nil, icon: UIImage(systemName: "house"), displayName: "Space name", hasSubItems: false, isJoined: true, isSelected: false, notificationCount: 99, highlightedNotificationCount: 1, disclosureAction: nil)
|
||||
SpaceSelectorListRow(avatar: nil, icon: UIImage(systemName: "house"), displayName: "Space name", hasSubItems: true, isJoined: true, isSelected: true, notificationCount: 99, highlightedNotificationCount: 1, disclosureAction: nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user