mirror of
https://github.com/yattee/yattee.git
synced 2024-12-23 05:53:41 +00:00
29 lines
681 B
Swift
29 lines
681 B
Swift
import Defaults
|
|
import Siesta
|
|
import SwiftUI
|
|
|
|
struct WatchNowSection: View {
|
|
let resource: Resource?
|
|
let label: String
|
|
|
|
@StateObject private var store = Store<[Video]>()
|
|
|
|
@EnvironmentObject<AccountsModel> private var accounts
|
|
|
|
init(resource: Resource?, label: String) {
|
|
self.resource = resource
|
|
self.label = label
|
|
}
|
|
|
|
var body: some View {
|
|
WatchNowSectionBody(label: label, videos: store.collection)
|
|
.onAppear {
|
|
resource?.addObserver(store)
|
|
resource?.loadIfNeeded()
|
|
}
|
|
.onChange(of: accounts.current) { _ in
|
|
resource?.load()
|
|
}
|
|
}
|
|
}
|