wip
This commit is contained in:
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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())
|
||||
}
|
||||
|
@ -18,13 +18,18 @@ struct SplitExerciseAssignmentAddEditView: View {
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
Form {
|
||||
Section(header: Text("Sets/Reps")) {
|
||||
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)
|
||||
}
|
||||
|
||||
// Weight section
|
||||
Section(header: Text("Weight")) {
|
||||
Section (header: Text("Weight")) {
|
||||
HStack {
|
||||
VStack(alignment: .center) {
|
||||
Text("\(model.weight) lbs")
|
||||
|
@ -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)] : []
|
||||
|
@ -1,11 +0,0 @@
|
||||
import SwiftUI
|
||||
|
||||
struct WorkoutView: View {
|
||||
var body: some View {
|
||||
Text("Workout View")
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
WorkoutView()
|
||||
}
|
Reference in New Issue
Block a user