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

View File

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

View File

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

View File

@ -20,9 +20,18 @@ struct ItemPeopleView: View {
.padding(.leading) .padding(.leading)
ScrollView(.horizontal) { 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 ForEach(item.people ?? [], id: \.iterId) {person in
ItemPersonIconView(person: person) NavigationLink {
VStack {
ItemPersonIconView(person: person)
Text("Subview")
}
.navigationTitle(person.name ?? "Unnamed")
} label: {
ItemPersonIconView(person: person)
}
} }
} }
.padding(.horizontal) .padding(.horizontal)

View File

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