bugfixes, add year and rating to items
This commit is contained in:
parent
64c0df33ec
commit
992361a1cf
|
@ -57,6 +57,22 @@ struct PortraitItemElement: View {
|
||||||
.opacity(1), alignment: .topTrailing).opacity(1)
|
.opacity(1), alignment: .topTrailing).opacity(1)
|
||||||
Text(item.title)
|
Text(item.title)
|
||||||
.frame(width: 200, height: 30, alignment: .center)
|
.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
|
.onChange(of: envFocused) { envFocus in
|
||||||
withAnimation(.linear(duration: 0.15)) {
|
withAnimation(.linear(duration: 0.15)) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ struct ContinueWatchingView: View {
|
||||||
}
|
}
|
||||||
Spacer().frame(width: 45)
|
Spacer().frame(width: 45)
|
||||||
}
|
}
|
||||||
}.frame(height: 330)
|
}.frame(height: 350)
|
||||||
} else {
|
} else {
|
||||||
EmptyView()
|
EmptyView()
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ struct LatestMediaView: View {
|
||||||
}
|
}
|
||||||
Spacer().frame(width: 45)
|
Spacer().frame(width: 45)
|
||||||
}
|
}
|
||||||
}.frame(height: 396)
|
}.frame(height: 480)
|
||||||
.onAppear(perform: onAppear)
|
.onAppear(perform: onAppear)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,8 +87,11 @@ struct LibraryView: View {
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
.ignoresSafeArea(.all)
|
.ignoresSafeArea(.all)
|
||||||
} else {
|
} else {
|
||||||
Button { } label: {
|
VStack {
|
||||||
Text("No results.")
|
Text("No results.")
|
||||||
|
Button { } label: {
|
||||||
|
Text("Reload")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,14 @@ struct MovieLibrariesView: View {
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
.ignoresSafeArea(.all)
|
.ignoresSafeArea(.all)
|
||||||
} else {
|
} else {
|
||||||
|
VStack {
|
||||||
Text("No results.")
|
Text("No results.")
|
||||||
|
Button {
|
||||||
|
print("movieLibraries reload")
|
||||||
|
} label: {
|
||||||
|
Text("Reload")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ struct NextUpView: View {
|
||||||
}
|
}
|
||||||
Spacer().frame(width: 45)
|
Spacer().frame(width: 45)
|
||||||
}
|
}
|
||||||
}.frame(height: 330)
|
}.frame(height: 350)
|
||||||
.offset(y: -10)
|
.offset(y: -10)
|
||||||
} else {
|
} else {
|
||||||
EmptyView()
|
EmptyView()
|
||||||
|
|
|
@ -56,7 +56,9 @@ struct TVLibrariesView: View {
|
||||||
GeometryReader { _ in
|
GeometryReader { _ in
|
||||||
if let item = cell.item {
|
if let item = cell.item {
|
||||||
if item.type != "Folder" {
|
if item.type != "Folder" {
|
||||||
Button {} label: {
|
Button {
|
||||||
|
self.tvLibrariesRouter.route(to: \.library, item)
|
||||||
|
} label: {
|
||||||
PortraitItemElement(item: item)
|
PortraitItemElement(item: item)
|
||||||
}
|
}
|
||||||
.buttonStyle(PlainNavigationLinkButtonStyle())
|
.buttonStyle(PlainNavigationLinkButtonStyle())
|
||||||
|
@ -74,7 +76,14 @@ struct TVLibrariesView: View {
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
.ignoresSafeArea(.all)
|
.ignoresSafeArea(.all)
|
||||||
} else {
|
} else {
|
||||||
|
VStack {
|
||||||
Text("No results.")
|
Text("No results.")
|
||||||
|
Button {
|
||||||
|
print("tvLibraries reload")
|
||||||
|
} label: {
|
||||||
|
Text("Reload")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,12 +51,10 @@ final class MovieLibrariesViewModel: ViewModel {
|
||||||
self.libraries.append(library)
|
self.libraries.append(library)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
self.rows = self.calculateRows()
|
||||||
if self.libraries.count == 1, let library = self.libraries.first {
|
if self.libraries.count == 1, let library = self.libraries.first {
|
||||||
// show library
|
// show library
|
||||||
self.router?.route(to: \.library, 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]()
|
var rowCells = [LibraryRowCell]()
|
||||||
for item in libraries[firstItemIndex..<lastItemIndex] {
|
for item in libraries[firstItemIndex..<lastItemIndex] {
|
||||||
print("item: \(item.title) index: \(i)")
|
|
||||||
let newCell = LibraryRowCell(item: item)
|
let newCell = LibraryRowCell(item: item)
|
||||||
rowCells.append(newCell)
|
rowCells.append(newCell)
|
||||||
}
|
}
|
||||||
|
@ -93,7 +90,6 @@ final class MovieLibrariesViewModel: ViewModel {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
print("caluculated \(calculatedRows.count) rows")
|
|
||||||
return calculatedRows
|
return calculatedRows
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,12 +51,10 @@ final class TVLibrariesViewModel: ViewModel {
|
||||||
self.libraries.append(library)
|
self.libraries.append(library)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
self.rows = self.calculateRows()
|
||||||
if self.libraries.count == 1, let library = self.libraries.first {
|
if self.libraries.count == 1, let library = self.libraries.first {
|
||||||
// show library
|
// show library
|
||||||
self.router?.route(to: \.library, 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]()
|
var rowCells = [LibraryRowCell]()
|
||||||
for item in libraries[firstItemIndex..<lastItemIndex] {
|
for item in libraries[firstItemIndex..<lastItemIndex] {
|
||||||
print("item: \(item.title) index: \(i)")
|
|
||||||
let newCell = LibraryRowCell(item: item)
|
let newCell = LibraryRowCell(item: item)
|
||||||
rowCells.append(newCell)
|
rowCells.append(newCell)
|
||||||
}
|
}
|
||||||
|
@ -93,7 +90,6 @@ final class TVLibrariesViewModel: ViewModel {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
print("caluculated \(calculatedRows.count) rows")
|
|
||||||
return calculatedRows
|
return calculatedRows
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue