IOBAlarmEditor.swift 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // LoopFollow
  2. // IOBAlarmEditor.swift
  3. import SwiftUI
  4. struct IOBAlarmEditor: View {
  5. @Binding var alarm: Alarm
  6. var body: some View {
  7. Group {
  8. InfoBanner(
  9. text: "Alerts when insulin-on-board is high, or when several "
  10. + "boluses in quick succession exceed the limits you set.",
  11. alarmType: alarm.type
  12. )
  13. AlarmGeneralSection(alarm: $alarm)
  14. AlarmStepperSection(
  15. header: "Boluses Size Limit",
  16. footer: "This counts only boluses larger than this size.",
  17. title: "Above",
  18. range: 0.1 ... 20,
  19. step: 0.1,
  20. unitLabel: "Units",
  21. value: $alarm.delta
  22. )
  23. AlarmStepperSection(
  24. header: "Bolus Count",
  25. footer: "Number of qualifying boluses needed to trigger.",
  26. title: "Count",
  27. range: 1 ... 10,
  28. step: 1,
  29. unitLabel: "Boluses",
  30. value: $alarm.monitoringWindow
  31. )
  32. AlarmStepperSection(
  33. header: "Time Window",
  34. footer: "How far back to look for those boluses.",
  35. title: "Time",
  36. range: 5 ... 120,
  37. step: 5,
  38. unitLabel: "min",
  39. value: $alarm.predictiveMinutes
  40. )
  41. AlarmStepperSection(
  42. header: "Insulin On Board",
  43. footer: "Alert if current IOB or total boluses reach this.",
  44. title: "IOB Above",
  45. range: 1 ... 20,
  46. step: 0.5,
  47. unitLabel: "Units",
  48. value: $alarm.threshold
  49. )
  50. AlarmActiveSection(alarm: $alarm)
  51. AlarmAudioSection(alarm: $alarm)
  52. AlarmSnoozeSection(alarm: $alarm)
  53. }
  54. }
  55. }