jel/Jel/Views/Library/Item/ItemMovieView.swift

50 lines
1.1 KiB
Swift
Raw Normal View History

//
// 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
var body: some View {
2023-12-24 04:47:21 +00:00
ScrollView {
ItemHeaderView(item: item)
Text(item.taglines?[0] ?? "Unknown")
.font(.headline)
2023-12-24 04:47:21 +00:00
.padding(.top, 20)
Text(item.overview ?? "Unknown")
2023-12-24 04:47:21 +00:00
.padding()
}
2023-12-24 04:47:21 +00:00
.redacted(reason: loading ? .placeholder : [])
.ignoresSafeArea(edges: .top)
.toolbarRole(.editor)
.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())
}