Notifications: Swap container for a List + make mentions more prominent

This commit is contained in:
Thomas Ricouard 2023-01-29 16:06:46 +01:00
parent 426d2e15b2
commit 243cbcbc41
3 changed files with 33 additions and 19 deletions

View File

@ -32,6 +32,9 @@ struct NotificationRowView: View {
} }
} }
} }
.alignmentGuide(.listRowSeparatorLeading) { viewDimensions in
return -100
}
} }
private func makeAvatarView(type: Models.Notification.NotificationType) -> some View { private func makeAvatarView(type: Models.Notification.NotificationType) -> some View {

View File

@ -19,14 +19,12 @@ public struct NotificationsListView: View {
} }
public var body: some View { public var body: some View {
ScrollView { List {
LazyVStack { topPaddingView
notificationsView notificationsView
.frame(maxWidth: .maxColumnWidth)
}
.padding(.top, .layoutPadding + 16)
.background(theme.primaryBackgroundColor)
} }
.environment(\.defaultMinListRowHeight, 1)
.listStyle(.plain)
.navigationTitle(lockedType?.menuTitle() ?? viewModel.selectedType?.menuTitle() ?? "notifications.navigation-title") .navigationTitle(lockedType?.menuTitle() ?? viewModel.selectedType?.menuTitle() ?? "notifications.navigation-title")
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
.toolbar { .toolbar {
@ -84,13 +82,12 @@ public struct NotificationsListView: View {
ForEach(ConsolidatedNotification.placeholders()) { notification in ForEach(ConsolidatedNotification.placeholders()) { notification in
NotificationRowView(notification: notification) NotificationRowView(notification: notification)
.redacted(reason: .placeholder) .redacted(reason: .placeholder)
.padding(.leading, .layoutPadding + 4) .listRowInsets(.init(top: 12,
.padding(.trailing, .layoutPadding) leading: .layoutPadding + 4,
.padding(.top, 6) bottom: 12,
.padding(.bottom, 2) trailing: .layoutPadding))
.listRowBackground(theme.primaryBackgroundColor)
.shimmering() .shimmering()
Divider()
.padding(.vertical, .dividerPadding)
} }
case let .display(notifications, nextPageState): case let .display(notifications, nextPageState):
@ -101,12 +98,12 @@ public struct NotificationsListView: View {
} else { } else {
ForEach(notifications) { notification in ForEach(notifications) { notification in
NotificationRowView(notification: notification) NotificationRowView(notification: notification)
.padding(.leading, .layoutPadding + 4) .listRowInsets(.init(top: 12,
.padding(.trailing, .layoutPadding) leading: .layoutPadding + 4,
.padding(.top, 6) bottom: 12,
.padding(.bottom, 2) trailing: .layoutPadding))
Divider() .listRowBackground(notification.type == .mention && lockedType != .mention ?
.padding(.vertical, .dividerPadding) theme.secondaryBackgroundColor : theme.primaryBackgroundColor)
} }
} }
@ -141,5 +138,18 @@ public struct NotificationsListView: View {
ProgressView() ProgressView()
Spacer() Spacer()
} }
.listRowInsets(.init(top: .layoutPadding,
leading: .layoutPadding + 4,
bottom: .layoutPadding,
trailing: .layoutPadding))
.listRowBackground(theme.primaryBackgroundColor)
}
private var topPaddingView: some View {
HStack { }
.listRowBackground(Color.clear)
.listRowSeparator(.hidden)
.listRowInsets(.init())
.frame(height: .layoutPadding)
} }
} }

View File

@ -70,6 +70,7 @@ struct StatusActionsView: View {
ShareLink(item: url) { ShareLink(item: url) {
Image(systemName: action.iconName(viewModel: viewModel)) Image(systemName: action.iconName(viewModel: viewModel))
} }
.buttonStyle(.borderless)
} }
} else { } else {
Button { Button {