mirror of
https://github.com/yattee/yattee.git
synced 2025-08-06 10:44:06 +00:00
Playlists and channels in the sidebar
This commit is contained in:
27
Shared/Views/ChannelVideosView.swift
Normal file
27
Shared/Views/ChannelVideosView.swift
Normal 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()
|
||||
}
|
||||
}
|
||||
}
|
17
Shared/Views/PlaylistVideosView.swift
Normal file
17
Shared/Views/PlaylistVideosView.swift
Normal 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
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user