bugfixes, add year and rating to items

This commit is contained in:
jhays 2021-10-21 21:18:18 -05:00
parent 64c0df33ec
commit 992361a1cf
9 changed files with 44 additions and 17 deletions

View File

@ -57,6 +57,22 @@ struct PortraitItemElement: View {
.opacity(1), alignment: .topTrailing).opacity(1)
Text(item.title)
.frame(width: 200, height: 30, alignment: .center)
if item.type == "Movie" || item.type == "Series" {
Text("\(String(item.productionYear ?? 0))\(item.officialRating ?? "N/A")")
.foregroundColor(.secondary)
.font(.caption)
.fontWeight(.medium)
} else if item.type == "Season" {
Text("\(item.name ?? "")\(String(item.productionYear ?? 0))")
.foregroundColor(.secondary)
.font(.caption)
.fontWeight(.medium)
} else {
Text("S\(String(item.parentIndexNumber ?? 0)):E\(String(item.indexNumber ?? 0))")
.foregroundColor(.secondary)
.font(.caption)
.fontWeight(.medium)
}
}
.onChange(of: envFocused) { envFocus in
withAnimation(.linear(duration: 0.15)) {

View File

@ -37,7 +37,7 @@ struct ContinueWatchingView: View {
}
Spacer().frame(width: 45)
}
}.frame(height: 330)
}.frame(height: 350)
} else {
EmptyView()
}

View File

@ -48,7 +48,7 @@ struct LatestMediaView: View {
}
Spacer().frame(width: 45)
}
}.frame(height: 396)
}.frame(height: 480)
.onAppear(perform: onAppear)
}
}

View File

@ -87,8 +87,11 @@ struct LibraryView: View {
.frame(maxWidth: .infinity, maxHeight: .infinity)
.ignoresSafeArea(.all)
} else {
Button { } label: {
VStack {
Text("No results.")
Button { } label: {
Text("Reload")
}
}
}
}

View File

@ -76,7 +76,14 @@ struct MovieLibrariesView: View {
.frame(maxWidth: .infinity, maxHeight: .infinity)
.ignoresSafeArea(.all)
} else {
Text("No results.")
VStack {
Text("No results.")
Button {
print("movieLibraries reload")
} label: {
Text("Reload")
}
}
}
}
}

View File

@ -35,7 +35,7 @@ struct NextUpView: View {
}
Spacer().frame(width: 45)
}
}.frame(height: 330)
}.frame(height: 350)
.offset(y: -10)
} else {
EmptyView()

View File

@ -56,7 +56,9 @@ struct TVLibrariesView: View {
GeometryReader { _ in
if let item = cell.item {
if item.type != "Folder" {
Button {} label: {
Button {
self.tvLibrariesRouter.route(to: \.library, item)
} label: {
PortraitItemElement(item: item)
}
.buttonStyle(PlainNavigationLinkButtonStyle())
@ -74,7 +76,14 @@ struct TVLibrariesView: View {
.frame(maxWidth: .infinity, maxHeight: .infinity)
.ignoresSafeArea(.all)
} else {
Text("No results.")
VStack {
Text("No results.")
Button {
print("tvLibraries reload")
} label: {
Text("Reload")
}
}
}
}
}

View File

@ -51,12 +51,10 @@ final class MovieLibrariesViewModel: ViewModel {
self.libraries.append(library)
}
}
self.rows = self.calculateRows()
if self.libraries.count == 1, let library = self.libraries.first {
// show library
self.router?.route(to: \.library, library)
} else {
// display list of libraries
self.rows = self.calculateRows()
}
}
})
@ -76,7 +74,6 @@ final class MovieLibrariesViewModel: ViewModel {
var rowCells = [LibraryRowCell]()
for item in libraries[firstItemIndex..<lastItemIndex] {
print("item: \(item.title) index: \(i)")
let newCell = LibraryRowCell(item: item)
rowCells.append(newCell)
}
@ -93,7 +90,6 @@ final class MovieLibrariesViewModel: ViewModel {
)
)
}
print("caluculated \(calculatedRows.count) rows")
return calculatedRows
}
}

View File

@ -51,12 +51,10 @@ final class TVLibrariesViewModel: ViewModel {
self.libraries.append(library)
}
}
self.rows = self.calculateRows()
if self.libraries.count == 1, let library = self.libraries.first {
// show library
self.router?.route(to: \.library, library)
} else {
// display list of libraries
self.rows = self.calculateRows()
}
}
})
@ -76,7 +74,6 @@ final class TVLibrariesViewModel: ViewModel {
var rowCells = [LibraryRowCell]()
for item in libraries[firstItemIndex..<lastItemIndex] {
print("item: \(item.title) index: \(i)")
let newCell = LibraryRowCell(item: item)
rowCells.append(newCell)
}
@ -93,7 +90,6 @@ final class TVLibrariesViewModel: ViewModel {
)
)
}
print("caluculated \(calculatedRows.count) rows")
return calculatedRows
}
}