add WorkoutIconSelector, change the way adding ExerciseTemplate works to in-List

This commit is contained in:
Felix Förtsch
2024-08-27 14:26:46 +02:00
parent 19e91d75e0
commit edaea5e862
9 changed files with 289 additions and 53 deletions
+6 -12
View File
@@ -15,7 +15,7 @@ struct WorkoutLibrary: View {
@State private var newWorkout: Workout?
var body: some View {
NavigationSplitView {
NavigationView {
Group {
if !workouts.isEmpty {
List {
@@ -27,6 +27,9 @@ struct WorkoutLibrary: View {
}
}
.onDelete(perform: deleteWorkout)
Button(action: addWorkout) {
Label("Add Workout", systemImage: "plus")
}
}
} else {
ContentUnavailableView {
@@ -34,16 +37,11 @@ struct WorkoutLibrary: View {
}
}
}
.navigationBarTitle("Workout Templates")
.navigationBarTitle("Workouts")
.toolbar {
ToolbarItem(placement: .topBarLeading) {
ToolbarItem() {
EditButton()
}
ToolbarItem {
Button(action: addWorkout) {
Label("Add Workout", systemImage: "plus")
}
}
}
.sheet(item: $newWorkout) { workout in
NavigationStack {
@@ -52,10 +50,6 @@ struct WorkoutLibrary: View {
.presentationDetents([.medium])
.interactiveDismissDisabled()
}
} detail: {
// TODO: What does this Detail do?
Text("Select a workout")
.navigationTitle("Movie")
}
}