Adding a small empty timeline view to make it more obvious when there is no content and when there is content

This commit is contained in:
Sam DuBois
2022-12-17 15:26:03 -07:00
committed by William Casarin
parent ea8394e7cf
commit d7d8076bee
4 changed files with 62 additions and 12 deletions

View File

@@ -20,16 +20,20 @@ struct InnerTimelineView: View {
var body: some View {
LazyVStack {
ForEach(events.filter(filter), id: \.id) { (ev: NostrEvent) in
let tm = ThreadModel(event: inner_event_or_self(ev: ev), damus_state: damus)
let is_chatroom = should_show_chatroom(ev)
let tv = ThreadView(thread: tm, damus: damus, is_chatroom: is_chatroom)
NavigationLink(destination: tv) {
EventView(event: ev, highlight: .none, has_action_bar: true, damus: damus, show_friend_icon: show_friend_icon)
if events.isEmpty {
EmptyTimelineView()
} else {
ForEach(events.filter(filter), id: \.id) { (ev: NostrEvent) in
let tm = ThreadModel(event: inner_event_or_self(ev: ev), damus_state: damus)
let is_chatroom = should_show_chatroom(ev)
let tv = ThreadView(thread: tm, damus: damus, is_chatroom: is_chatroom)
NavigationLink(destination: tv) {
EventView(event: ev, highlight: .none, has_action_bar: true, damus: damus, show_friend_icon: show_friend_icon)
}
.isDetailLink(true)
.buttonStyle(PlainButtonStyle())
}
.isDetailLink(true)
.buttonStyle(PlainButtonStyle())
}
}
.padding(.horizontal)
@@ -54,8 +58,9 @@ struct TimelineView: View {
if loading {
ProgressView()
.progressViewStyle(.circular)
} else {
InnerTimelineView(events: $events, damus: damus, show_friend_icon: show_friend_icon, filter: filter)
}
InnerTimelineView(events: $events, damus: damus, show_friend_icon: show_friend_icon, filter: filter)
}
.onReceive(NotificationCenter.default.publisher(for: .scroll_to_top)) { _ in
guard let event = events.filter(self.filter).first else {