2023-12-23 19:15:01 +00:00
|
|
|
//
|
|
|
|
// ItemMovieView.swift
|
|
|
|
// Jel
|
|
|
|
//
|
|
|
|
// Created by zerocool on 12/23/23.
|
|
|
|
//
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
import JellyfinKit
|
|
|
|
|
|
|
|
struct ItemMovieView: View {
|
|
|
|
@EnvironmentObject var jellyfinClient: JellyfinClientController
|
|
|
|
@StateObject var authState: AuthStateController = AuthStateController.shared
|
|
|
|
|
|
|
|
@State var item: BaseItemDto
|
|
|
|
@State var loading: Bool = true
|
2023-12-24 04:47:21 +00:00
|
|
|
|
2023-12-23 19:15:01 +00:00
|
|
|
var body: some View {
|
2023-12-24 04:47:21 +00:00
|
|
|
ScrollView {
|
|
|
|
ItemHeaderView(item: item)
|
2023-12-23 19:15:01 +00:00
|
|
|
|
|
|
|
Text(item.taglines?[0] ?? "Unknown")
|
|
|
|
.font(.headline)
|
2023-12-24 04:47:21 +00:00
|
|
|
.padding(.top, 20)
|
|
|
|
|
2023-12-23 19:15:01 +00:00
|
|
|
Text(item.overview ?? "Unknown")
|
2023-12-24 04:47:21 +00:00
|
|
|
.padding()
|
2023-12-23 19:15:01 +00:00
|
|
|
}
|
2023-12-24 04:47:21 +00:00
|
|
|
.redacted(reason: loading ? .placeholder : [])
|
|
|
|
.ignoresSafeArea(edges: .top)
|
|
|
|
.toolbarRole(.editor)
|
2023-12-23 19:15:01 +00:00
|
|
|
.navigationTitle(item.name ?? "Unknown")
|
|
|
|
.navigationBarTitleDisplayMode(.inline)
|
|
|
|
.onAppear {
|
|
|
|
Task {
|
|
|
|
do {
|
|
|
|
let request = Paths.getItem(userID: authState.userId ?? "", itemID: item.id ?? "")
|
|
|
|
item = try await jellyfinClient.send(request).value
|
|
|
|
loading = false
|
|
|
|
} catch {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#Preview {
|
|
|
|
ItemMovieView(item: BaseItemDto())
|
|
|
|
}
|