summaryrefslogtreecommitdiff
path: root/Jel/Views/Item/Types/ItemSeriesView.swift
blob: 3054da6848ee34606233c2d7bd23b84150bd5eee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//
//  ItemSeriesView.swift
//  Jel
//
//  Created by zerocool on 2/12/24.
//

import SwiftUI
import JellyfinKit

struct ItemSeriesView: View {
  var item: BaseItemDto
  
  @State var pageScrolled: Bool = false
  
  var body: some View {
    VStack {
      ItemHeaderView(item: item)
        .foregroundStyle(.white)
        .background {
          GeometryReader {geo in
            EmptyView()
              .onChange(of: geo.frame(in: .global).minY) {
                let minY = geo.frame(in: .global).minY
                
                pageScrolled = minY < -150
              }
          }
        }
      
      ItemMediaView(item: item)
        .padding()
      
      ItemGenresView(item: item)
        .foregroundStyle(Color.primary)
      
      ItemSeriesSelectableEpisodesView(item: item)
      
      ItemSeriesSeasonsView(item: item)
        .foregroundStyle(Color.primary)
      
      ItemPeopleView(item: item)
        .foregroundStyle(Color.primary)
    }
    .navigationBarTitleDisplayMode(.inline)
    .navigationTitle(item.name ?? "Untitled")
    .toolbarRole(.editor)
    .toolbar {
      ToolbarItem(placement: .principal) {
        Text(pageScrolled ? item.name ?? "Untitled" : "")
          .bold()
      }
    }
    .toolbarBackground(pageScrolled ? .visible : .hidden)
  }
}

//#Preview {
//    ItemShowView()
//}