jel/Jel/Views/Settings/SettingsView.swift

71 lines
1.5 KiB
Swift
Raw Normal View History

2023-12-15 15:41:00 +00:00
//
// SettingsView.swift
// Jel
//
// Created by zerocool on 12/13/23.
//
import SwiftUI
import PulseUI
struct SettingsView: View {
@Binding var showingSettingsView: Bool
@StateObject var authState: AuthStateController = AuthStateController.shared
@ObservedObject var settingsController: SettingsController = SettingsController.shared
var body: some View {
NavigationStack {
Form {
Section() {
2023-12-15 15:41:00 +00:00
AppearancePicker()
} header: {
Text("Accessibility")
2023-12-15 15:41:00 +00:00
}
Section {
NavigationLink {
ConsoleView()
.closeButtonHidden()
} label: {
Text("Logs")
}
Button(role: .destructive) {
authState.loggedIn = false
authState.save()
} label: {
Text("Sign out")
}
}
}
.navigationTitle("Settings")
.toolbar {
ToolbarItem {
Button {
showingSettingsView.toggle()
settingsController.save()
} label: {
Text("Done")
.bold()
}
}
}
.preferredColorScheme({
switch settingsController.appearance {
case .dark:
return ColorScheme.dark
case .light:
return ColorScheme.light
case .automatic:
return .none
}
}())
}
}
}
#Preview {
SettingsView(showingSettingsView: .constant(true))
}