SensorAgeAlarmEditor.swift 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // LoopFollow
  2. // SensorAgeAlarmEditor.swift
  3. // Created by Jonas Björkert on 2025-05-17.
  4. import SwiftUI
  5. struct SensorAgeAlarmEditor: View {
  6. @Binding var alarm: Alarm
  7. var body: some View {
  8. Form {
  9. InfoBanner(
  10. text: "Warn me this many hours before the sensor’s 10-day change-over.",
  11. alarmType: alarm.type
  12. )
  13. AlarmGeneralSection(alarm: $alarm)
  14. AlarmStepperSection(
  15. header: "Advance warning",
  16. footer: "Number of hours before the 10-day mark that the alert " +
  17. "will fire.",
  18. title: "Hours",
  19. range: 1 ... 24,
  20. step: 1,
  21. unitLabel: "hours",
  22. value: Binding(
  23. get: { alarm.threshold ?? 12 },
  24. set: { alarm.threshold = $0 }
  25. )
  26. )
  27. AlarmActiveSection(alarm: $alarm)
  28. AlarmAudioSection(alarm: $alarm)
  29. AlarmSnoozeSection(alarm: $alarm,
  30. range: 1 ... 24,
  31. step: 1)
  32. }
  33. .navigationTitle(alarm.type.rawValue)
  34. }
  35. }