summaryrefslogtreecommitdiff
path: root/Jel/Views/Item/Series/ItemSeriesEpisodeIconView.swift
blob: fea89975625d829eb69a1e9f973515a8bd268004 (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
//
//  ItemSeriesEpisodeIconView.swift
//  Jel
//
//  Created by zerocool on 2/14/24.
//

import SwiftUI
import JellyfinKit
import ExpandableText

struct ItemSeriesEpisodeIconView: View {
  var item: BaseItemDto
  
  var body: some View {
    HStack(alignment: .top) {
      VStack(alignment: .leading) {
        Text("Episode \(item.indexNumber ?? 0)")
          .foregroundStyle(Color.secondary)
          .font(.callout)
        ItemIconView(item: item, width: UIScreen.screenWidth * 0.5, contentMode: .fill)
          .setAspectRatio(item.primaryImageAspectRatio ?? 1.7)
      }
      .frame(width: UIScreen.screenWidth * 0.5)
      
      VStack(alignment: .leading) {
        Text(item.name ?? "Episode \(item.indexNumber ?? 0)")
          .font(.callout)
          .bold()
        Text(item.overview ?? "")
          .frame(height: (UIScreen.screenWidth * 0.5) / (item.primaryImageAspectRatio ?? 1.7)) // Calculate optimal amount of lines based on episode image
      }
    }
  }
}

//#Preview {
//    ItemSeriesEpisodeIconView()
//}