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,9 +39,7 @@ struct OnboardingContainerView: View {
.ignoresSafeArea() .ignoresSafeArea()
VStack(spacing: 0) { VStack(spacing: 0) {
TabView(selection: $currentPage) { TabView(selection: $currentPage) {
WelcomeView( WelcomeView()
onContinue: { currentPage = 1 }
)
.tag(0) .tag(0)
.tabItem { .tabItem {
Image(systemName: "hand.wave.fill") Image(systemName: "hand.wave.fill")
@@ -83,11 +81,7 @@ struct OnboardingContainerView: View {
Image(systemName: "gearshape.fill") Image(systemName: "gearshape.fill")
} }
CompletionView( CompletionView()
onComplete: {
completeOnboarding()
}
)
.tag(5) .tag(5)
.tabItem { .tabItem {
Image(systemName: "checkmark.circle.fill") Image(systemName: "checkmark.circle.fill")
@@ -95,19 +89,23 @@ struct OnboardingContainerView: View {
} }
.tabViewStyle(.automatic) .tabViewStyle(.automatic)
if currentPage >= 1 { if currentPage >= 0 {
HStack(spacing: 12) { HStack(spacing: 12) {
if currentPage > 0 {
Button(action: { currentPage -= 1 }) { Button(action: { currentPage -= 1 }) {
HStack { HStack {
Image(systemName: "chevron.left") Image(systemName: "chevron.left")
Text("Back") Text("Back")
} }
.font(.headline) .font(.headline)
.frame(maxWidth: .infinity) .frame(
.padding() minWidth: 100, maxWidth: .infinity, minHeight: 44,
maxHeight: 44, alignment: .center
)
.foregroundColor(.white)
} }
.buttonStyle(.plain)
.glassEffect(.regular.interactive()) .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(
currentPage == 0
? "Let's Get Started"
: currentPage == 5 ? "Get Started" : "Continue"
)
.font(.headline) .font(.headline)
.frame(maxWidth: .infinity) .frame(
.padding() 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) .frame(width: 600, height: 450)
.glassEffect(.regular.tint(.blue).interactive())
.padding(.horizontal, 40)
}
.frame(width: 600, height: 500)
.padding() .padding()
.background(.clear) .background(.clear)
} }
@@ -75,5 +63,5 @@ struct FeatureRow: View {
} }
#Preview { #Preview {
WelcomeView(onContinue: {}) WelcomeView()
} }