SettingsRootView.swift 4.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import SwiftUI
  2. extension Settings {
  3. struct RootView: BaseView {
  4. @EnvironmentObject var viewModel: ViewModel<Provider>
  5. var body: some View {
  6. Form {
  7. Section(header: Text("FreeAPS X")) {
  8. Toggle("Closed loop", isOn: $viewModel.closedLoop)
  9. }
  10. Section(header: Text("Devices")) {
  11. Text("Pump").chevronCell().navigationLink(to: .pumpConfig, from: self)
  12. }
  13. Section(header: Text("Services")) {
  14. Text("Nightscout").chevronCell().navigationLink(to: .nighscoutConfig, from: self)
  15. }
  16. Section(header: Text("Configuration")) {
  17. Text("Pump Settings").chevronCell().navigationLink(to: .pumpSettingsEditor, from: self)
  18. Text("Basal Profile").chevronCell().navigationLink(to: .basalProfileEditor, from: self)
  19. Text("Insulin Sensitivities").chevronCell().navigationLink(to: .isfEditor, from: self)
  20. Text("Carb Ratios").chevronCell().navigationLink(to: .crEditor, from: self)
  21. Text("Target Ranges").chevronCell().navigationLink(to: .targetsEditor, from: self)
  22. Text("Preferences").chevronCell().navigationLink(to: .preferencesEditor, from: self)
  23. Text("Autotune").chevronCell().navigationLink(to: .autotuneConfig, from: self)
  24. }
  25. Section(header: Text("Config files")) {
  26. Group {
  27. Text("Preferences").chevronCell()
  28. .navigationLink(to: .configEditor(file: OpenAPS.Settings.preferences), from: self)
  29. Text("Pump Settings").chevronCell()
  30. .navigationLink(to: .configEditor(file: OpenAPS.Settings.settings), from: self)
  31. Text("Autosense").chevronCell()
  32. .navigationLink(to: .configEditor(file: OpenAPS.Settings.autosense), from: self)
  33. Text("Pump History").chevronCell()
  34. .navigationLink(to: .configEditor(file: OpenAPS.Monitor.pumpHistory), from: self)
  35. Text("Basal profile").chevronCell()
  36. .navigationLink(to: .configEditor(file: OpenAPS.Settings.basalProfile), from: self)
  37. Text("Targets ranges").chevronCell()
  38. .navigationLink(to: .configEditor(file: OpenAPS.Settings.bgTargets), from: self)
  39. Text("Carb ratios").chevronCell()
  40. .navigationLink(to: .configEditor(file: OpenAPS.Settings.carbRatios), from: self)
  41. Text("Insulin sensitivities").chevronCell()
  42. .navigationLink(to: .configEditor(file: OpenAPS.Settings.insulinSensitivities), from: self)
  43. Text("Temp targets").chevronCell()
  44. .navigationLink(to: .configEditor(file: OpenAPS.Settings.tempTargets), from: self)
  45. }
  46. Group {
  47. Text("IOB").chevronCell()
  48. .navigationLink(to: .configEditor(file: OpenAPS.Monitor.iob), from: self)
  49. Text("Pump profile").chevronCell()
  50. .navigationLink(to: .configEditor(file: OpenAPS.Settings.pumpProfile), from: self)
  51. Text("Profile").chevronCell()
  52. .navigationLink(to: .configEditor(file: OpenAPS.Settings.profile), from: self)
  53. Text("Glucose").chevronCell().navigationLink(to: .configEditor(file: OpenAPS.Monitor.glucose), from: self)
  54. Text("Carbs").chevronCell()
  55. .navigationLink(to: .configEditor(file: OpenAPS.Monitor.carbHistory), from: self)
  56. Text("Suggested").chevronCell()
  57. .navigationLink(to: .configEditor(file: OpenAPS.Enact.suggested), from: self)
  58. Text("Enacted").chevronCell()
  59. .navigationLink(to: .configEditor(file: OpenAPS.Enact.enacted), from: self)
  60. Text("Announcements").chevronCell()
  61. .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.announcements), from: self)
  62. Text("Enacted announcements").chevronCell()
  63. .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.announcementsEnacted), from: self)
  64. Text("Autotune").chevronCell()
  65. .navigationLink(to: .configEditor(file: OpenAPS.Settings.autotune), from: self)
  66. }
  67. }
  68. }
  69. .navigationTitle("Settings")
  70. .navigationBarItems(leading: Button("Close", action: viewModel.hideModal))
  71. .navigationBarTitleDisplayMode(.automatic)
  72. }
  73. }
  74. }