mirror of
https://github.com/yattee/yattee.git
synced 2025-10-18 05:18:12 +00:00
iOS: make timestamps in comments touchable
Timestamps in comments can now be touched and jump to the corresponding part in the video. Signed-off-by: Toni Förster <toni.foerster@gmail.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import SwiftUI
|
||||
|
||||
struct CommentsView: View {
|
||||
@State private var repliesID: Comment.ID?
|
||||
@State private var availableWidth = 0.0
|
||||
|
||||
@ObservedObject private var comments = CommentsModel.shared
|
||||
|
||||
@@ -14,16 +15,21 @@ struct CommentsView: View {
|
||||
} else if !comments.loaded {
|
||||
PlaceholderProgressView()
|
||||
} else {
|
||||
let last = comments.all.last
|
||||
LazyVStack {
|
||||
ForEach(comments.all) { comment in
|
||||
CommentView(comment: comment, repliesID: $repliesID)
|
||||
CommentView(comment: comment, repliesID: $repliesID, availableWidth: availableWidth)
|
||||
.onAppear {
|
||||
comments.loadNextPageIfNeeded(current: comment)
|
||||
}
|
||||
.borderBottom(height: comment != last ? 0.5 : 0, color: Color("ControlsBorderColor"))
|
||||
.borderBottom(height: comment != comments.all.last ? 0.5 : 0, color: Color("ControlsBorderColor"))
|
||||
}
|
||||
}
|
||||
.background(GeometryReader { geometry in
|
||||
Color.clear
|
||||
.onAppear {
|
||||
self.availableWidth = Double(geometry.size.width)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
.padding(.horizontal)
|
||||
|
Reference in New Issue
Block a user