Skip to content

Commit 8a4b1e2

Browse files
OneMuppetclaude
andcommitted
iOS: add level selector to the Benchmarks list
The benchmarks list was hardcoded to Rx. Add the 7-level pill selector (shared op.level via @AppStorage) under the gender toggle so each row shows the standard for the chosen level, with the level-colored label. Verified: selecting INT shows Intermediate standards across all movements. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent f6d9747 commit 8a4b1e2

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

ios/OpenProgression/Features/Benchmarks/BenchmarksView.swift

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,28 @@ private struct SelectedBenchmark: Identifiable {
88
struct BenchmarksView: View {
99
@Environment(DataStore.self) private var store
1010
@AppStorage("op.gender") private var gender: Gender = .male
11+
@AppStorage("op.level") private var level: Int = 7
1112
@State private var selected: SelectedBenchmark?
1213

1314
private let catOrder = ["squatting","pulling","pressing","olympic_lifting","gymnastics","monostructural","bodyweight","endurance"]
1415

1516
var body: some View {
1617
ScrollView {
1718
VStack(alignment: .leading, spacing: 16) {
18-
VStack(alignment: .leading, spacing: 6) {
19+
VStack(alignment: .leading, spacing: 10) {
1920
SectionLabel(text: "The Standard")
2021
Text("Benchmarks").font(.display(28)).foregroundStyle(Theme.text)
2122
Picker("", selection: $gender) { Text("Male").tag(Gender.male); Text("Female").tag(Gender.female) }
22-
.pickerStyle(.segmented).padding(.top, 2)
23+
.pickerStyle(.segmented)
24+
ScrollView(.horizontal, showsIndicators: false) {
25+
HStack(spacing: 8) {
26+
ForEach(store.levels) { lv in
27+
Button { Haptics.select(); withAnimation(.snappy) { level = lv.number } } label: {
28+
LevelPill(name: lv.shortName, number: lv.number, selected: level == lv.number)
29+
}.buttonStyle(.plain)
30+
}
31+
}
32+
}
2333
}
2434
ForEach(catOrder, id: \.self) { catId in
2535
if let cat = store.categories.first(where: { $0.id == catId }),
@@ -48,12 +58,13 @@ struct BenchmarksView: View {
4858
}
4959

5060
private func benchmarkRow(_ b: Benchmark) -> some View {
51-
HStack {
61+
let lid = Levels.order[max(1, min(7, level)) - 1]
62+
return HStack {
5263
Text(b.name).font(.body(14, .medium)).foregroundStyle(Theme.text)
5364
Spacer()
5465
HStack(spacing: 6) {
55-
Text("Rx").font(.system(size: 11, weight: .bold)).foregroundStyle(Theme.levelColor(7))
56-
Text(benchmarkValueText(b.standards["rx"]?[gender.rawValue], b.unit)).font(.body(14, .semibold)).foregroundStyle(Theme.textDim)
66+
Text(store.level(number: level)?.shortName ?? "").font(.system(size: 11, weight: .bold)).foregroundStyle(Theme.levelColor(level))
67+
Text(benchmarkValueText(b.standards[lid]?[gender.rawValue], b.unit)).font(.body(14, .semibold)).foregroundStyle(Theme.textDim)
5768
Image(systemName: "chevron.right").font(.system(size: 10, weight: .bold)).foregroundStyle(Theme.textFaint)
5869
}
5970
}

0 commit comments

Comments
 (0)