we can scroll now!

This commit is contained in:
Aiden Vigue 2021-05-24 16:44:06 -04:00
parent 92acfab287
commit fc7b0efc4c
2 changed files with 112 additions and 108 deletions

View File

@ -125,70 +125,72 @@ struct LibrarySearchView: View {
.foregroundColor(Color.secondary) .foregroundColor(Color.secondary)
.textFieldStyle(RoundedBorderTextFieldStyle()) .textFieldStyle(RoundedBorderTextFieldStyle())
LoadingView(isShowing: $isLoading) { LoadingView(isShowing: $isLoading) {
LazyVGrid(columns: tracks) { ScrollView(.vertical) {
ForEach(items, id: \.Id) { item in LazyVGrid(columns: tracks) {
Button() { ForEach(items, id: \.Id) { item in
_linkedItem.wrappedValue = item; Button() {
_close.wrappedValue = false; _linkedItem.wrappedValue = item;
_open.wrappedValue = true; _close.wrappedValue = false;
} label: { _open.wrappedValue = true;
VStack(alignment: .leading) { } label: {
if(item.Type == "Movie") { VStack(alignment: .leading) {
WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(item.Id)/Images/\(item.ImageType)?fillWidth=300&fillHeight=450&quality=90&tag=\(item.Image)")) if(item.Type == "Movie") {
.resizable() WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(item.Id)/Images/\(item.ImageType)?fillWidth=300&fillHeight=450&quality=90&tag=\(item.Image)"))
.placeholder { .resizable()
Image(uiImage: UIImage(blurHash: (item.BlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : item.BlurHash), size: CGSize(width: 32, height: 32))!) .placeholder {
.resizable() Image(uiImage: UIImage(blurHash: (item.BlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : item.BlurHash), size: CGSize(width: 32, height: 32))!)
.frame(width: 100, height: 150) .resizable()
.cornerRadius(10) .frame(width: 100, height: 150)
} .cornerRadius(10)
.frame(width:100, height: 150) }
.cornerRadius(10) .frame(width:100, height: 150)
.shadow(radius: 5) .cornerRadius(10)
} else { .shadow(radius: 5)
WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(item.Id)/Images/\(item.ImageType)?fillWidth=300&fillHeight=450&quality=90&tag=\(item.Image)")) } else {
.resizable() WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(item.Id)/Images/\(item.ImageType)?fillWidth=300&fillHeight=450&quality=90&tag=\(item.Image)"))
.placeholder { .resizable()
Image(uiImage: UIImage(blurHash: (item.BlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : item.BlurHash), size: CGSize(width: 32, height: 32))!) .placeholder {
.resizable() Image(uiImage: UIImage(blurHash: (item.BlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : item.BlurHash), size: CGSize(width: 32, height: 32))!)
.frame(width: 100, height: 150) .resizable()
.cornerRadius(10) .frame(width: 100, height: 150)
} .cornerRadius(10)
.frame(width:100, height: 150) }
.cornerRadius(10).overlay( .frame(width:100, height: 150)
ZStack { .cornerRadius(10).overlay(
if(item.ItemBadge == 0) { ZStack {
Image(systemName: "checkmark") if(item.ItemBadge == 0) {
.font(.caption) Image(systemName: "checkmark")
.padding(3) .font(.caption)
.foregroundColor(.white) .padding(3)
} else { .foregroundColor(.white)
Text("\(String(item.ItemBadge ?? 0))") } else {
.font(.caption) Text("\(String(item.ItemBadge ?? 0))")
.padding(3) .font(.caption)
.foregroundColor(.white) .padding(3)
} .foregroundColor(.white)
}.background(Color.black) }
.opacity(0.8) }.background(Color.black)
.cornerRadius(10.0) .opacity(0.8)
.padding(3), alignment: .topTrailing .cornerRadius(10.0)
) .padding(3), alignment: .topTrailing
.shadow(radius: 5) )
} .shadow(radius: 5)
Text(item.Name) }
.font(.caption) Text(item.Name)
.fontWeight(.semibold) .font(.caption)
.foregroundColor(.primary) .fontWeight(.semibold)
.lineLimit(1) .foregroundColor(.primary)
Text(String(item.ProductionYear)) .lineLimit(1)
.foregroundColor(.secondary) Text(String(item.ProductionYear))
.font(.caption) .foregroundColor(.secondary)
.fontWeight(.medium) .font(.caption)
}.frame(width: 100) .fontWeight(.medium)
}.frame(width: 100)
}
} }
}.onChange(of: isPortrait) { ip in
recalcTracks()
} }
}.onChange(of: isPortrait) { ip in
recalcTracks()
} }
} }
}.onAppear(perform: onAppear) }.onAppear(perform: onAppear)

