SettingsRootView.swift 4.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. }
  24. Section(header: Text("Config files")) {
  25. Group {
  26. Text("Preferences").chevronCell()
  27. .navigationLink(to: .configEditor(file: OpenAPS.Settings.preferences), from: self)
  28. Text("Pump Settings").chevronCell()
  29. .navigationLink(to: .configEditor(file: OpenAPS.Settings.settings), from: self)
  30. Text("Autosense").chevronCell()
  31. .navigationLink(to: .configEditor(file: OpenAPS.Settings.autosense), from: self)
  32. Text("Pump History").chevronCell()
  33. .navigationLink(to: .configEditor(file: OpenAPS.Monitor.pumpHistory), from: self)
  34. Text("Basal profile").chevronCell()
  35. .navigationLink(to: .configEditor(file: OpenAPS.Settings.basalProfile), from: self)
  36. Text("Targets ranges").chevronCell()
  37. .navigationLink(to: .configEditor(file: OpenAPS.Settings.bgTargets), from: self)
  38. Text("Carb ratios").chevronCell()
  39. .navigationLink(to: .configEditor(file: OpenAPS.Settings.carbRatios), from: self)
  40. Text("Insulin sensitivities").chevronCell()
  41. .navigationLink(to: .configEditor(file: OpenAPS.Settings.insulinSensitivities), from: self)
  42. Text("Temp targets").chevronCell()
  43. .navigationLink(to: .configEditor(file: OpenAPS.Settings.tempTargets), from: self)
  44. }
  45. Group {
  46. Text("IOB").chevronCell()
  47. .navigationLink(to: .configEditor(file: OpenAPS.Monitor.iob), from: self)
  48. Text("Pump profile").chevronCell()
  49. .navigationLink(to: .configEditor(file: OpenAPS.Settings.pumpProfile), from: self)
  50. Text("Profile").chevronCell()
  51. .navigationLink(to: .configEditor(file: OpenAPS.Settings.profile), from: self)
  52. Text("Glucose").chevronCell().navigationLink(to: .configEditor(file: OpenAPS.Monitor.glucose), from: self)
  53. Text("Carbs").chevronCell()
  54. .navigationLink(to: .configEditor(file: OpenAPS.Monitor.carbHistory), from: self)
  55. Text("Suggested").chevronCell()
  56. .navigationLink(to: .configEditor(file: OpenAPS.Enact.suggested), from: self)
  57. Text("Enacted").chevronCell()
  58. .navigationLink(to: .configEditor(file: OpenAPS.Enact.enacted), from: self)
  59. Text("Announcements").chevronCell()
  60. .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.announcements), from: self)
  61. Text("Enacted announcements").chevronCell()
  62. .navigationLink(to: .configEditor(file: OpenAPS.FreeAPS.announcementsEnacted), from: self)
  63. }
  64. }
  65. }
  66. .navigationTitle("Settings")
  67. .navigationBarItems(leading: Button("Close", action: viewModel.hideModal))
  68. .navigationBarTitleDisplayMode(.automatic)
  69. }
  70. }
  71. }