FastDropAlarmEditor.swift 1.7 KB

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