NotLoopingAlarmEditor.swift 1.8 KB

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