NotLoopingAlarmEditor.swift 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // LoopFollow
  2. // NotLoopingAlarmEditor.swift
  3. import SwiftUI
  4. struct NotLoopingAlarmEditor: View {
  5. @Binding var alarm: Alarm
  6. private let bgRange: ClosedRange<Double> = 40 ... 300
  7. var body: some View {
  8. Group {
  9. InfoBanner(
  10. text: "Alerts when no successful loop has occurred for the time "
  11. + "you set below.", alarmType: alarm.type
  12. )
  13. AlarmGeneralSection(alarm: $alarm)
  14. AlarmStepperSection(
  15. header: "No Loop for…",
  16. footer: "Number of minutes since the last successful loop. "
  17. + "When this time has elapsed, the alarm becomes eligible.",
  18. title: "Elapsed time",
  19. range: 16 ... 61,
  20. step: 5,
  21. unitLabel: alarm.type.snoozeTimeUnit.label,
  22. value: $alarm.threshold
  23. )
  24. AlarmBGLimitSection(
  25. header: "Low Limit",
  26. footer: "Alert only if BG is equal to or below this value.",
  27. toggleText: "Enable low limit",
  28. pickerTitle: "Below",
  29. range: bgRange,
  30. defaultOnValue: 100,
  31. value: $alarm.belowBG
  32. )
  33. AlarmBGLimitSection(
  34. header: "High Limit",
  35. footer: "Alert only if BG is equal to or above this value.",
  36. toggleText: "Enable high limit",
  37. pickerTitle: "Above",
  38. range: bgRange,
  39. defaultOnValue: 160,
  40. value: $alarm.aboveBG
  41. )
  42. AlarmActiveSection(alarm: $alarm)
  43. AlarmAudioSection(alarm: $alarm)
  44. AlarmSnoozeSection(alarm: $alarm)
  45. }
  46. }
  47. }