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
struct CompletionView: View {
var onComplete: () -> Void
var body: some View {
VStack(spacing: 30) {
Spacer()
@@ -71,5 +69,5 @@ struct CompletionView: View {
}
#Preview {
CompletionView(onComplete: {})
CompletionView()
}

View File

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

View File

@@ -8,8 +8,6 @@
import SwiftUI
struct WelcomeView: View {
var onContinue: () -> Void
var body: some View {
VStack(spacing: 30) {
Spacer()
@@ -34,18 +32,8 @@ struct WelcomeView: View {
.glassEffect(in: .rect(cornerRadius: 16))
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()
.background(.clear)
}
@@ -75,5 +63,5 @@ struct FeatureRow: View {
}
#Preview {
WelcomeView(onContinue: {})
WelcomeView()
}