mirror of
https://github.com/yattee/yattee.git
synced 2025-08-05 02:04:07 +00:00
Add infinite scroll for comments
This commit is contained in:
@@ -130,7 +130,11 @@ struct NowPlayingView: View {
|
||||
}
|
||||
|
||||
if sections.contains(.comments) {
|
||||
if !comments.loaded {
|
||||
if comments.disabled {
|
||||
NoCommentsView(text: "Comments are disabled", systemImage: "xmark.circle.fill")
|
||||
} else if comments.loaded && comments.all.isEmpty {
|
||||
NoCommentsView(text: "No comments", systemImage: "0.circle.fill")
|
||||
} else if !comments.loaded {
|
||||
VStack(alignment: .center) {
|
||||
PlaceholderProgressView()
|
||||
.onAppear {
|
||||
@@ -142,6 +146,14 @@ struct NowPlayingView: View {
|
||||
ForEach(comments.all) { comment in
|
||||
CommentView(comment: comment, repliesID: $repliesID)
|
||||
}
|
||||
if comments.nextPageAvailable {
|
||||
Text("Scroll to load more...")
|
||||
.foregroundColor(.secondary)
|
||||
.padding(.leading)
|
||||
.onAppear {
|
||||
comments.loadNextPage()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user