2021-06-28 10:43:07 +00:00
|
|
|
import Siesta
|
2021-06-11 21:11:59 +00:00
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct ChannelView: View {
|
2021-06-28 10:43:07 +00:00
|
|
|
@ObservedObject private var store = Store<[Video]>()
|
2021-06-11 21:11:59 +00:00
|
|
|
|
2021-06-28 10:43:07 +00:00
|
|
|
var id: String
|
2021-06-11 21:11:59 +00:00
|
|
|
|
2021-06-28 10:43:07 +00:00
|
|
|
var resource: Resource {
|
|
|
|
InvidiousAPI.shared.channelVideos(id)
|
2021-06-11 21:11:59 +00:00
|
|
|
}
|
|
|
|
|
2021-06-28 10:43:07 +00:00
|
|
|
init(id: String) {
|
|
|
|
self.id = id
|
|
|
|
resource.addObserver(store)
|
|
|
|
}
|
2021-06-11 21:11:59 +00:00
|
|
|
|
2021-06-28 10:43:07 +00:00
|
|
|
var body: some View {
|
2021-07-11 20:52:49 +00:00
|
|
|
HStack {
|
|
|
|
Spacer()
|
|
|
|
|
|
|
|
VStack {
|
|
|
|
Spacer()
|
|
|
|
VideosView(videos: store.collection)
|
|
|
|
.onAppear {
|
|
|
|
resource.loadIfNeeded()
|
|
|
|
}
|
|
|
|
Spacer()
|
2021-06-28 10:43:07 +00:00
|
|
|
}
|
2021-07-11 20:52:49 +00:00
|
|
|
|
|
|
|
Spacer()
|
|
|
|
}
|
|
|
|
.edgesIgnoringSafeArea(.all)
|
|
|
|
.background(.ultraThickMaterial)
|
2021-06-11 21:11:59 +00:00
|
|
|
}
|
|
|
|
}
|