67 lines
1.9 KiB
Swift
67 lines
1.9 KiB
Swift
import SwiftUI
|
|
import Bedrock
|
|
import Sherpa
|
|
|
|
struct RootView: View {
|
|
@Bindable var store: RitualStore
|
|
@Bindable var settingsStore: SettingsStore
|
|
@AppStorage("hasCompletedOnboarding") private var hasCompletedOnboarding = false
|
|
|
|
var body: some View {
|
|
TabView {
|
|
Tab(String(localized: "Today"), systemImage: "sun.max.fill") {
|
|
NavigationStack {
|
|
TodayView(store: store)
|
|
}
|
|
}
|
|
|
|
Tab(String(localized: "Rituals"), systemImage: "sparkles") {
|
|
NavigationStack {
|
|
RitualsView(store: store)
|
|
}
|
|
}
|
|
|
|
Tab(String(localized: "Insights"), systemImage: "chart.bar.fill") {
|
|
NavigationStack {
|
|
InsightsView(store: store)
|
|
}
|
|
}
|
|
|
|
Tab(String(localized: "History"), systemImage: "calendar") {
|
|
NavigationStack {
|
|
HistoryView(store: store)
|
|
}
|
|
}
|
|
|
|
Tab(String(localized: "Settings"), systemImage: "gearshape.fill") {
|
|
NavigationStack {
|
|
SettingsView(store: settingsStore, ritualStore: store)
|
|
}
|
|
}
|
|
}
|
|
.tint(AppAccent.primary)
|
|
.background(AppSurface.primary.ignoresSafeArea())
|
|
.sherpaTabBarTag(RitualsOnboardingTag.tabBar)
|
|
.sherpa(
|
|
isActive: !hasCompletedOnboarding,
|
|
tags: RitualsOnboardingTag.self,
|
|
delegate: self,
|
|
startDelay: Bedrock.Design.Animation.standard
|
|
)
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
RootView(store: RitualStore.preview, settingsStore: SettingsStore.preview)
|
|
}
|
|
|
|
extension RootView: SherpaDelegate {
|
|
func onWalkthroughComplete(sherpa: Sherpa) {
|
|
hasCompletedOnboarding = true
|
|
}
|
|
|
|
func onWalkthroughSkipped(sherpa: Sherpa, atStep: Int, totalSteps: Int) {
|
|
hasCompletedOnboarding = true
|
|
}
|
|
}
|