Playlists and channels in the sidebar

This commit is contained in:
Arkadiusz Fal
2021-08-29 23:36:18 +02:00
parent 1196a2a5e2
commit 1651110a5d
13 changed files with 300 additions and 48 deletions

View File

@@ -0,0 +1,27 @@
import Siesta
import SwiftUI
struct ChannelVideosView: View {
@ObservedObject private var store = Store<[Video]>()
let channel: Channel
var resource: Resource {
InvidiousAPI.shared.channelVideos(channel.id)
}
init(_ channel: Channel) {
self.channel = channel
resource.addObserver(store)
}
var body: some View {
VideosView(videos: store.collection)
#if !os(tvOS)
.navigationTitle("\(channel.name) Channel")
#endif
.onAppear {
resource.loadIfNeeded()
}
}
}

View File

@@ -0,0 +1,17 @@
import Siesta
import SwiftUI
struct PlaylistVideosView: View {
let playlist: Playlist
init(_ playlist: Playlist) {
self.playlist = playlist
}
var body: some View {
VideosView(videos: playlist.videos)
#if !os(tvOS)
.navigationTitle("\(playlist.title) Playlist")
#endif
}
}