mirror of
https://github.com/yattee/yattee.git
synced 2024-12-15 06:40:32 +05:30
73 lines
1.7 KiB
Swift
73 lines
1.7 KiB
Swift
import Defaults
|
|
import SwiftUI
|
|
|
|
struct OptionsView: View {
|
|
@Environment(\.dismiss) private var dismiss
|
|
|
|
@Default(.layout) private var layout
|
|
@Default(.tabSelection) private var tabSelection
|
|
|
|
var body: some View {
|
|
HStack {
|
|
VStack {
|
|
HStack {
|
|
Spacer()
|
|
|
|
VStack(alignment: .leading) {
|
|
Spacer()
|
|
|
|
tabSelectionOptions
|
|
|
|
OptionsSectionView("View Options") {
|
|
OptionRowView("Show videos as") { nextLayoutButton }
|
|
}
|
|
|
|
OptionsSectionView(divider: false) {
|
|
OptionRowView("Close View Options") { Button("Close") { dismiss() } }
|
|
}
|
|
|
|
Spacer()
|
|
}
|
|
.frame(maxWidth: 800)
|
|
|
|
Spacer()
|
|
}
|
|
|
|
Spacer()
|
|
}
|
|
}
|
|
.background(.thinMaterial)
|
|
}
|
|
|
|
var tabSelectionOptions: some View {
|
|
VStack {
|
|
switch 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()
|
|
}
|
|
}
|