- Copy ExerciseView from Workouts_old, adapt for CoreData - Add WeightProgressionChartView with historical weight data and chart - Refactor CheckboxListItem to use Button for checkbox tap handling - Update WorkoutLogListView to use NavigationLink for exercise details - Checkbox taps now only cycle status, row tap navigates to exercise
53 lines
1.4 KiB
Swift
53 lines
1.4 KiB
Swift
//
|
|
// CheckboxListItem.swift
|
|
// Workouts
|
|
//
|
|
// Created by rzen on 7/13/25 at 10:42 AM.
|
|
//
|
|
// Copyright 2025 Rouslan Zenetl. All Rights Reserved.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct CheckboxListItem: View {
|
|
var status: CheckboxStatus
|
|
var title: String
|
|
var subtitle: String?
|
|
var count: Int?
|
|
var onCheckboxTap: (() -> Void)? = nil
|
|
|
|
var body: some View {
|
|
HStack(alignment: .top) {
|
|
Button {
|
|
onCheckboxTap?()
|
|
} label: {
|
|
Image(systemName: status.systemName)
|
|
.resizable()
|
|
.scaledToFit()
|
|
.frame(width: 30, height: 30)
|
|
.foregroundStyle(status.color)
|
|
}
|
|
.buttonStyle(.plain)
|
|
VStack(alignment: .leading) {
|
|
Text("\(title)")
|
|
.font(.headline)
|
|
.foregroundColor(.primary)
|
|
HStack(alignment: .bottom) {
|
|
if let subtitle = subtitle {
|
|
Text("\(subtitle)")
|
|
.font(.footnote)
|
|
.foregroundColor(.secondary)
|
|
}
|
|
}
|
|
}
|
|
Spacer()
|
|
if let count = count {
|
|
Text("\(count)")
|
|
.font(.caption)
|
|
.foregroundColor(.gray)
|
|
}
|
|
}
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
}
|
|
}
|