jellyflood/JellyfinPlayer/SeriesItemView.swift
Aiden Vigue 19c5e3e4c8
Consolidate item views.
Add watched badges
Add remaining episode badges
Add favorite badges.
Fix genres to only show genres from current library.
Show watched episodes in series view.
Add progress bar to currently watching items in library.
Fix showing favorites.
2021-06-26 15:04:57 -04:00

40 lines
1.3 KiB
Swift

/* JellyfinPlayer/Swiftfin is subject to the terms of the Mozilla Public
* License, v2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* Copyright 2021 Aiden Vigue & Jellyfin Contributors
*/
import SwiftUI
struct SeriesItemView: View {
@StateObject var viewModel: SeriesItemViewModel
@State private var tracks: [GridItem] = Array(repeating: .init(.flexible()), count: Int(UIScreen.main.bounds.size.width) / 125)
func recalcTracks() {
tracks = Array(repeating: .init(.flexible()), count: Int(UIScreen.main.bounds.size.width) / 125)
}
var body: some View {
if viewModel.isLoading {
ProgressView()
} else {
ScrollView(.vertical) {
Spacer().frame(height: 16)
LazyVGrid(columns: tracks) {
ForEach(viewModel.seasons, id: \.id) { season in
PortraitItemView(item: season)
}
Spacer().frame(height: 2)
}.onRotate { _ in
recalcTracks()
}
}
.overrideViewPreference(.unspecified)
.navigationTitle(viewModel.item.name ?? "")
.navigationBarTitleDisplayMode(.inline)
}
}
}