add ActiveWorkoutSession logic, refactor Home, add additional sample data, add isDebug
This commit is contained in:
@@ -10,50 +10,113 @@ import SwiftData
|
||||
|
||||
struct ContentView: View {
|
||||
@Environment(\.modelContext) private var modelContext
|
||||
|
||||
@Default(\.isOnboarding) var isOnboarding
|
||||
@Default(\.isWorkingOut) var isWorkingOut
|
||||
|
||||
var body: some View {
|
||||
ZStack(alignment: .bottom) {
|
||||
TabView {
|
||||
WorkoutLog()
|
||||
// Text("Training Plans")
|
||||
// .tabItem {
|
||||
// Image(systemName: "calendar.badge.clock")
|
||||
// Text("Plans & Goals")
|
||||
// }
|
||||
WorkoutLibrary()
|
||||
.tabItem {
|
||||
Image(systemName: "figure.run.square.stack")
|
||||
Text("Workouts")
|
||||
NavigationStack {
|
||||
List {
|
||||
Section {
|
||||
VStack {
|
||||
HStack {
|
||||
Image(systemName: "person.crop.circle.badge.plus")
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fill)
|
||||
.frame(width: 50, height: 50)
|
||||
.padding(.horizontal)
|
||||
.foregroundStyle(.blue)
|
||||
VStack(alignment: .leading) {
|
||||
Text("Felix Förtsch")
|
||||
.font(.title)
|
||||
.fontWeight(.bold)
|
||||
Text("You got this!")
|
||||
.font(.headline)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
}
|
||||
.padding(.vertical, 5)
|
||||
// TODO: Food Log (Foto + Kalender + Macros
|
||||
// TODO: Goal page
|
||||
// ActivityLog()
|
||||
// .frame(height: 200)
|
||||
}
|
||||
ExerciseLibrary()
|
||||
.tabItem {
|
||||
Image(systemName: "figure.run")
|
||||
Text("Exercises")
|
||||
}
|
||||
Section {
|
||||
NavigationLink(destination: ActiveWorkoutSession()) {
|
||||
if (isWorkingOut) {
|
||||
HStack {
|
||||
Label("Back to Session", systemImage: "memories")
|
||||
.symbolEffect(.rotate)
|
||||
Text("35 min")
|
||||
.font(.subheadline)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
} else {
|
||||
Label("Start Workout Session", systemImage: "play")
|
||||
}
|
||||
}
|
||||
DebugList()
|
||||
.tabItem {
|
||||
Image(systemName: "hammer")
|
||||
Text("Debug")
|
||||
NavigationLink(destination: WorkoutLog()) {
|
||||
Label("Workout Log", systemImage: "calendar.badge.clock")
|
||||
}
|
||||
Settings()
|
||||
.tabItem {
|
||||
Image(systemName: "gear")
|
||||
Text("Settings")
|
||||
}
|
||||
Section {
|
||||
NavigationLink(destination: WorkoutLibrary()) {
|
||||
Label("Workouts", systemImage: "figure.run.square.stack")
|
||||
}
|
||||
|
||||
NavigationLink(destination: ExerciseLibrary()) {
|
||||
Label("Exercises", systemImage: "figure.run")
|
||||
}
|
||||
}
|
||||
Section {
|
||||
|
||||
NavigationLink(destination: Settings()) {
|
||||
Label("Settings", systemImage: "gear")
|
||||
}
|
||||
}
|
||||
Section(header: Text("Debug")) {
|
||||
NavigationLink(destination: DebugList()) {
|
||||
Label("Debug", systemImage: "hammer")
|
||||
}
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: $isOnboarding) { Onboarding() }
|
||||
}
|
||||
.safeAreaInset(edge: .bottom) {
|
||||
if true {
|
||||
MiniPlayer()
|
||||
.navigationBarTitleDisplayMode(.large)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .topBarLeading) {
|
||||
HStack {
|
||||
ZStack {
|
||||
Image(systemName: "hexagon.fill")
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fill)
|
||||
.frame(width: 35, height: 35)
|
||||
.foregroundStyle(systemColors.randomElement()!)
|
||||
Image(systemName: fitnessIcons.randomElement()!)
|
||||
.foregroundStyle(.white)
|
||||
}
|
||||
Text("Workout+")
|
||||
.font(.title)
|
||||
.fontWeight(.bold)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
.sheet(isPresented: $isOnboarding) { Onboarding() }
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
#Preview("No Workout Session") {
|
||||
ContentView()
|
||||
.onAppear {
|
||||
Defaults.shared.isWorkingOut = false
|
||||
}
|
||||
.modelContainer(SampleData.shared.modelContainer)
|
||||
}
|
||||
|
||||
#Preview("With Active Workout Session") {
|
||||
ContentView()
|
||||
.onAppear {
|
||||
Defaults.shared.isWorkingOut = true
|
||||
}
|
||||
.modelContainer(SampleData.shared.modelContainer)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user