Add the Library tab: reorderable routines pane and searchable grouped exercises pane

A fourth tab promotes routine and exercise management out of Settings.
LibraryView switches between two segments on one navigation stack. The
routines pane (RoutineListView reborn as RoutinesLibraryView) sorts by
the user's order, gains drag-to-reorder writing only changed orders,
swipe actions for duplicate/edit/delete, a Starter badge on bundled
seeds, and a last-trained caption. The exercises pane groups the library
into curated category sections searchable by name, category, or muscle.

Claude-Session: https://claude.ai/code/session_01H8VxUX4ckjU3vRF5M4L5FV
This commit is contained in:
2026-07-15 10:58:57 -04:00
parent 16b61946d5
commit 586804f771
6 changed files with 285 additions and 151 deletions
+2 -27
View File
@@ -6,7 +6,6 @@
//
import SwiftUI
import SwiftData
import AVFoundation
import IndieAbout
import IndieBackup
@@ -15,8 +14,6 @@ struct SettingsView: View {
@Environment(SyncEngine.self) private var sync
@Environment(AppServices.self) private var services
@Query private var routines: [Routine]
@AppStorage("restSeconds") private var restSeconds: Int = 45
@AppStorage("doneCountdownSeconds") private var doneCountdownSeconds: Int = 5
@AppStorage("weightUnit") private var weightUnit: WeightUnit = .lb
@@ -75,8 +72,8 @@ struct SettingsView: View {
// MARK: - Voice Section
voiceSection
// MARK: - Library Section
Section(header: Text("Library")) {
// MARK: - Goals Section
Section(header: Text("Goals")) {
NavigationLink {
GoalsListView()
} label: {
@@ -87,28 +84,6 @@ struct SettingsView: View {
.foregroundStyle(.secondary)
}
}
NavigationLink {
RoutineListView()
} label: {
HStack {
Label("Routines", systemImage: "dumbbell.fill")
Spacer()
Text("\(routines.count)")
.foregroundStyle(.secondary)
}
}
NavigationLink {
ExerciseLibraryView()
} label: {
HStack {
Label("Exercises", systemImage: "figure.strengthtraining.traditional")
Spacer()
Text("\(ExerciseMotionLibrary.exerciseNames.count)")
.foregroundStyle(.secondary)
}
}
}
// MARK: - Starter Routines Section