mirror of
https://github.com/yattee/yattee.git
synced 2025-11-01 05:02:03 +00:00
Show video properties
This commit is contained in:
@@ -144,6 +144,8 @@ struct VideoDetails: View {
|
||||
ScrollView(.vertical, showsIndicators: false) {
|
||||
if let video {
|
||||
VStack(alignment: .leading, spacing: 10) {
|
||||
videoProperties
|
||||
|
||||
if !player.videoBeingOpened.isNil && (video.description.isNil || video.description!.isEmpty) {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
ForEach(1 ... Int.random(in: 2 ... 5), id: \.self) { _ in
|
||||
@@ -167,6 +169,58 @@ struct VideoDetails: View {
|
||||
}
|
||||
.padding(.horizontal)
|
||||
}
|
||||
|
||||
@ViewBuilder var videoProperties: some View {
|
||||
HStack(spacing: 2) {
|
||||
publishedDateSection
|
||||
|
||||
Spacer()
|
||||
|
||||
HStack(spacing: 4) {
|
||||
Image(systemName: "eye")
|
||||
|
||||
if let views = video?.viewsCount, player.videoBeingOpened.isNil {
|
||||
Text(views)
|
||||
} else {
|
||||
Text("1,234M").redacted(reason: .placeholder)
|
||||
}
|
||||
|
||||
Image(systemName: "hand.thumbsup")
|
||||
|
||||
if let likes = video?.likesCount, player.videoBeingOpened.isNil {
|
||||
Text(likes)
|
||||
} else {
|
||||
Text("1,234M").redacted(reason: .placeholder)
|
||||
}
|
||||
|
||||
if Defaults[.enableReturnYouTubeDislike] {
|
||||
Image(systemName: "hand.thumbsdown")
|
||||
|
||||
if let dislikes = video?.dislikesCount, player.videoBeingOpened.isNil {
|
||||
Text(dislikes)
|
||||
} else {
|
||||
Text("1,234M").redacted(reason: .placeholder)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.font(.system(size: 12))
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
|
||||
var publishedDateSection: some View {
|
||||
Group {
|
||||
if let video {
|
||||
HStack(spacing: 4) {
|
||||
if let published = video.publishedDate {
|
||||
Text(published)
|
||||
} else {
|
||||
Text("1 century ago").redacted(reason: .placeholder)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct VideoDetails_Previews: PreviewProvider {
|
||||
|
||||
Reference in New Issue
Block a user