commit 4cf8097de401f4f02b50b268c18b00f4182165cd
parent 2c7384b0a99879e4e7b471e98581f03f25cfecf9
Author: Swift Coder <scoder1747@gmail.com>
Date: Mon, 16 Dec 2024 13:28:25 -0500
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>
Diffstat:
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/damus/Views/Notifications/NotificationsView.swift b/damus/Views/Notifications/NotificationsView.swift
@@ -144,21 +144,25 @@ struct NotificationsView: View {
func NotificationTab(_ filter: NotificationFilter) -> some View {
ScrollViewReader { scroller in
ScrollView {
- LazyVStack(alignment: .leading) {
- Color.white.opacity(0)
- .id("startblock")
- .frame(height: 5)
- let notifs = Array(zip(1..., filter.filter(contacts: state.contacts, items: notifications.notifications)))
- ForEach(notifs, id: \.0) { zip in
- NotificationItemView(state: state, item: zip.1)
+ let notifs = Array(zip(1..., filter.filter(contacts: state.contacts, items: notifications.notifications)))
+ if notifs.isEmpty {
+ EmptyTimelineView()
+ } else {
+ LazyVStack(alignment: .leading) {
+ Color.white.opacity(0)
+ .id("startblock")
+ .frame(height: 5)
+ ForEach(notifs, id: \.0) { zip in
+ NotificationItemView(state: state, item: zip.1)
+ }
}
+ .background(GeometryReader { proxy -> Color in
+ DispatchQueue.main.async {
+ handle_scroll_queue(proxy, queue: self.notifications)
+ }
+ return Color.clear
+ })
}
- .background(GeometryReader { proxy -> Color in
- DispatchQueue.main.async {
- handle_scroll_queue(proxy, queue: self.notifications)
- }
- return Color.clear
- })
}
.coordinateSpace(name: "scroll")
.onReceive(handle_notify(.scroll_to_top)) { notif in