Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 61 additions & 45 deletions LoopFollow/Snoozer/SnoozerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,56 @@ struct SnoozerView: View {
.transition(.move(edge: .top).combined(with: .opacity))
}
}
.overlay(alignment: .bottom) {
if let alarm = vm.activeAlarm {
VStack(spacing: 16) {
// Alarm name at the top
Text(alarm.name)
.font(.system(size: 30, weight: .semibold))
.foregroundColor(.white)
.lineLimit(1)
.minimumScaleFactor(0.5)
.padding(.top, 20)

Divider()

// Snooze duration controls
if alarm.type.snoozeTimeUnit != .none {
HStack {
VStack(alignment: .leading, spacing: 4) {
Text("Snooze for")
.font(.headline)
Text("\(vm.snoozeUnits) \(vm.timeUnitLabel)")
.font(.title3).bold()
}
Spacer()
Stepper("", value: $vm.snoozeUnits,
in: alarm.type.snoozeRange,
step: alarm.type.snoozeStep)
.labelsHidden()
}
.padding(.horizontal, 24)
}

// Snooze button anchored to tab bar edge (bottom of VStack)
Button(action: vm.snoozeTapped) {
Text(vm.snoozeUnits == 0 ? "Acknowledge" : "Snooze")
.font(.system(size: 30, weight: .bold))
.frame(maxWidth: .infinity, minHeight: 60)
.background(Color.orange)
.foregroundColor(.white)
.clipShape(Capsule())
}
.padding(.horizontal, 24)
.padding(.bottom, 20)
}
.background(.ultraThinMaterial)
.cornerRadius(20, corners: [.topLeft, .topRight])
.transition(.move(edge: .bottom).combined(with: .opacity))
.animation(.spring(), value: vm.activeAlarm != nil)
.padding(.bottom, 0) // Anchor directly to bottom edge
}
}
.sheet(isPresented: $showDatePickerDate) { datePickerSheetDate() }
.sheet(isPresented: $showDatePickerTime) { datePickerSheetTime() }
}
Expand Down Expand Up @@ -171,66 +221,32 @@ struct SnoozerView: View {
.padding(.bottom, 8)
}

if let alarm = vm.activeAlarm {
VStack(spacing: 16) {
Text(alarm.name)
.font(.system(size: 30, weight: .semibold))
.foregroundColor(.white)
.lineLimit(1)
.minimumScaleFactor(0.5)
.padding(.top, 20)
Divider()

if alarm.type.snoozeTimeUnit != .none {
HStack {
VStack(alignment: .leading, spacing: 4) {
Text("Snooze for")
.font(.headline)
Text("\(vm.snoozeUnits) \(vm.timeUnitLabel)")
.font(.title3).bold()
}
Spacer()
Stepper("", value: $vm.snoozeUnits,
in: alarm.type.snoozeRange,
step: alarm.type.snoozeStep)
.labelsHidden()
}
.padding(.horizontal, 24)
}
if snoozerEmoji.value {
TimelineView(.periodic(from: .now, by: 1)) { context in
VStack(spacing: 4) {
Text(bgEmoji)
.font(.system(size: 128))
.minimumScaleFactor(0.5)

Button(action: vm.snoozeTapped) {
Text(vm.snoozeUnits == 0 ? "Acknowledge" : "Snooze")
.font(.system(size: 30, weight: .bold))
.frame(maxWidth: .infinity, minHeight: 60)
.background(Color.orange)
Text(context.date, format: Date.FormatStyle(date: .omitted, time: .shortened))
.font(.system(size: 70))
.minimumScaleFactor(0.5)
.foregroundColor(.white)
.clipShape(Capsule())
.frame(height: 78)
}
.padding(.horizontal, 24)
.padding(.bottom, 20)
}
.background(.ultraThinMaterial)
.cornerRadius(20, corners: [.topLeft, .topRight])
.transition(.move(edge: .bottom).combined(with: .opacity))
.animation(.spring(), value: vm.activeAlarm != nil)
} else {
TimelineView(.periodic(from: .now, by: 1)) { context in
VStack(spacing: 4) {
if snoozerEmoji.value {
Text(bgEmoji)
.font(.system(size: 128))
.minimumScaleFactor(0.5)
}

Text(context.date, format: Date.FormatStyle(date: .omitted, time: .shortened))
.font(.system(size: 70))
.minimumScaleFactor(0.5)
.foregroundColor(.white)
.frame(height: 78)
}
}
Spacer()
}
Spacer()
}
}

Expand Down