Displaying suitable text instead of Empty Notification View

Changelog-Fixed:Handle empty notification pages by displaying suitable text
Signed-off-by: Swift Coder <scoder1747@gmail.com>
This commit is contained in:
Swift Coder
2024-12-16 13:28:25 -05:00
committed by Daniel D’Aquino
parent 2c7384b0a9
commit 4cf8097de4

View File

@@ -144,11 +144,14 @@ struct NotificationsView: View {
func NotificationTab(_ filter: NotificationFilter) -> some View { func NotificationTab(_ filter: NotificationFilter) -> some View {
ScrollViewReader { scroller in ScrollViewReader { scroller in
ScrollView { ScrollView {
let notifs = Array(zip(1..., filter.filter(contacts: state.contacts, items: notifications.notifications)))
if notifs.isEmpty {
EmptyTimelineView()
} else {
LazyVStack(alignment: .leading) { LazyVStack(alignment: .leading) {
Color.white.opacity(0) Color.white.opacity(0)
.id("startblock") .id("startblock")
.frame(height: 5) .frame(height: 5)
let notifs = Array(zip(1..., filter.filter(contacts: state.contacts, items: notifications.notifications)))
ForEach(notifs, id: \.0) { zip in ForEach(notifs, id: \.0) { zip in
NotificationItemView(state: state, item: zip.1) NotificationItemView(state: state, item: zip.1)
} }
@@ -160,6 +163,7 @@ struct NotificationsView: View {
return Color.clear return Color.clear
}) })
} }
}
.coordinateSpace(name: "scroll") .coordinateSpace(name: "scroll")
.onReceive(handle_notify(.scroll_to_top)) { notif in .onReceive(handle_notify(.scroll_to_top)) { notif in
let _ = notifications.flush(state) let _ = notifications.flush(state)