Update itemView
This commit is contained in:
parent
ca47292e3d
commit
6d32db6751
@ -19,7 +19,6 @@
|
||||
3D16FC3C2B2CDFB500E6D8B3 /* DashboardLibraryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D16FC3B2B2CDFB500E6D8B3 /* DashboardLibraryView.swift */; };
|
||||
3D3816C92B4B5648006414D7 /* ItemGenresView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D3816C82B4B5648006414D7 /* ItemGenresView.swift */; };
|
||||
3D3816CE2B4B78BB006414D7 /* VisibilityTrackingScrollView in Frameworks */ = {isa = PBXBuildFile; productRef = 3D3816CD2B4B78BB006414D7 /* VisibilityTrackingScrollView */; };
|
||||
3D41D1F52B2C962500E58234 /* AppearancePicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D41D1F42B2C962500E58234 /* AppearancePicker.swift */; };
|
||||
3D41D1FA2B2CAE0000E58234 /* ItemIconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D41D1F92B2CAE0000E58234 /* ItemIconView.swift */; };
|
||||
3D4C15722B3CAA670035373E /* DashboardSectionTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D4C15712B3CAA670035373E /* DashboardSectionTitleView.swift */; };
|
||||
3D7709392B29139700199889 /* Pulse in Frameworks */ = {isa = PBXBuildFile; productRef = 3D7709382B29139700199889 /* Pulse */; };
|
||||
@ -41,6 +40,7 @@
|
||||
3DAFA8EA2B39039900D71AD1 /* JellyfinKitExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DAFA8E92B39039900D71AD1 /* JellyfinKitExtensions.swift */; };
|
||||
3DAFA8EC2B394F9F00D71AD1 /* ViewConditionalMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DAFA8EB2B394F9F00D71AD1 /* ViewConditionalMethod.swift */; };
|
||||
3DAFA8EF2B3B707B00D71AD1 /* ItemMovieView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DAFA8EE2B3B707B00D71AD1 /* ItemMovieView.swift */; };
|
||||
3DBAC9E22B4C31BE005F8764 /* ItemPeopleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DBAC9E12B4C31BE005F8764 /* ItemPeopleView.swift */; };
|
||||
3DC6BA2D2B2A422300416B9F /* SettingsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DC6BA2C2B2A422300416B9F /* SettingsController.swift */; };
|
||||
3DDD67932B293BC40026781E /* DashboardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DDD67922B293BC40026781E /* DashboardView.swift */; };
|
||||
3DDD67962B29E28B0026781E /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DDD67952B29E28B0026781E /* SettingsView.swift */; };
|
||||
@ -88,7 +88,6 @@
|
||||
3D13F96E2B38A32500E91913 /* StickyHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickyHeaderView.swift; sourceTree = "<group>"; };
|
||||
3D16FC3B2B2CDFB500E6D8B3 /* DashboardLibraryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashboardLibraryView.swift; sourceTree = "<group>"; };
|
||||
3D3816C82B4B5648006414D7 /* ItemGenresView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemGenresView.swift; sourceTree = "<group>"; };
|
||||
3D41D1F42B2C962500E58234 /* AppearancePicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppearancePicker.swift; sourceTree = "<group>"; };
|
||||
3D41D1F92B2CAE0000E58234 /* ItemIconView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemIconView.swift; sourceTree = "<group>"; };
|
||||
3D4C15712B3CAA670035373E /* DashboardSectionTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashboardSectionTitleView.swift; sourceTree = "<group>"; };
|
||||
3D8AB2A42B36440D005BD7D0 /* BlurHashDecode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlurHashDecode.swift; sourceTree = "<group>"; };
|
||||
@ -111,6 +110,7 @@
|
||||
3DAFA8E92B39039900D71AD1 /* JellyfinKitExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JellyfinKitExtensions.swift; sourceTree = "<group>"; };
|
||||
3DAFA8EB2B394F9F00D71AD1 /* ViewConditionalMethod.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewConditionalMethod.swift; sourceTree = "<group>"; };
|
||||
3DAFA8EE2B3B707B00D71AD1 /* ItemMovieView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemMovieView.swift; sourceTree = "<group>"; };
|
||||
3DBAC9E12B4C31BE005F8764 /* ItemPeopleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemPeopleView.swift; sourceTree = "<group>"; };
|
||||
3DC0E5802B2832B9001CCE96 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
3DC6BA2C2B2A422300416B9F /* SettingsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsController.swift; sourceTree = "<group>"; };
|
||||
3DDD67922B293BC40026781E /* DashboardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashboardView.swift; sourceTree = "<group>"; };
|
||||
@ -193,6 +193,7 @@
|
||||
3DAFA8E72B38AFED00D71AD1 /* ItemInfoView.swift */,
|
||||
3D13F9642B37EC7A00E91913 /* ItemHeaderView.swift */,
|
||||
3D3816C82B4B5648006414D7 /* ItemGenresView.swift */,
|
||||
3DBAC9E12B4C31BE005F8764 /* ItemPeopleView.swift */,
|
||||
);
|
||||
path = Item;
|
||||
sourceTree = "<group>";
|
||||
@ -308,7 +309,6 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3DDD67952B29E28B0026781E /* SettingsView.swift */,
|
||||
3D41D1F42B2C962500E58234 /* AppearancePicker.swift */,
|
||||
);
|
||||
path = Settings;
|
||||
sourceTree = "<group>";
|
||||
@ -483,7 +483,7 @@
|
||||
3D1015E42B28000E00F5C29A /* AuthStateController.swift in Sources */,
|
||||
3D13F95F2B375DB800E91913 /* ItemView.swift in Sources */,
|
||||
3DDD67962B29E28B0026781E /* SettingsView.swift in Sources */,
|
||||
3D41D1F52B2C962500E58234 /* AppearancePicker.swift in Sources */,
|
||||
3DBAC9E22B4C31BE005F8764 /* ItemPeopleView.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -7,38 +7,14 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
enum AppearanceState: Int, CaseIterable, Identifiable, CustomStringConvertible {
|
||||
case automatic
|
||||
case light
|
||||
case dark
|
||||
|
||||
var id: Self { self }
|
||||
|
||||
var description: String {
|
||||
switch self {
|
||||
case .light:
|
||||
return "Light"
|
||||
case .dark:
|
||||
return "Dark"
|
||||
case .automatic:
|
||||
return "Automatic"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SettingsController: ObservableObject {
|
||||
static let shared: SettingsController = SettingsController()
|
||||
|
||||
@Published var appearance: AppearanceState = .automatic
|
||||
|
||||
private let defaults = UserDefaults.standard
|
||||
|
||||
func save() {
|
||||
defaults.set(self.appearance.rawValue, forKey: "Settings_appearance")
|
||||
}
|
||||
|
||||
func load() {
|
||||
let oldAppearance = defaults.integer(forKey: "Settings_appearance")
|
||||
self.appearance = AppearanceState(rawValue: oldAppearance) ?? .automatic
|
||||
}
|
||||
}
|
||||
|
@ -25,19 +25,9 @@ struct ContentView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.preferredColorScheme({
|
||||
switch settingsController.appearance {
|
||||
case .dark:
|
||||
return ColorScheme.dark
|
||||
case .light:
|
||||
return ColorScheme.light
|
||||
case .automatic:
|
||||
return .none
|
||||
}
|
||||
}())
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
ContentView()
|
||||
}
|
||||
//#Preview {
|
||||
// ContentView()
|
||||
//}
|
||||
|
@ -33,6 +33,7 @@ struct DashboardLibraryView: View {
|
||||
} label: {
|
||||
ItemIconView(item: library, height: 150)
|
||||
.setAspectRatio(library.primaryImageAspectRatio)
|
||||
.showCaption()
|
||||
}
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
}
|
||||
|
@ -11,11 +11,13 @@ import JellyfinKit
|
||||
struct ItemHeaderView: View {
|
||||
var item: BaseItemDto
|
||||
|
||||
let overlayGradient = LinearGradient(gradient: Gradient(stops: [
|
||||
let overlayGradientMask = LinearGradient(gradient: Gradient(stops: [
|
||||
.init(color: .clear, location: 0),
|
||||
.init(color: .black, location: 0.5),
|
||||
// .init(color: .black, location: 0.7),
|
||||
// .init(color: .clear, location: 1)
|
||||
.init(color: .black, location: 0.3),
|
||||
]), startPoint: .bottom, endPoint: .top)
|
||||
let overlayGradient = LinearGradient(gradient: Gradient(stops: [
|
||||
.init(color: .black, location: 0),
|
||||
.init(color: .clear, location: 0.5)
|
||||
]), startPoint: .bottom, endPoint: .top)
|
||||
|
||||
var body: some View {
|
||||
@ -23,12 +25,8 @@ struct ItemHeaderView: View {
|
||||
StickyHeaderView(minHeight: 300) {
|
||||
ItemIconView(item: item, imageType: "Backdrop", contentMode: .fill)
|
||||
.setCornerRadius(0)
|
||||
.mask(overlayGradient)
|
||||
.background {
|
||||
ItemIconView(item: item, imageType: "Backdrop", contentMode: .fill)
|
||||
.setCornerRadius(0)
|
||||
.blur(radius: 50)
|
||||
}
|
||||
.overlay(overlayGradient.opacity(0.8))
|
||||
.mask(overlayGradientMask)
|
||||
}
|
||||
|
||||
HStack {
|
||||
@ -38,7 +36,6 @@ struct ItemHeaderView: View {
|
||||
.frame(alignment: .leading)
|
||||
Spacer()
|
||||
ItemInfoView(item: item)
|
||||
.foregroundStyle(.white)
|
||||
}
|
||||
.padding([.leading, .trailing])
|
||||
}
|
||||
|
@ -15,15 +15,24 @@ struct ItemInfoView: View {
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Text((item.productionYear != nil) ? String(item.productionYear!) : "---")
|
||||
.shadow(color: .black, radius: 1)
|
||||
Text("•")
|
||||
.shadow(color: .black, radius: 1)
|
||||
Text(item.genres?.first ?? "---")
|
||||
.shadow(color: .black, radius: 1)
|
||||
}
|
||||
if item.type == .movie {
|
||||
Text(item.getRuntime() ?? "-:--")
|
||||
.shadow(color: .black, radius: 1)
|
||||
|
||||
HStack {
|
||||
if item.type == .movie {
|
||||
Text(item.getRuntime() ?? "-:--")
|
||||
}
|
||||
if let officialRating = item.officialRating {
|
||||
Text(officialRating)
|
||||
.bold()
|
||||
.padding(2)
|
||||
.overlay {
|
||||
RoundedRectangle(cornerSize: CGSize(width: 2, height: 2), style: .continuous)
|
||||
.stroke(.gray)
|
||||
}
|
||||
.foregroundStyle(.gray)
|
||||
}
|
||||
}
|
||||
}
|
||||
.font(.caption)
|
||||
|
27
Jel/Views/Library/Item/ItemPeopleView.swift
Normal file
27
Jel/Views/Library/Item/ItemPeopleView.swift
Normal file
@ -0,0 +1,27 @@
|
||||
//
|
||||
// ItemPeopleView.swift
|
||||
// Jel
|
||||
//
|
||||
// Created by zerocool on 1/8/24.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import JellyfinKit
|
||||
|
||||
struct ItemPeopleView: View {
|
||||
var item: BaseItemDto
|
||||
|
||||
var body: some View {
|
||||
ScrollView(.horizontal) {
|
||||
HStack {
|
||||
ForEach(item.people ?? []) {person in
|
||||
Text(person.name ?? "---")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#Preview {
|
||||
// ItemPeopleView()
|
||||
//}
|
@ -9,7 +9,8 @@ import SwiftUI
|
||||
import JellyfinKit
|
||||
|
||||
struct ItemMovieView: View {
|
||||
@State var item: BaseItemDto
|
||||
var item: BaseItemDto
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
ItemMediaView(item: item) {
|
||||
@ -18,7 +19,10 @@ struct ItemMovieView: View {
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
}
|
||||
|
||||
ItemPeopleView(item: item)
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,8 @@ struct LibraryDetailView: View {
|
||||
.genres,
|
||||
.taglines,
|
||||
.overview,
|
||||
.parentID]
|
||||
.parentID,
|
||||
.people]
|
||||
)
|
||||
let request = Paths.getItems(parameters: params)
|
||||
|
||||
|
@ -1,25 +0,0 @@
|
||||
//
|
||||
// AppearancePicker.swift
|
||||
// Jel
|
||||
//
|
||||
// Created by zerocool on 12/15/23.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct AppearancePicker: View {
|
||||
@ObservedObject var settingsController: SettingsController = SettingsController.shared
|
||||
|
||||
var body: some View {
|
||||
Picker("Appearance", selection: $settingsController.appearance) {
|
||||
ForEach(AppearanceState.allCases) { option in
|
||||
Text(String(describing: option))
|
||||
}
|
||||
}
|
||||
.pickerStyle(.menu)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
AppearancePicker()
|
||||
}
|
@ -43,12 +43,6 @@ struct SettingsView: View {
|
||||
Text("Current User")
|
||||
}
|
||||
|
||||
Section() {
|
||||
AppearancePicker()
|
||||
} header: {
|
||||
Text("Accessibility")
|
||||
}
|
||||
|
||||
Section() {
|
||||
NavigationLink {
|
||||
ConsoleView()
|
||||
@ -72,16 +66,6 @@ struct SettingsView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.preferredColorScheme({
|
||||
switch settingsController.appearance {
|
||||
case .dark:
|
||||
return ColorScheme.dark
|
||||
case .light:
|
||||
return ColorScheme.light
|
||||
case .automatic:
|
||||
return .none
|
||||
}
|
||||
}())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user