-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLandingView.swift
More file actions
56 lines (50 loc) · 1.84 KB
/
LandingView.swift
File metadata and controls
56 lines (50 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import SwiftUI
struct LandingView: View {
@State private var isChoiceModeNavigated = false
@State private var isMemoryModeNavigated = false
private let audioManager = AudioManager.shared
var body: some View {
NavigationStack {
VStack(spacing: 40) {
Text("Welcome to Vibe Pad")
.font(.largeTitle)
.fontWeight(.bold)
.foregroundColor(.primary)
.padding()
HStack(spacing: 30) {
ModeOptionButton(title: "Choice Mode", color: .blue) {
isChoiceModeNavigated = true
}
.navigationDestination(isPresented: $isChoiceModeNavigated) { ChoiceModeView() }
ModeOptionButton(title: "Memory Mode", color: .cyan) {
isMemoryModeNavigated = true
}
.navigationDestination(isPresented: $isMemoryModeNavigated) { MemoryModeView() }
}
}
.padding()
}
.onAppear {
audioManager.introduce(IntroductionMessages.vibePadIntroduction)
}
.onChange(of: isChoiceModeNavigated) { _ in audioManager.stopSpeaking() }
.onChange(of: isMemoryModeNavigated) { _ in audioManager.stopSpeaking() }
}
}
struct ModeOptionButton: View {
let title: String
let color: Color
let moveMode: () -> Void
var body: some View {
Button(action: moveMode) {
Text(title)
.font(.title2)
.fontWeight(.semibold)
.foregroundColor(.white)
.frame(width: 180, height: 180)
.background(color)
.cornerRadius(20)
.shadow(radius: 5)
}
}
}