triggers properly

This commit is contained in:
Michael Freno
2026-01-08 11:35:09 -05:00
parent 650f5b2b15
commit c417398116
3 changed files with 47 additions and 54 deletions

View File

@@ -8,8 +8,6 @@
import SwiftUI import SwiftUI
struct CompletionView: View { struct CompletionView: View {
var onComplete: () -> Void
var body: some View { var body: some View {
VStack(spacing: 30) { VStack(spacing: 30) {
Spacer() Spacer()
@@ -71,5 +69,5 @@ struct CompletionView: View {
} }
#Preview { #Preview {
CompletionView(onComplete: {}) CompletionView()
} }

View File

@@ -39,13 +39,11 @@ struct OnboardingContainerView: View {
.ignoresSafeArea() .ignoresSafeArea()
VStack(spacing: 0) { VStack(spacing: 0) {
TabView(selection: $currentPage) { TabView(selection: $currentPage) {
WelcomeView( WelcomeView()
onContinue: { currentPage = 1 } .tag(0)
) .tabItem {
.tag(0) Image(systemName: "hand.wave.fill")
.tabItem { }
Image(systemName: "hand.wave.fill")
}
LookAwaySetupView( LookAwaySetupView(
enabled: $lookAwayEnabled, enabled: $lookAwayEnabled,
@@ -83,31 +81,31 @@ struct OnboardingContainerView: View {
Image(systemName: "gearshape.fill") Image(systemName: "gearshape.fill")
} }
CompletionView( CompletionView()
onComplete: { .tag(5)
completeOnboarding() .tabItem {
Image(systemName: "checkmark.circle.fill")
} }
)
.tag(5)
.tabItem {
Image(systemName: "checkmark.circle.fill")
}
} }
.tabViewStyle(.automatic) .tabViewStyle(.automatic)
if currentPage >= 1 { if currentPage >= 0 {
HStack(spacing: 12) { HStack(spacing: 12) {
Button(action: { currentPage -= 1 }) { if currentPage > 0 {
HStack { Button(action: { currentPage -= 1 }) {
Image(systemName: "chevron.left") HStack {
Text("Back") Image(systemName: "chevron.left")
Text("Back")
}
.font(.headline)
.frame(
minWidth: 100, maxWidth: .infinity, minHeight: 44,
maxHeight: 44, alignment: .center
)
.foregroundColor(.white)
} }
.font(.headline) .glassEffect(.regular.interactive())
.frame(maxWidth: .infinity)
.padding()
} }
.buttonStyle(.plain)
.glassEffect(.regular.interactive())
Button(action: { Button(action: {
if currentPage == 5 { if currentPage == 5 {
@@ -116,12 +114,18 @@ struct OnboardingContainerView: View {
currentPage += 1 currentPage += 1
} }
}) { }) {
Text(currentPage == 5 ? "Get Started" : "Continue") Text(
.font(.headline) currentPage == 0
.frame(maxWidth: .infinity) ? "Let's Get Started"
.padding() : currentPage == 5 ? "Get Started" : "Continue"
)
.font(.headline)
.frame(
minWidth: 100, maxWidth: .infinity, minHeight: 44, maxHeight: 44,
alignment: .center
)
.foregroundColor(.white)
} }
.buttonStyle(.plain)
.glassEffect(.regular.tint(currentPage == 5 ? .green : .blue).interactive()) .glassEffect(.regular.tint(currentPage == 5 ? .green : .blue).interactive())
} }
.padding(.horizontal, 40) .padding(.horizontal, 40)
@@ -226,3 +230,6 @@ struct OnboardingContainerView: View {
}) })
} }
} }
#Preview {
OnboardingContainerView(s)
}

View File

@@ -8,8 +8,6 @@
import SwiftUI import SwiftUI
struct WelcomeView: View { struct WelcomeView: View {
var onContinue: () -> Void
var body: some View { var body: some View {
VStack(spacing: 30) { VStack(spacing: 30) {
Spacer() Spacer()
@@ -34,18 +32,8 @@ struct WelcomeView: View {
.glassEffect(in: .rect(cornerRadius: 16)) .glassEffect(in: .rect(cornerRadius: 16))
Spacer() Spacer()
Button(action: onContinue) {
Text("Let's Get Started")
.font(.headline)
.frame(maxWidth: .infinity)
.padding()
}
.buttonStyle(.plain)
.glassEffect(.regular.tint(.blue).interactive())
.padding(.horizontal, 40)
} }
.frame(width: 600, height: 500) .frame(width: 600, height: 450)
.padding() .padding()
.background(.clear) .background(.clear)
} }
@@ -75,5 +63,5 @@ struct FeatureRow: View {
} }
#Preview { #Preview {
WelcomeView(onContinue: {}) WelcomeView()
} }