Improve placeholders

This commit is contained in:
Arkadiusz Fal 2022-07-11 19:44:25 +02:00
parent fa0784e5d9
commit fda4013907
2 changed files with 36 additions and 44 deletions

View File

@ -117,6 +117,8 @@ struct VideoDetails: View {
HStack(spacing: 4) { HStack(spacing: 4) {
if let published = video.publishedDate { if let published = video.publishedDate {
Text(published) Text(published)
} else {
Text("1 century ago").redacted(reason: .placeholder)
} }
} }
} }
@ -204,11 +206,11 @@ struct VideoDetails: View {
VStack(alignment: .leading, spacing: 10) { VStack(alignment: .leading, spacing: 10) {
if !player.videoBeingOpened.isNil && (video.description.isNil || video.description!.isEmpty) { if !player.videoBeingOpened.isNil && (video.description.isNil || video.description!.isEmpty) {
VStack(alignment: .leading, spacing: 0) { VStack(alignment: .leading, spacing: 0) {
ForEach(1 ... Int.random(in: 3 ... 5), id: \.self) { _ in ForEach(1 ... Int.random(in: 2 ... 5), id: \.self) { _ in
Text(String(repeating: Video.fixture.description!, count: Int.random(in: 1 ... 4))) Text(String(repeating: Video.fixture.description ?? "", count: Int.random(in: 1 ... 4)))
.redacted(reason: .placeholder)
} }
} }
.redacted(reason: .placeholder)
} else if let description = video.description { } else if let description = video.description {
Group { Group {
if #available(iOS 15.0, macOS 12.0, tvOS 15.0, *) { if #available(iOS 15.0, macOS 12.0, tvOS 15.0, *) {
@ -258,50 +260,37 @@ struct VideoDetails: View {
} }
@ViewBuilder var videoProperties: some View { @ViewBuilder var videoProperties: some View {
Group { HStack(spacing: 2) {
if player.videoBeingOpened.isNil { publishedDateSection
HStack(spacing: 2) {
publishedDateSection
Spacer()
HStack(spacing: 4) { Spacer()
if let views = video?.viewsCount {
Image(systemName: "eye")
Text(views) HStack(spacing: 4) {
} Image(systemName: "eye")
if let likes = video?.likesCount { if let views = video?.viewsCount, player.videoBeingOpened.isNil {
Image(systemName: "hand.thumbsup") Text(views)
} else {
Text("1,234M").redacted(reason: .placeholder)
}
Text(likes) Image(systemName: "hand.thumbsup")
}
if let likes = video?.dislikesCount { if let likes = video?.likesCount, player.videoBeingOpened.isNil {
Image(systemName: "hand.thumbsdown") Text(likes)
} else {
Text("1,234M").redacted(reason: .placeholder)
}
Text(likes) if Defaults[.enableReturnYouTubeDislike] {
} Image(systemName: "hand.thumbsdown")
if let dislikes = video?.dislikesCount, player.videoBeingOpened.isNil {
Text(dislikes)
} else {
Text("1,234M").redacted(reason: .placeholder)
} }
} }
} else {
HStack(spacing: 2) {
Text("Date placeholder")
Spacer()
HStack(spacing: 4) {
Image(systemName: "eye")
Text("1000")
Image(systemName: "eye")
Text("100")
Image(systemName: "eye")
Text("10")
}
}
.redacted(reason: .placeholder)
} }
} }
.font(.system(size: 12)) .font(.system(size: 12))

View File

@ -236,14 +236,17 @@ struct ControlsBar: View {
Text(video.author) Text(video.author)
.font(.system(size: 12)) .font(.system(size: 12))
if !presentingControls, if !presentingControls {
let channel = model.currentVideo?.channel,
let subsriptions = channel.subscriptionsString
{
HStack(spacing: 2) { HStack(spacing: 2) {
Image(systemName: "person.2.fill") Image(systemName: "person.2.fill")
Text(subsriptions) if let channel = model.currentVideo?.channel {
if let subscriptions = channel.subscriptionsString {
Text(subscriptions)
} else {
Text("1234").redacted(reason: .placeholder)
}
}
} }
.padding(.leading, 4) .padding(.leading, 4)
.font(.system(size: 9)) .font(.system(size: 9))