Implement peopleView

This commit is contained in:
Shav Kinderlehrer 2024-01-11 20:44:49 -05:00
parent 6edc39791a
commit 6b8d3372d2
12 changed files with 47 additions and 20 deletions

View File

@ -161,6 +161,7 @@
3D13F96D2B38A31300E91913 /* Utility */,
3D9063CC2B279A310063DD2A /* ContentView.swift */,
3DDD67902B293B780026781E /* Dashboard */,
3D13F95D2B375DAC00E91913 /* Item */,
3D8AB2A62B366309005BD7D0 /* Library */,
3DDD67942B29E27A0026781E /* Settings */,
3D91FDC52B28C28900919017 /* SignIn */,
@ -194,6 +195,7 @@
3D13F95D2B375DAC00E91913 /* Item */ = {
isa = PBXGroup;
children = (
3D41D1F92B2CAE0000E58234 /* ItemIconView.swift */,
3DAFA8ED2B3B707100D71AD1 /* Types */,
3DBAC9E82B4C891C005F8764 /* Person */,
3D13F95E2B375DB800E91913 /* ItemView.swift */,
@ -217,8 +219,6 @@
3D8AB2A62B366309005BD7D0 /* Library */ = {
isa = PBXGroup;
children = (
3D13F95D2B375DAC00E91913 /* Item */,
3D41D1F92B2CAE0000E58234 /* ItemIconView.swift */,
3D8AB2A72B366353005BD7D0 /* LibraryDetailView.swift */,
);
path = Library;

View File

@ -7,7 +7,7 @@
<key>Jel.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
<key>JellyfinClient.xcscheme_^#shared#^_</key>
<dict>

View File

@ -21,7 +21,6 @@ struct ItemMediaView: View {
Text(item.taglines?.count ?? 0 > 0 ? item.taglines?[0] ?? "" : "")
.font(.headline)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.bottom)
ForEach(item.overview?.components(separatedBy: "<br>") ?? [], id: \.self) {overview in
Text(overview)

View File

@ -20,9 +20,18 @@ struct ItemPeopleView: View {
.padding(.leading)
ScrollView(.horizontal) {
LazyHStack(alignment: .top) {
// FIXME: For some reason, a LazyHStack clips the text for this view
HStack(alignment: .top) {
ForEach(item.people ?? [], id: \.iterId) {person in
NavigationLink {
VStack {
ItemPersonIconView(person: person)
Text("Subview")
}
.navigationTitle(person.name ?? "Unnamed")
} label: {
ItemPersonIconView(person: person)
}
}
}
.padding(.horizontal)

View File

@ -11,12 +11,16 @@ import NukeUI
struct ItemPersonIconPlaceholderView: View {
var body: some View {
VStack {
Image(systemName: "person")
ZStack {
Color(uiColor: UIColor.secondarySystemBackground)
Image(systemName: "person.fill")
.resizable()
.aspectRatio(contentMode: .fit)
.padding()
.scaledToFit()
.foregroundStyle(Color(uiColor: UIColor.secondarySystemFill))
}
.frame(height: 150)
.clipShape(RoundedRectangle(cornerRadius: 5))
}
}
@ -27,39 +31,40 @@ struct ItemPersonIconView: View {
var person: BaseItemPerson
@State var personImageUrl: URL?
@State var loading: Bool = true
var body: some View {
VStack() {
VStack {
LazyImage(url: personImageUrl) {state in
if let image = state.image {
image
.resizable()
.aspectRatio(contentMode: .fit)
.clipShape(RoundedRectangle(cornerRadius: 5))
} else {
ItemPersonIconPlaceholderView()
}
}
.aspectRatio(contentMode: .fit)
.frame(width: 100, height: 170)
.frame(height: 170)
VStack {
VStack(alignment: .leading) {
Text(person.name ?? "---")
.font(.callout)
.font(.footnote)
.lineLimit(nil)
Text(person.role ?? "---")
.font(.caption)
.foregroundStyle(.gray)
.foregroundStyle(Color(uiColor: UIColor.secondaryLabel))
.fixedSize(horizontal: false, vertical: true)
.lineLimit(nil)
}
.multilineTextAlignment(.leading)
}
.frame(width: 100)
}
// .redacted(reason: loading ? .placeholder : [])
.onAppear {
Task {
let request = Paths.getItemImage(itemID: person.id ?? "", imageType: "Primary")
let serverUrl = jellyfinClient.getUrl()
personImageUrl = serverUrl?.appending(path: request.url?.absoluteString ?? "")
// loading = false
}
}
}

View File

@ -23,7 +23,7 @@ struct ItemMovieView: View {
.onChange(of: geo.frame(in: .global).minY) {
let minY = geo.frame(in: .global).minY
pageScrolled = minY < -100
pageScrolled = minY < -150
}
}
}
@ -32,8 +32,12 @@ struct ItemMovieView: View {
.padding()
ItemGenresView(item: item)
.padding(.bottom)
.foregroundStyle(Color.primary)
ItemPeopleView(item: item)
.padding(.bottom)
.foregroundStyle(Color.primary)
}
.navigationBarTitleDisplayMode(.inline)
.navigationTitle(item.name ?? "Untitled")

10
TODO.txt Normal file
View File

@ -0,0 +1,10 @@
===
TODO
- Implement play button
===
DONE
- Use Color.seondaryLabel for gray text
- Fix text wrapping on ItemPersonIconView