HomeView uses @Injected, drops app/window/client/userId params

This commit is contained in:
Brendan Szymanski 2026-06-10 17:33:56 -04:00
parent 3e093a0446
commit 2e75675d05

View file

@ -3,10 +3,8 @@ 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] = []
@ -14,20 +12,6 @@ public struct HomeView: View {
@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 {
Clamp()
@ -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
)
}
}