51 lines
1.6 KiB
Swift
51 lines
1.6 KiB
Swift
//
|
||
// WorkoutDetailView.swift
|
||
// Workouts
|
||
//
|
||
// Created by rzen on 7/22/25 at 9:54 PM.
|
||
//
|
||
// Copyright 2025 Rouslan Zenetl. All Rights Reserved.
|
||
//
|
||
|
||
import SwiftUI
|
||
|
||
struct WorkoutDetailView: View {
|
||
let workout: Workout
|
||
|
||
var body: some View {
|
||
VStack(alignment: .center, spacing: 8) {
|
||
if let logs = workout.logs?.sorted(by: { $0.order < $1.order }), !logs.isEmpty {
|
||
List {
|
||
ForEach(logs) { log in
|
||
NavigationLink {
|
||
ExerciseProgressControlView(log: log)
|
||
} label: {
|
||
WorkoutLogCardView(log: log)
|
||
}
|
||
.listRowBackground(
|
||
RoundedRectangle(cornerRadius: 12)
|
||
.fill(Color.secondary.opacity(0.2))
|
||
.padding(
|
||
EdgeInsets(
|
||
top: 4,
|
||
leading: 8,
|
||
bottom: 4,
|
||
trailing: 8
|
||
)
|
||
)
|
||
)
|
||
}
|
||
}
|
||
.listStyle(.carousel)
|
||
} else {
|
||
Text("No exercises in this workout")
|
||
.font(.body)
|
||
.foregroundStyle(.secondary)
|
||
.padding()
|
||
|
||
Spacer()
|
||
}
|
||
}
|
||
}
|
||
}
|