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,30 +3,14 @@ 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] = []
@State private var libraries: [Components.Schemas.BaseItemDto] = [] @State private var libraries: [Components.Schemas.BaseItemDto] = []
@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 {
@ -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
) )
} }
} }