Restructure into a three-tab app with Progress, goals, and Meditation

The UX redesign's first landing (spec in UX-REDESIGN.md): ContentView
becomes a Today / Progress / Settings TabView, "Routine" replaces
"Split" in every user-facing string and view name (code-level types
keep their names), and workout starting moves to shared
WorkoutStarter / StartedWorkoutNavigator plumbing.

- New Progress tab: weekly goal streaks, workout trends, per-exercise
  weight progression, achievements, and the full history list
  (WorkoutLogsView -> WorkoutHistoryView).
- Goals: stable categories workouts roll up to, managed from Settings.
- New Meditation exercise + starter routine; timed sits record to
  Apple Health as Mind & Body sessions.

Claude-Session: https://claude.ai/code/session_012qw2itfzKyEJ1HpsFt8Ex4
This commit is contained in:
2026-07-11 07:53:01 -04:00
parent 5c201289fb
commit 6e440317c4
97 changed files with 5354 additions and 1291 deletions
@@ -17,14 +17,14 @@ struct WatchConnectivityBridgeTests {
private static let ts = Date(timeIntervalSince1970: 1_700_000_000)
private func makeContainer() throws -> ModelContainer {
let schema = Schema([Split.self, Exercise.self, Workout.self, WorkoutLog.self])
let schema = Schema([Routine.self, Exercise.self, Workout.self, WorkoutLog.self])
let config = ModelConfiguration(schema: schema, isStoredInMemoryOnly: true, cloudKitDatabase: .none)
return try ModelContainer(for: schema, configurations: [config])
}
private func workout(id: String, name: String, splitName: String) -> WorkoutDocument {
private func workout(id: String, name: String, routineName: String) -> WorkoutDocument {
WorkoutDocument(
schemaVersion: WorkoutDocument.currentSchemaVersion, id: id, splitID: "S", splitName: splitName,
schemaVersion: WorkoutDocument.currentSchemaVersion, id: id, routineID: "S", routineName: routineName,
start: Self.ts, end: nil, status: WorkoutStatus.inProgress.rawValue,
createdAt: Self.ts, updatedAt: Self.ts,
logs: [WorkoutLogDocument(id: "L-\(id)", exerciseName: name, order: 0, sets: 4,
@@ -38,7 +38,7 @@ struct WatchConnectivityBridgeTests {
@Test func updateWritesWorkoutOptimisticallyIntoTheCache() throws {
let container = try makeContainer()
let bridge = WatchConnectivityBridge(container: container)
let doc = workout(id: "01WKOPT", name: "Bench Press", splitName: "Push")
let doc = workout(id: "01WKOPT", name: "Bench Press", routineName: "Push")
#expect(CacheMapper.fetchWorkout(id: doc.id, in: container.mainContext) == nil)
@@ -46,7 +46,7 @@ struct WatchConnectivityBridgeTests {
let fetched = try #require(CacheMapper.fetchWorkout(id: doc.id, in: container.mainContext))
#expect(fetched.id == "01WKOPT")
#expect(fetched.splitName == "Push")
#expect(fetched.routineName == "Push")
#expect(fetched.logsArray.first?.exerciseName == "Bench Press")
}
@@ -54,16 +54,16 @@ struct WatchConnectivityBridgeTests {
let container = try makeContainer()
let bridge = WatchConnectivityBridge(container: container)
bridge.update(workout: workout(id: "01WKEDIT", name: "Bench Press", splitName: "Push"))
bridge.update(workout: workout(id: "01WKEDIT", name: "Bench Press", routineName: "Push"))
var edited = workout(id: "01WKEDIT", name: "Incline Press", splitName: "Push Day")
var edited = workout(id: "01WKEDIT", name: "Incline Press", routineName: "Push Day")
edited.status = WorkoutStatus.completed.rawValue
bridge.update(workout: edited)
let all = try container.mainContext.fetch(FetchDescriptor<Workout>())
#expect(all.count == 1) // updated in place, not duplicated
let fetched = try #require(CacheMapper.fetchWorkout(id: "01WKEDIT", in: container.mainContext))
#expect(fetched.splitName == "Push Day")
#expect(fetched.routineName == "Push Day")
#expect(fetched.status == .completed)
#expect(fetched.logsArray.first?.exerciseName == "Incline Press")
}
@@ -72,7 +72,7 @@ struct WatchConnectivityBridgeTests {
let bridge = try WatchConnectivityBridge(container: makeContainer())
#expect(bridge.lastSyncDate == nil)
#expect(bridge.editingWorkoutID == nil)
#expect(bridge.editingSplitID == nil)
#expect(bridge.editingRoutineID == nil)
#expect(bridge.liveIncoming == nil)
#expect(bridge.presentable == nil)
#expect(bridge.navigatedRunID == nil)