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,10 +3,8 @@ import LuminateCore
|
||||||
|
|
||||||
public struct HomeView: View {
|
public struct HomeView: View {
|
||||||
|
|
||||||
public var app: AdwaitaApp
|
@Injected(\.client) var client
|
||||||
public var window: AdwaitaWindow
|
@Injected(\.userId) var userId
|
||||||
public var client: JellyfinClient
|
|
||||||
public var userId: String
|
|
||||||
@State private var resumeItems: [Components.Schemas.BaseItemDto] = []
|
@State private var resumeItems: [Components.Schemas.BaseItemDto] = []
|
||||||
@State private var nextUpItems: [Components.Schemas.BaseItemDto] = []
|
@State private var nextUpItems: [Components.Schemas.BaseItemDto] = []
|
||||||
@State private var latestItems: [Components.Schemas.BaseItemDto] = []
|
@State private var latestItems: [Components.Schemas.BaseItemDto] = []
|
||||||
|
|
@ -14,20 +12,6 @@ public struct HomeView: View {
|
||||||
@State private var isLoading = true
|
@State private var isLoading = true
|
||||||
@State private var isLoadingData = false
|
@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 {
|
public var view: Body {
|
||||||
ScrollView {
|
ScrollView {
|
||||||
Clamp()
|
Clamp()
|
||||||
|
|
@ -46,16 +30,14 @@ public struct HomeView: View {
|
||||||
if !resumeItems.isEmpty {
|
if !resumeItems.isEmpty {
|
||||||
MediaRow(
|
MediaRow(
|
||||||
title: "Continue Watching",
|
title: "Continue Watching",
|
||||||
items: resumeItems,
|
items: resumeItems
|
||||||
client: client
|
|
||||||
)
|
)
|
||||||
.padding(16, .bottom)
|
.padding(16, .bottom)
|
||||||
}
|
}
|
||||||
if !nextUpItems.isEmpty {
|
if !nextUpItems.isEmpty {
|
||||||
MediaRow(
|
MediaRow(
|
||||||
title: "Next Up",
|
title: "Next Up",
|
||||||
items: nextUpItems,
|
items: nextUpItems
|
||||||
client: client
|
|
||||||
)
|
)
|
||||||
.padding(16, .bottom)
|
.padding(16, .bottom)
|
||||||
}
|
}
|
||||||
|
|
@ -63,14 +45,12 @@ public struct HomeView: View {
|
||||||
MediaRow(
|
MediaRow(
|
||||||
title: "Recently Added",
|
title: "Recently Added",
|
||||||
items: latestItems,
|
items: latestItems,
|
||||||
client: client,
|
|
||||||
onSeeAll: {}
|
onSeeAll: {}
|
||||||
)
|
)
|
||||||
.padding(16, .bottom)
|
.padding(16, .bottom)
|
||||||
}
|
}
|
||||||
LibraryGrid(
|
LibraryGrid(
|
||||||
libraries: libraries,
|
libraries: libraries
|
||||||
client: client
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue