summaryrefslogtreecommitdiff
path: root/Sora/Views/Settings/Section/SettingsThumbnailsView.swift
blob: 9e4c856a37fc718b26216bc90ca190e22b098f99 (plain) (blame)
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
import SwiftUI

struct SettingsThumbnailsView: View {
  @EnvironmentObject var settings: SettingsManager
  @State private var isShowingContentFiltering = false

  var body: some View {
    Picker("Thumbnail Quality", selection: $settings.thumbnailQuality) {
      ForEach(BooruPostFileType.allCases, id: \.self) { type in
        Text(type.rawValue.capitalized).tag(type)
      }
    }

    #if os(macOS)
      Picker("Thumbnail Grid Columns", selection: $settings.thumbnailGridColumns) {
        ForEach(1...10, id: \.self) { columns in Text("\(columns)") }
      }
    #else
      Stepper(
        "Thumbnail Grid Columns: \(settings.thumbnailGridColumns)",
        value: $settings.thumbnailGridColumns,
        in: 1...10
      )
    #endif

    Toggle("Lazy Thumbnail Loading", isOn: $settings.alternativeThumbnailGrid)

    #if os(macOS)
      Button("Content Filtering") {
        isShowingContentFiltering.toggle()
      }
      .sheet(isPresented: $isShowingContentFiltering) {
        SettingsContentRatingsView()
          .frame(minHeight: 250)
      }
      .trailingFrame()
    #else
      NavigationLink(destination: SettingsContentRatingsView()) {
        Text("Content Filtering")
      }
    #endif
  }
}