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 { @ViewBuilder private func channelButton(badge: Bool = true) -> some View {
Button { if !video.channel.name.isEmpty {
guard !inChannelView else { Button {
return guard !inChannelView else {
} return
}
NavigationModel.openChannel( NavigationModel.openChannel(
video.channel, video.channel,
player: player, player: player,
recents: recents, recents: recents,
navigation: navigation, navigation: navigation,
navigationStyle: navigationStyle navigationStyle: navigationStyle
) )
} label: { } label: {
if badge { if badge {
DetailBadge(text: video.author, style: .prominent) DetailBadge(text: video.author, style: .prominent)
.foregroundColor(.primary) .foregroundColor(.primary)
} else { } else {
Text(video.channel.name) Text(video.channel.name)
.fontWeight(.semibold) .fontWeight(.semibold)
.foregroundColor(.secondary) .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 { private var additionalDetailsAvailable: Bool {