initial pre-viable version of watch app

This commit is contained in:
2025-07-20 19:44:53 -04:00
parent 33b88cb8f0
commit 68d90160c6
35 changed files with 2108 additions and 179 deletions

View File

@ -31,29 +31,6 @@ final class Split {
static let unnamed = "Unnamed Split"
}
// MARK: - EditableEntity Conformance
extension Split: EditableEntity {
var count: Int? {
return self.exercises?.count
}
static func createNew() -> Split {
return Split(name: "")
}
static var navigationTitle: String {
return "Splits"
}
@ViewBuilder
static func formView(for model: Split) -> some View {
EntityAddEditView(model: model) { $model in
SplitFormView(model: $model)
}
}
}
// MARK: - Identifiable Conformance
extension Split: Identifiable {
@ -64,58 +41,58 @@ extension Split: Identifiable {
}
}
// MARK: - Private Form View
fileprivate struct SplitFormView: View {
@Binding var model: Split
// Available colors for splits
private let availableColors = ["red", "orange", "yellow", "green", "mint", "teal", "cyan", "blue", "indigo", "purple", "pink", "brown"]
// Available system images for splits
private let availableIcons = ["dumbbell.fill", "figure.strengthtraining.traditional", "figure.run", "figure.hiking", "figure.cooldown", "figure.boxing", "figure.wrestling", "figure.gymnastics", "figure.handball", "figure.core.training", "heart.fill", "bolt.fill"]
var body: some View {
Section(header: Text("Name")) {
TextField("Name", text: $model.name)
.bold()
}
Section(header: Text("Appearance")) {
Picker("Color", selection: $model.color) {
ForEach(availableColors, id: \.self) { colorName in
let tempSplit = Split(name: "", color: colorName)
HStack {
Circle()
.fill(tempSplit.getColor())
.frame(width: 20, height: 20)
Text(colorName.capitalized)
}
.tag(colorName)
}
}
Picker("Icon", selection: $model.systemImage) {
ForEach(availableIcons, id: \.self) { iconName in
HStack {
Image(systemName: iconName)
.frame(width: 24, height: 24)
Text(iconName.replacingOccurrences(of: ".fill", with: "").replacingOccurrences(of: "figure.", with: "").capitalized)
}
.tag(iconName)
}
}
}
Section(header: Text("Exercises")) {
NavigationLink {
ExerciseListView(split: model)
} label: {
ListItem(
text: "Exercises",
count: model.exercises?.count ?? 0
)
}
}
}
}
//// MARK: - Private Form View
//
//fileprivate struct SplitFormView: View {
// @Binding var model: Split
//
// // Available colors for splits
// private let availableColors = ["red", "orange", "yellow", "green", "mint", "teal", "cyan", "blue", "indigo", "purple", "pink", "brown"]
//
// // Available system images for splits
// private let availableIcons = ["dumbbell.fill", "figure.strengthtraining.traditional", "figure.run", "figure.hiking", "figure.cooldown", "figure.boxing", "figure.wrestling", "figure.gymnastics", "figure.handball", "figure.core.training", "heart.fill", "bolt.fill"]
//
// var body: some View {
// Section(header: Text("Name")) {
// TextField("Name", text: $model.name)
// .bold()
// }
//
// Section(header: Text("Appearance")) {
// Picker("Color", selection: $model.color) {
// ForEach(availableColors, id: \.self) { colorName in
// let tempSplit = Split(name: "", color: colorName)
// HStack {
// Circle()
// .fill(tempSplit.getColor())
// .frame(width: 20, height: 20)
// Text(colorName.capitalized)
// }
// .tag(colorName)
// }
// }
//
// Picker("Icon", selection: $model.systemImage) {
// ForEach(availableIcons, id: \.self) { iconName in
// HStack {
// Image(systemName: iconName)
// .frame(width: 24, height: 24)
// Text(iconName.replacingOccurrences(of: ".fill", with: "").replacingOccurrences(of: "figure.", with: "").capitalized)
// }
// .tag(iconName)
// }
// }
// }
//
// Section(header: Text("Exercises")) {
// NavigationLink {
// ExerciseListView(split: model)
// } label: {
// ListItem(
// text: "Exercises",
// count: model.exercises?.count ?? 0
// )
// }
// }
// }
//}