SnoozerView.swift 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. //
  2. // SnoozerView.swift
  3. // LoopFollow
  4. //
  5. // Created by Jonas Björkert on 2025-04-26.
  6. // Copyright © 2025 Jon Fawcett. All rights reserved.
  7. //
  8. import SwiftUI
  9. struct SnoozerView: View {
  10. @ObservedObject var minAgoText = Observable.shared.minAgoText
  11. @ObservedObject var bgText = Observable.shared.bgText
  12. @ObservedObject var bgTextcolor = Observable.shared.bgTextColor
  13. @ObservedObject var directionText = Observable.shared.directionText
  14. @Binding var snoozeMinutes: Int
  15. var onSnooze: () -> Void
  16. var body: some View {
  17. ZStack {
  18. Color.black
  19. .edgesIgnoringSafeArea(.all)
  20. VStack(spacing: 0) {
  21. // MARK: Main numbers block
  22. VStack(spacing: 0) {
  23. Text(bgText.value)
  24. .font(.system(size: 220, weight: .black))
  25. .minimumScaleFactor(0.5)
  26. .foregroundColor(Observable.shared.bgTextColor.value)
  27. .frame(maxWidth: .infinity, maxHeight: 167)
  28. Text(directionText.value)
  29. .font(.system(size: 110, weight: .black))
  30. .minimumScaleFactor(0.5)
  31. .foregroundColor(.white)
  32. .frame(maxWidth: .infinity, maxHeight: 96)
  33. Text(""/*deltaValue.value*/)
  34. .font(.system(size: 70))
  35. .minimumScaleFactor(0.5)
  36. .foregroundColor(.white.opacity(0.8))
  37. .frame(maxWidth: .infinity, maxHeight: 78)
  38. Text(minAgoText.value)
  39. .font(.system(size: 70))
  40. .minimumScaleFactor(0.5)
  41. .foregroundColor(.white.opacity(0.6))
  42. .frame(maxWidth: .infinity, maxHeight: 48)
  43. }
  44. // MARK: Clock + optional alert label
  45. VStack(spacing: 8) {
  46. Text("19:59"/*time.value*/)
  47. .font(.system(size: 70))
  48. .minimumScaleFactor(0.5)
  49. .foregroundColor(.white)
  50. .frame(height: 78)
  51. /*
  52. if let alarm = ""/*alarmText.value*/, !alarm.isEmpty {
  53. Text(alarm)
  54. .font(.system(size: 40, weight: .semibold))
  55. .foregroundColor(.red)
  56. .minimumScaleFactor(0.5)
  57. .lineLimit(1)
  58. .frame(height: 48)
  59. }*/
  60. }
  61. .padding(.vertical, 16)
  62. Spacer()
  63. // MARK: Snooze controls
  64. HStack(spacing: 12) {
  65. Text("Snooze for")
  66. .font(.system(size: 20))
  67. .foregroundColor(.white)
  68. Text("\(snoozeMinutes) min")
  69. .font(.system(size: 20, weight: .semibold))
  70. .foregroundColor(.white)
  71. Spacer()
  72. Stepper("", value: $snoozeMinutes, in: 1...60)
  73. .labelsHidden()
  74. }
  75. .padding(.horizontal, 32)
  76. .frame(height: 44)
  77. Button(action: onSnooze) {
  78. Text("Snooze")
  79. .font(.system(size: 24, weight: .bold))
  80. .frame(maxWidth: .infinity, minHeight: 56)
  81. }
  82. .background(Color(white: 0.15))
  83. .foregroundColor(.white)
  84. .cornerRadius(8)
  85. .padding(.horizontal, 32)
  86. .padding(.bottom, 32)
  87. }
  88. }
  89. }
  90. }