triggers properly
This commit is contained in:
@@ -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()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)
|
||||||
|
}
|
||||||
|
|||||||
@@ -8,23 +8,21 @@
|
|||||||
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()
|
||||||
|
|
||||||
Image(systemName: "eye.fill")
|
Image(systemName: "eye.fill")
|
||||||
.font(.system(size: 80))
|
.font(.system(size: 80))
|
||||||
.foregroundColor(.blue)
|
.foregroundColor(.blue)
|
||||||
|
|
||||||
Text("Welcome to Gaze")
|
Text("Welcome to Gaze")
|
||||||
.font(.system(size: 36, weight: .bold))
|
.font(.system(size: 36, weight: .bold))
|
||||||
|
|
||||||
Text("Take care of your eyes and posture")
|
Text("Take care of your eyes and posture")
|
||||||
.font(.title3)
|
.font(.title3)
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
VStack(alignment: .leading, spacing: 16) {
|
VStack(alignment: .leading, spacing: 16) {
|
||||||
FeatureRow(icon: "eye.circle", title: "Reduce Eye Strain", description: "Regular breaks help prevent digital eye strain")
|
FeatureRow(icon: "eye.circle", title: "Reduce Eye Strain", description: "Regular breaks help prevent digital eye strain")
|
||||||
FeatureRow(icon: "eye.trianglebadge.exclamationmark", title: "Remember to Blink", description: "We blink less when focused on screens")
|
FeatureRow(icon: "eye.trianglebadge.exclamationmark", title: "Remember to Blink", description: "We blink less when focused on screens")
|
||||||
@@ -32,20 +30,10 @@ struct WelcomeView: View {
|
|||||||
}
|
}
|
||||||
.padding()
|
.padding()
|
||||||
.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)
|
||||||
}
|
}
|
||||||
@@ -55,14 +43,14 @@ struct FeatureRow: View {
|
|||||||
let icon: String
|
let icon: String
|
||||||
let title: String
|
let title: String
|
||||||
let description: String
|
let description: String
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
HStack(alignment: .top, spacing: 16) {
|
HStack(alignment: .top, spacing: 16) {
|
||||||
Image(systemName: icon)
|
Image(systemName: icon)
|
||||||
.font(.title2)
|
.font(.title2)
|
||||||
.foregroundColor(.blue)
|
.foregroundColor(.blue)
|
||||||
.frame(width: 30)
|
.frame(width: 30)
|
||||||
|
|
||||||
VStack(alignment: .leading, spacing: 4) {
|
VStack(alignment: .leading, spacing: 4) {
|
||||||
Text(title)
|
Text(title)
|
||||||
.font(.headline)
|
.font(.headline)
|
||||||
@@ -75,5 +63,5 @@ struct FeatureRow: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#Preview {
|
#Preview {
|
||||||
WelcomeView(onContinue: {})
|
WelcomeView()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user