This commit is contained in:
2025-07-15 19:08:28 -04:00
parent 48bbbbf692
commit 2d0e327334
7 changed files with 20 additions and 23 deletions

View File

@ -29,7 +29,7 @@ struct EntityListView<T: EditableEntity>: View {
let content = Form {
List {
ForEach(items) { item in
ListItem(title: item.name, count: item.count)
ListItem(text: item.name, count: item.count)
.swipeActions(edge: .trailing, allowsFullSwipe: false) {
Button(role: .destructive) {
itemToDelete = item

View File

@ -74,6 +74,7 @@ fileprivate struct SplitFormView: View {
ForEach(sortedAssignments) { item in
ListItem(
title: item.exercise?.name ?? Exercise.unnamed,
text: item.setup.isEmpty ? nil : item.setup,
subtitle: "\(item.sets) × \(item.reps) × \(item.weight) lbs"
)
.swipeActions {

View File

@ -7,6 +7,7 @@ final class SplitExerciseAssignment {
var sets: Int = 0
var reps: Int = 0
var weight: Int = 0
var setup: String = ""
@Relationship(deleteRule: .nullify)
var split: Split?
@ -14,11 +15,12 @@ final class SplitExerciseAssignment {
@Relationship(deleteRule: .nullify)
var exercise: Exercise?
init(order: Int, sets: Int, reps: Int, weight: Int, split: Split, exercise: Exercise) {
init(order: Int, sets: Int, reps: Int, weight: Int, setup: String = "", split: Split, exercise: Exercise) {
self.order = order
self.sets = sets
self.reps = reps
self.weight = weight
self.setup = setup
self.split = split
self.exercise = exercise
}

View File

@ -22,10 +22,14 @@ struct ListItem: View {
if let title = title {
Text("\(title)")
.font(.headline)
} else if let text = text {
if let text = text {
Text("\(text)")
.font(.footnote)
}
} else {
Text("Untitled")
if let text = text {
Text("\(text)")
}
}
HStack (alignment: .bottom) {
if let badges = badges {
@ -46,7 +50,6 @@ struct ListItem: View {
.foregroundColor(.gray)
}
}
.frame(height: 40)
.frame(maxWidth: .infinity, alignment: .leading)
.contentShape(Rectangle())
}

View File

@ -18,6 +18,11 @@ struct SplitExerciseAssignmentAddEditView: View {
var body: some View {
NavigationStack {
Form {
Section (header: Text("Setup")) {
TextEditor(text: $model.setup)
.frame(minHeight: 60)
}
Section (header: Text("Sets/Reps")) {
Stepper("Sets: \(model.sets)", value: $model.sets, in: 1...10)
Stepper("Reps: \(model.reps)", value: $model.reps, in: 1...50)

View File

@ -30,10 +30,7 @@ struct WorkoutLogView: View {
var body: some View {
Form {
Section {
Text("Started \(workout.label)")
}
Section {
Section (header: Text("\(workout.label)")) {
List {
ForEach (sortedWorkoutLogs) { log in
let badges = log.completed ? [Badge(text: "Completed", color: .green)] : []

View File

@ -1,11 +0,0 @@
import SwiftUI
struct WorkoutView: View {
var body: some View {
Text("Workout View")
}
}
#Preview {
WorkoutView()
}