Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
6a154f00bc
commit
1fd0c88d3d
@ -42,29 +42,39 @@ struct AlarmView: View {
|
||||
.frame(maxWidth: Design.Size.maxContentWidthPortrait)
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
} else {
|
||||
ScrollView {
|
||||
VStack(spacing: Design.Spacing.medium) {
|
||||
if !isKeepAwakeEnabled {
|
||||
AlarmLimitationsBanner()
|
||||
}
|
||||
|
||||
ForEach(viewModel.alarms) { alarm in
|
||||
AlarmRowView(
|
||||
alarm: alarm,
|
||||
onToggle: {
|
||||
Task {
|
||||
await viewModel.toggleAlarm(id: alarm.id)
|
||||
}
|
||||
},
|
||||
onEdit: {
|
||||
selectedAlarmForEdit = alarm
|
||||
}
|
||||
)
|
||||
}
|
||||
List {
|
||||
if !isKeepAwakeEnabled {
|
||||
AlarmLimitationsBanner()
|
||||
.listRowInsets(EdgeInsets(top: Design.Spacing.large, leading: Design.Spacing.large, bottom: Design.Spacing.small, trailing: Design.Spacing.large))
|
||||
.listRowBackground(Color.clear)
|
||||
.listRowSeparator(.hidden)
|
||||
}
|
||||
|
||||
ForEach(viewModel.alarms) { alarm in
|
||||
AlarmRowView(
|
||||
alarm: alarm,
|
||||
onToggle: {
|
||||
Task {
|
||||
await viewModel.toggleAlarm(id: alarm.id)
|
||||
}
|
||||
},
|
||||
onEdit: {
|
||||
selectedAlarmForEdit = alarm
|
||||
},
|
||||
onDelete: {
|
||||
Task {
|
||||
await viewModel.deleteAlarm(id: alarm.id)
|
||||
}
|
||||
}
|
||||
)
|
||||
.listRowInsets(EdgeInsets(top: Design.Spacing.small, leading: Design.Spacing.large, bottom: Design.Spacing.small, trailing: Design.Spacing.large))
|
||||
.listRowBackground(Color.clear)
|
||||
.listRowSeparator(.hidden)
|
||||
}
|
||||
.padding(.horizontal, Design.Spacing.large)
|
||||
.padding(.top, Design.Spacing.large)
|
||||
}
|
||||
.listStyle(.plain)
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(AppSurface.primary.ignoresSafeArea())
|
||||
.frame(maxWidth: Design.Size.maxContentWidthPortrait)
|
||||
.frame(maxWidth: .infinity, alignment: .center)
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ struct AlarmRowView: View {
|
||||
let alarm: Alarm
|
||||
let onToggle: () -> Void
|
||||
let onEdit: () -> Void
|
||||
let onDelete: () -> Void
|
||||
@AppStorage(ClockStyle.appStorageKey) private var clockStyleData: Data = Data()
|
||||
|
||||
// MARK: - Body
|
||||
@ -65,6 +66,13 @@ struct AlarmRowView: View {
|
||||
onEdit()
|
||||
}
|
||||
}
|
||||
.swipeActions(edge: .trailing, allowsFullSwipe: true) {
|
||||
Button(role: .destructive) {
|
||||
onDelete()
|
||||
} label: {
|
||||
Label("Delete", systemImage: "trash")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var isKeepAwakeEnabled: Bool {
|
||||
@ -82,7 +90,8 @@ struct AlarmRowView: View {
|
||||
AlarmRowView(
|
||||
alarm: Alarm(time: Date()),
|
||||
onToggle: {},
|
||||
onEdit: {}
|
||||
onEdit: {},
|
||||
onDelete: {}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,7 +24,6 @@ struct OnboardingView: View {
|
||||
@State private var currentPage = 0
|
||||
@State private var alarmKitPermissionGranted = false
|
||||
@State private var keepAwakeEnabled = false
|
||||
@State private var showCelebration = false
|
||||
|
||||
private let totalPages = 4
|
||||
|
||||
@ -59,11 +58,6 @@ struct OnboardingView: View {
|
||||
.padding(.horizontal, Design.Spacing.xLarge)
|
||||
.padding(.bottom, Design.Spacing.xxLarge)
|
||||
}
|
||||
|
||||
// Celebration overlay
|
||||
if showCelebration {
|
||||
celebrationOverlay
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -375,30 +369,6 @@ struct OnboardingView: View {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Celebration
|
||||
|
||||
private var celebrationOverlay: some View {
|
||||
ZStack {
|
||||
Color.black.opacity(0.3)
|
||||
.ignoresSafeArea()
|
||||
|
||||
VStack(spacing: Design.Spacing.large) {
|
||||
Image(systemName: "party.popper.fill")
|
||||
.font(.system(size: 60))
|
||||
.foregroundStyle(AppAccent.primary)
|
||||
|
||||
Text("Let's go!")
|
||||
.typography(.heroBold)
|
||||
.foregroundStyle(AppTextColors.primary)
|
||||
}
|
||||
.padding(Design.Spacing.xxxLarge)
|
||||
.background(AppSurface.overlay)
|
||||
.cornerRadius(Design.CornerRadius.xxLarge)
|
||||
.shadow(radius: 20)
|
||||
}
|
||||
.transition(.opacity.combined(with: .scale))
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
|
||||
private func requestAlarmKitPermission() {
|
||||
@ -447,13 +417,8 @@ struct OnboardingView: View {
|
||||
}
|
||||
|
||||
private func triggerCelebration() {
|
||||
withAnimation(.spring(duration: 0.4)) {
|
||||
showCelebration = true
|
||||
}
|
||||
|
||||
// Dismiss after short celebration
|
||||
Task {
|
||||
try? await Task.sleep(for: .milliseconds(1200))
|
||||
// Use a more subtle transition to the main app
|
||||
withAnimation(.easeIn(duration: 0.3)) {
|
||||
onComplete()
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user