HomeView uses @Injected, drops app/window/client/userId params
This commit is contained in:
parent
3e093a0446
commit
2e75675d05
1 changed files with 5 additions and 25 deletions
|
|
@ -3,30 +3,14 @@ import LuminateCore
|
|||
|
||||
public struct HomeView: View {
|
||||
|
||||
public var app: AdwaitaApp
|
||||
public var window: AdwaitaWindow
|
||||
public var client: JellyfinClient
|
||||
public var userId: String
|
||||
@Injected(\.client) var client
|
||||
@Injected(\.userId) var userId
|
||||
@State private var resumeItems: [Components.Schemas.BaseItemDto] = []
|
||||
@State private var nextUpItems: [Components.Schemas.BaseItemDto] = []
|
||||
@State private var latestItems: [Components.Schemas.BaseItemDto] = []
|
||||
@State private var libraries: [Components.Schemas.BaseItemDto] = []
|
||||
@State private var isLoading = true
|
||||
@State private var isLoadingData = false
|
||||
|
||||
@Environment("client") var apiClient: JellyfinClient?
|
||||
|
||||
public init(
|
||||
app: AdwaitaApp,
|
||||
window: AdwaitaWindow,
|
||||
client: JellyfinClient,
|
||||
userId: String
|
||||
) {
|
||||
self.app = app
|
||||
self.window = window
|
||||
self.client = client
|
||||
self.userId = userId
|
||||
}
|
||||
|
||||
public var view: Body {
|
||||
ScrollView {
|
||||
|
|
@ -46,16 +30,14 @@ public struct HomeView: View {
|
|||
if !resumeItems.isEmpty {
|
||||
MediaRow(
|
||||
title: "Continue Watching",
|
||||
items: resumeItems,
|
||||
client: client
|
||||
items: resumeItems
|
||||
)
|
||||
.padding(16, .bottom)
|
||||
}
|
||||
if !nextUpItems.isEmpty {
|
||||
MediaRow(
|
||||
title: "Next Up",
|
||||
items: nextUpItems,
|
||||
client: client
|
||||
items: nextUpItems
|
||||
)
|
||||
.padding(16, .bottom)
|
||||
}
|
||||
|
|
@ -63,14 +45,12 @@ public struct HomeView: View {
|
|||
MediaRow(
|
||||
title: "Recently Added",
|
||||
items: latestItems,
|
||||
client: client,
|
||||
onSeeAll: {}
|
||||
)
|
||||
.padding(16, .bottom)
|
||||
}
|
||||
LibraryGrid(
|
||||
libraries: libraries,
|
||||
client: client
|
||||
libraries: libraries
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue