mirror of
https://github.com/yattee/yattee.git
synced 2025-12-22 04:30:20 +00:00
Minor fixes, split files into folders
This commit is contained in:
73
tvOS/Options/OptionsView.swift
Normal file
73
tvOS/Options/OptionsView.swift
Normal file
@@ -0,0 +1,73 @@
|
||||
import Defaults
|
||||
import SwiftUI
|
||||
|
||||
struct OptionsView: View {
|
||||
@EnvironmentObject<NavigationState> private var navigationState
|
||||
|
||||
@Default(.layout) private var layout
|
||||
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
VStack {
|
||||
HStack {
|
||||
Spacer()
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Spacer()
|
||||
|
||||
tabSelectionOptions
|
||||
|
||||
CoverSectionView("View Options") {
|
||||
CoverSectionRowView("Show videos as") { nextLayoutButton }
|
||||
}
|
||||
|
||||
CoverSectionView(divider: false) {
|
||||
CoverSectionRowView("Close View Options") { Button("Close") { dismiss() } }
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.frame(maxWidth: 800)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.background(.thinMaterial)
|
||||
}
|
||||
|
||||
var tabSelectionOptions: some View {
|
||||
VStack {
|
||||
switch navigationState.tabSelection {
|
||||
case .search:
|
||||
SearchOptionsView()
|
||||
|
||||
default:
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var nextLayoutButton: some View {
|
||||
Button(layout.name) {
|
||||
self.layout = layout.next()
|
||||
}
|
||||
.contextMenu {
|
||||
ForEach(ListingLayout.allCases) { layout in
|
||||
Button(layout.name) {
|
||||
Defaults[.layout] = layout
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct OptionsView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
OptionsView()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user