mirror of
https://github.com/yattee/yattee.git
synced 2024-11-14 10:08:23 +00:00
35 lines
830 B
Swift
35 lines
830 B
Swift
import Siesta
|
|
import SwiftUI
|
|
|
|
struct PopularView: View {
|
|
@StateObject private var store = Store<[Video]>()
|
|
|
|
@EnvironmentObject<AccountsModel> private var accounts
|
|
|
|
var resource: Resource? {
|
|
accounts.api.popular
|
|
}
|
|
|
|
var videos: [ContentItem] {
|
|
ContentItem.array(of: store.collection)
|
|
}
|
|
|
|
var body: some View {
|
|
PlayerControlsView {
|
|
VerticalCells(items: videos)
|
|
.onAppear {
|
|
resource?.addObserver(store)
|
|
resource?.loadIfNeeded()
|
|
}
|
|
#if !os(tvOS)
|
|
.navigationTitle("Popular")
|
|
#endif
|
|
}
|
|
.toolbar {
|
|
ToolbarItem(placement: .automatic) {
|
|
FavoriteButton(item: FavoriteItem(section: .popular))
|
|
}
|
|
}
|
|
}
|
|
}
|