2021-09-25 08:18:22 +00:00
|
|
|
import Defaults
|
2021-08-29 21:36:18 +00:00
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct AppSidebarSubscriptions: View {
|
2022-11-24 20:36:05 +00:00
|
|
|
@ObservedObject private var navigation = NavigationModel.shared
|
2022-12-11 11:38:57 +00:00
|
|
|
@ObservedObject private var subscriptions = SubsribedChannelsModel.shared
|
2021-08-29 21:36:18 +00:00
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
Section(header: Text("Subscriptions")) {
|
|
|
|
ForEach(subscriptions.all) { channel in
|
2021-09-28 23:01:49 +00:00
|
|
|
NavigationLink(tag: TabSelection.channel(channel.id), selection: $navigation.tabSelection) {
|
2022-12-10 21:37:14 +00:00
|
|
|
LazyView(ChannelVideosView(channel: channel).modifier(PlayerOverlayModifier()))
|
2021-08-29 21:36:18 +00:00
|
|
|
} label: {
|
2022-01-06 16:55:56 +00:00
|
|
|
Label(channel.name, systemImage: RecentsModel.symbolSystemImage(channel.name))
|
2021-08-29 21:36:18 +00:00
|
|
|
}
|
|
|
|
.contextMenu {
|
|
|
|
Button("Unsubscribe") {
|
2022-06-24 23:21:05 +00:00
|
|
|
navigation.presentUnsubscribeAlert(channel, subscriptions: subscriptions)
|
2021-08-29 21:36:18 +00:00
|
|
|
}
|
|
|
|
}
|
2021-09-28 23:01:49 +00:00
|
|
|
.id("channel\(channel.id)")
|
2021-08-29 21:36:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-12-11 11:38:57 +00:00
|
|
|
|
|
|
|
struct AppSidebarSubscriptions_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
AppSidebarSubscriptions()
|
|
|
|
}
|
|
|
|
}
|