summaryrefslogtreecommitdiff
path: root/Jel/Views/Library/LibraryIconView.swift
blob: e5f42b0b523bb085ff96252d44c3d4627789e896 (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
//
//  LibraryIconView.swift
//  Jel
//
//  Created by zerocool on 12/15/23.
//

import SwiftUI
import JellyfinKit

struct LibraryIconView: View {
  @EnvironmentObject var jellyfinClient: JellyfinClientController
  
  @State var library: BaseItemDto
  
  @State var loadingImage: Bool = true
  @State var imageType: String = "Primary"
  var width: CGFloat?
  var height: CGFloat?
  
  @State var loadedImageBinaryData: Data?
  
  var body: some View {
    VStack {
      AsyncImageView(imageId: library.id ?? "",
                     blurhash: library.imageBlurHashes?.primary?[library.imageTags?[imageType] ?? ""] ?? "",
                     imageType: imageType)
      .aspectRatio(contentMode: .fill)
      .frame(width: width, height: height)
      .clipShape(RoundedRectangle(cornerRadius: 5))
      
      
      Text(library.name ?? "Unknown")
        .font(.subheadline)
    }
  }
}

//#Preview {
//  LibraryIconView(library: BaseItemDto())
//}