summaryrefslogtreecommitdiff
path: root/Jel/Views/Settings/SettingsView.swift
diff options
context:
space:
mode:
Diffstat (limited to 'Jel/Views/Settings/SettingsView.swift')
-rw-r--r--Jel/Views/Settings/SettingsView.swift68
1 files changed, 68 insertions, 0 deletions
diff --git a/Jel/Views/Settings/SettingsView.swift b/Jel/Views/Settings/SettingsView.swift
new file mode 100644
index 0000000..6eaa2e2
--- /dev/null
+++ b/Jel/Views/Settings/SettingsView.swift
@@ -0,0 +1,68 @@
+//
+// 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 {
+ AppearancePicker()
+ }
+
+ 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))
+}