mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Improve displaying information in the toolbar
This commit is contained in:
@@ -42,8 +42,10 @@ struct VideoThumbnailView: View {
|
|||||||
Image(systemName: "calendar")
|
Image(systemName: "calendar")
|
||||||
Text(video.published)
|
Text(video.published)
|
||||||
|
|
||||||
Image(systemName: "eye")
|
if video.views != 0 {
|
||||||
Text(video.viewsCount)
|
Image(systemName: "eye")
|
||||||
|
Text(video.viewsCount)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
.padding(.top)
|
.padding(.top)
|
||||||
@@ -53,10 +55,12 @@ struct VideoThumbnailView: View {
|
|||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
HStack(spacing: 8) {
|
HStack(spacing: 8) {
|
||||||
Image(systemName: "clock")
|
if let time = video.playTime {
|
||||||
|
Image(systemName: "clock")
|
||||||
|
|
||||||
Text(video.playTime ?? "-")
|
Text(time)
|
||||||
.fontWeight(.bold)
|
.fontWeight(.bold)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
}
|
}
|
||||||
|
@@ -50,6 +50,10 @@ final class Video: Identifiable, ObservableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var playTime: String? {
|
var playTime: String? {
|
||||||
|
guard !length.isZero else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
let formatter = DateComponentsFormatter()
|
let formatter = DateComponentsFormatter()
|
||||||
|
|
||||||
formatter.unitsStyle = .positional
|
formatter.unitsStyle = .positional
|
||||||
|
Reference in New Issue
Block a user