70 lines
2.0 KiB
Swift
70 lines
2.0 KiB
Swift
//
|
||
// WorkoutLogDetailView.swift
|
||
// Workouts
|
||
//
|
||
// Created by rzen on 7/22/25 at 9:57 PM.
|
||
//
|
||
// Copyright 2025 Rouslan Zenetl. All Rights Reserved.
|
||
//
|
||
|
||
import SwiftUI
|
||
|
||
struct WorkoutLogDetailView: View {
|
||
let log: WorkoutLog
|
||
|
||
var body: some View {
|
||
NavigationLink {
|
||
ExerciseProgressControlView(log: log)
|
||
} label: {
|
||
VStack(alignment: .center) {
|
||
Text(log.exerciseName)
|
||
.font(.title)
|
||
.lineLimit(1)
|
||
.minimumScaleFactor(0.5)
|
||
.layoutPriority(1)
|
||
|
||
HStack (alignment: .bottom) {
|
||
Text("\(log.weight)")
|
||
Text( "lbs")
|
||
.fontWeight(.light)
|
||
.padding([.trailing], 10)
|
||
|
||
Text("\(log.sets)")
|
||
Text("×")
|
||
.fontWeight(.light)
|
||
Text("\(log.reps)")
|
||
}
|
||
.font(.title3)
|
||
.lineLimit(1)
|
||
.minimumScaleFactor(0.5)
|
||
.layoutPriority(1)
|
||
|
||
Text(log.status?.name ?? "Not Started")
|
||
.foregroundStyle(Color.accentColor)
|
||
|
||
Text("Tap to start")
|
||
.foregroundStyle(Color.accentColor)
|
||
|
||
}
|
||
.padding()
|
||
|
||
}
|
||
.buttonStyle(.plain)
|
||
}
|
||
|
||
private func statusColor(for status: WorkoutStatus?) -> Color {
|
||
guard let status = status else { return .secondary }
|
||
|
||
switch status {
|
||
case .notStarted:
|
||
return .secondary
|
||
case .inProgress:
|
||
return .blue
|
||
case .completed:
|
||
return .green
|
||
case .skipped:
|
||
return .red
|
||
}
|
||
}
|
||
}
|