View File

@ -91,55 +91,57 @@ struct SeriesItemView: View {
var body: some View { var body: some View {
LoadingView(isShowing: $isLoading) { LoadingView(isShowing: $isLoading) {
LazyVGrid(columns: tracks) { ScrollView(.vertical) {
ForEach(items, id: \.Id) { item in LazyVGrid(columns: tracks) {
NavigationLink(destination: ItemView(item: item )) { ForEach(items, id: \.Id) { item in
VStack(alignment: .leading) { NavigationLink(destination: ItemView(item: item )) {
WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(item.Id)/Images/\(item.ImageType)?maxWidth=250&quality=90&tag=\(item.Image)")) VStack(alignment: .leading) {
.resizable() WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(item.Id)/Images/\(item.ImageType)?maxWidth=250&quality=90&tag=\(item.Image)"))
.placeholder { .resizable()
Image(uiImage: UIImage(blurHash: (item.BlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : item.BlurHash), size: CGSize(width: 32, height: 32))!) .placeholder {
.resizable() Image(uiImage: UIImage(blurHash: (item.BlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : item.BlurHash), size: CGSize(width: 32, height: 32))!)
.frame(width: 100, height: 150) .resizable()
.cornerRadius(10) .frame(width: 100, height: 150)
}.overlay( .cornerRadius(10)
ZStack { }.overlay(
if(item.ItemBadge == 0) { ZStack {
Image(systemName: "checkmark") if(item.ItemBadge == 0) {
.font(.caption) Image(systemName: "checkmark")
.padding(3) .font(.caption)
.foregroundColor(.white) .padding(3)
} else { .foregroundColor(.white)
Text("\(String(item.ItemBadge ?? 0))") } else {
.font(.caption) Text("\(String(item.ItemBadge ?? 0))")
.padding(3) .font(.caption)
.foregroundColor(.white) .padding(3)
} .foregroundColor(.white)
}.background(Color.black) }
.opacity(0.8) }.background(Color.black)
.cornerRadius(10.0) .opacity(0.8)
.padding(3), alignment: .topTrailing .cornerRadius(10.0)
) .padding(3), alignment: .topTrailing
.frame(width:100, height: 150) )
.cornerRadius(10) .frame(width:100, height: 150)
.shadow(radius: 5) .cornerRadius(10)
Text(item.Name) .shadow(radius: 5)
.font(.caption) Text(item.Name)
.fontWeight(.semibold)
.foregroundColor(.primary)
.lineLimit(1)
if(item.ProductionYear != 0) {
Text(String(item.ProductionYear))
.foregroundColor(.secondary)
.font(.caption) .font(.caption)
.fontWeight(.medium) .fontWeight(.semibold)
} .foregroundColor(.primary)
}.frame(width: 100) .lineLimit(1)
if(item.ProductionYear != 0) {
Text(String(item.ProductionYear))
.foregroundColor(.secondary)
.font(.caption)
.fontWeight(.medium)
}
}.frame(width: 100)
}
} }
Spacer().frame(height: 2)
}.onChange(of: isPortrait) { ip in
recalcTracks()
} }
Spacer().frame(height: 2)
}.onChange(of: isPortrait) { ip in
recalcTracks()
} }
} }
.overrideViewPreference(.unspecified) .overrideViewPreference(.unspecified)