NotLoopingAlarmEditor.swift 1.9 KB

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