FastRiseAlarmEditor.swift 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // LoopFollow
  2. // FastRiseAlarmEditor.swift
  3. // Created by Jonas Björkert on 2025-05-15.
  4. import SwiftUI
  5. struct FastRiseAlarmEditor: View {
  6. @Binding var alarm: Alarm
  7. var body: some View {
  8. Form {
  9. InfoBanner(
  10. text: "Alerts when glucose readings rise rapidly. For example, "
  11. + "three straight readings each climbing by at least the amount "
  12. + "you set. Optionally limit alerts to only fire above a certain BG.",
  13. alarmType: alarm.type
  14. )
  15. AlarmGeneralSection(alarm: $alarm)
  16. AlarmBGSection(
  17. header: "Rate of Rise",
  18. footer: "This is how much the glucose must rise to be considered a fast rise.",
  19. title: "Rises by",
  20. range: 3 ... 54,
  21. value: $alarm.delta
  22. )
  23. AlarmStepperSection(
  24. header: "Consecutive Rises",
  25. footer: "Number of rises—each meeting the rate above—"
  26. + "required before an alert fires.",
  27. title: "Rises in a row",
  28. range: 1 ... 3,
  29. step: 1,
  30. value: $alarm.monitoringWindow
  31. )
  32. AlarmBGLimitSection(
  33. header: "BG Limit",
  34. footer: "When enabled, this alert only fires if the glucose is "
  35. + "above the limit you set.",
  36. toggleText: "Use BG Limit",
  37. pickerTitle: "Rising above",
  38. range: 40 ... 300,
  39. defaultOnValue: 200,
  40. value: $alarm.aboveBG
  41. )
  42. AlarmActiveSection(alarm: $alarm)
  43. AlarmAudioSection(alarm: $alarm)
  44. AlarmSnoozeSection(alarm: $alarm)
  45. }
  46. .navigationTitle(alarm.type.rawValue)
  47. }
  48. }