NotLoopingAlarmEditor.swift 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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: String(localized: "Alerts when no successful loop has occurred for the time you set below."), alarmType: alarm.type
  11. )
  12. AlarmGeneralSection(alarm: $alarm)
  13. AlarmStepperSection(
  14. header: String(localized: "No Loop for…"),
  15. footer: String(localized: "Number of minutes since the last successful loop. When this time has elapsed, the alarm becomes eligible."),
  16. title: String(localized: "Elapsed time"),
  17. range: 16 ... 61,
  18. step: 5,
  19. unitLabel: alarm.type.snoozeTimeUnit.label,
  20. value: $alarm.threshold
  21. )
  22. AlarmBGLimitSection(
  23. header: String(localized: "Low Limit"),
  24. footer: String(localized: "Alert only if BG is equal to or below this value."),
  25. toggleText: String(localized: "Enable low limit"),
  26. pickerTitle: String(localized: "Below"),
  27. range: bgRange,
  28. defaultOnValue: 100,
  29. value: $alarm.belowBG
  30. )
  31. AlarmBGLimitSection(
  32. header: String(localized: "High Limit"),
  33. footer: String(localized: "Alert only if BG is equal to or above this value."),
  34. toggleText: String(localized: "Enable high limit"),
  35. pickerTitle: String(localized: "Above"),
  36. range: bgRange,
  37. defaultOnValue: 160,
  38. value: $alarm.aboveBG
  39. )
  40. AlarmActiveSection(alarm: $alarm)
  41. AlarmAudioSection(alarm: $alarm)
  42. AlarmSnoozeSection(alarm: $alarm)
  43. }
  44. }
  45. }