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
42 lines
1.2 KiB
Swift
42 lines
1.2 KiB
Swift
//
|
|
// GoalsListView.swift
|
|
// Workouts
|
|
//
|
|
// Copyright 2026 Rouslan Zenetl. All Rights Reserved.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
/// A reorderable list of the practice-goal kinds. The chosen order is persisted via
|
|
/// `GoalKind.saveOrder` and drives how schedules group on the Today screen. Pushed
|
|
/// from Settings → Library, so it relies on Settings' own NavigationStack.
|
|
struct GoalsListView: View {
|
|
@State private var order: [GoalKind] = []
|
|
|
|
var body: some View {
|
|
List {
|
|
Section {
|
|
ForEach(order) { kind in
|
|
Label(kind.displayName, systemImage: kind.systemImage)
|
|
.foregroundStyle(Color.color(from: kind.colorName))
|
|
}
|
|
.onMove(perform: move)
|
|
} footer: {
|
|
Text("Goals group your schedules on the Today screen. Drag to reorder.")
|
|
}
|
|
}
|
|
.navigationTitle("Goals")
|
|
.toolbar {
|
|
EditButton()
|
|
}
|
|
.onAppear {
|
|
if order.isEmpty { order = GoalKind.orderedCases() }
|
|
}
|
|
}
|
|
|
|
private func move(from source: IndexSet, to destination: Int) {
|
|
order.move(fromOffsets: source, toOffset: destination)
|
|
GoalKind.saveOrder(order)
|
|
}
|
|
}
|