Don't show empty channel button

This commit is contained in:
Arkadiusz Fal 2022-11-18 22:46:00 +01:00
parent a1ade66594
commit 59eda3af26

View File

@ -303,35 +303,37 @@ struct VideoCell: View {
}
}
private func channelButton(badge: Bool = true) -> some View {
Button {
guard !inChannelView else {
return
}
@ViewBuilder private func channelButton(badge: Bool = true) -> some View {
if !video.channel.name.isEmpty {
Button {
guard !inChannelView else {
return
}
NavigationModel.openChannel(
video.channel,
player: player,
recents: recents,
navigation: navigation,
navigationStyle: navigationStyle
)
} label: {
if badge {
DetailBadge(text: video.author, style: .prominent)
.foregroundColor(.primary)
} else {
Text(video.channel.name)
.fontWeight(.semibold)
.foregroundColor(.secondary)
NavigationModel.openChannel(
video.channel,
player: player,
recents: recents,
navigation: navigation,
navigationStyle: navigationStyle
)
} label: {
if badge {
DetailBadge(text: video.author, style: .prominent)
.foregroundColor(.primary)
} else {
Text(video.channel.name)
.fontWeight(.semibold)
.foregroundColor(.secondary)
}
}
#if os(tvOS)
.buttonStyle(.card)
#else
.buttonStyle(.plain)
#endif
.help("\(video.channel.name) Channel")
}
#if os(tvOS)
.buttonStyle(.card)
#else
.buttonStyle(.plain)
#endif
.help("\(video.channel.name) Channel")
}
private var additionalDetailsAvailable: Bool {