@titan-design/react-ui 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.js +20 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -21
- package/dist/index.mjs.map +1 -1
- package/dist/pages.js +2 -1
- package/dist/pages.js.map +1 -1
- package/dist/pages.mjs +2 -1
- package/dist/pages.mjs.map +1 -1
- package/package.json +2 -1
- package/src/components/custom/Workout/ExerciseHeading.tsx +5 -3
- package/src/components/custom/Workout/SessionHeader.tsx +6 -5
- package/src/components/custom/Workout/SessionRail.tsx +18 -7
- package/src/components/custom/Workout/SetsRepsLoad.tsx +2 -1
- package/src/components/shell/DashboardShell.tsx +7 -9
- package/src/components/shell/NavItem.tsx +6 -1
- package/src/test/no-device-internals.test.ts +51 -0
- package/src/lab/north-star/LivePage.tsx +0 -101
- package/src/lab/north-star/LiveView.tsx +0 -409
- package/src/lab/north-star/LiveWallDashboard.stories.tsx +0 -129
- package/src/lab/north-star/RestView.tsx +0 -140
- package/src/lab/north-star/fixtures.ts +0 -224
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fixtures for the `Lab/North Star/Live Wall Dashboard` specimen.
|
|
3
|
-
*
|
|
4
|
-
* Shapes deliberately MIRROR the voltras-mcp dashboard store read-models so a later
|
|
5
|
-
* provisional wiring is a mechanical field map, not a reshape:
|
|
6
|
-
* - {@link LiveModel} — the live-set telemetry read-model (`velocity`, `force`,
|
|
7
|
-
* `phase`, `lastRep`, `velocityLossPct`).
|
|
8
|
-
* - {@link SessionModel} — the session read-model (`exerciseName` + completed sets).
|
|
9
|
-
* - {@link CompletedSet} — a logged set (`weightLbs`, `mode`, `repCount`, `reps`).
|
|
10
|
-
*
|
|
11
|
-
* The presentational titan props each view consumes are DERIVED from these read-models
|
|
12
|
-
* (see the `derive*` helpers) — the same projection the store→component adapter will do.
|
|
13
|
-
* Numbers are realistic cable chest-press strength-training values.
|
|
14
|
-
*/
|
|
15
|
-
import type { SessionRailExercise } from '../../components'
|
|
16
|
-
|
|
17
|
-
// --- Store read-model shapes (mirror voltras-mcp dashboard store) -------------
|
|
18
|
-
|
|
19
|
-
/** One completed rep's per-rep telemetry (mean-concentric metric family). */
|
|
20
|
-
export interface RepModel {
|
|
21
|
-
/** Mean CONCENTRIC velocity (m/s) — the canonical metric (brain WA-D02). */
|
|
22
|
-
vCon: number
|
|
23
|
-
/** Range of motion (m). */
|
|
24
|
-
rom: number
|
|
25
|
-
/** Peak instantaneous velocity (m/s). */
|
|
26
|
-
peakVelocity: number
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** The live-set telemetry read-model. */
|
|
30
|
-
export interface LiveModel {
|
|
31
|
-
/** Instantaneous cable velocity (m/s). */
|
|
32
|
-
velocity: number
|
|
33
|
-
/** Instantaneous cable force (N). */
|
|
34
|
-
force: number
|
|
35
|
-
/** Current movement phase. */
|
|
36
|
-
phase: 'concentric' | 'hold' | 'eccentric' | 'idle'
|
|
37
|
-
/** Elapsed time (ms) within the current phase — drives the live tempo fill. */
|
|
38
|
-
phaseElapsedMs: number
|
|
39
|
-
/** The most-recently completed rep. */
|
|
40
|
-
lastRep: RepModel
|
|
41
|
-
/** Per-rep mean-concentric velocities logged so far this set (m/s). */
|
|
42
|
-
repVelocities: number[]
|
|
43
|
-
/** Velocity loss vs the set's best rep (%). Drives verdict + aura + fatigue. */
|
|
44
|
-
velocityLossPct: number
|
|
45
|
-
/** Peak concentric force this set (N). */
|
|
46
|
-
peakForce: number
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/** A logged set on the session read-model. */
|
|
50
|
-
export interface CompletedSet {
|
|
51
|
-
weightLbs: number
|
|
52
|
-
/** Resistance mode (cascade echo, cmd=0x10). */
|
|
53
|
-
mode: 'weight' | 'chains' | 'eccentric' | 'isokinetic'
|
|
54
|
-
repCount: number
|
|
55
|
-
/** Per-rep mean-concentric velocities (m/s). */
|
|
56
|
-
reps: number[]
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/** The session read-model. */
|
|
60
|
-
export interface SessionModel {
|
|
61
|
-
exerciseName: string
|
|
62
|
-
title: string
|
|
63
|
-
weightLbs: number
|
|
64
|
-
unit: 'lbs' | 'kg'
|
|
65
|
-
/**
|
|
66
|
-
* Prescribed tempo tuple [ecc, pauseBottom, con, pauseTop]. OPTIONAL — a set may carry no
|
|
67
|
-
* prescribed tempo (coach left it unset and no exercise default); the live view then hides
|
|
68
|
-
* the tempo readout entirely rather than inventing one.
|
|
69
|
-
*/
|
|
70
|
-
tempo?: [number, number, number, number]
|
|
71
|
-
completedSets: CompletedSet[]
|
|
72
|
-
plannedSets: number
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/** The full store snapshot the specimen reads. */
|
|
76
|
-
export interface DashboardModel {
|
|
77
|
-
live: LiveModel
|
|
78
|
-
session: SessionModel
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// --- The fixture instance -----------------------------------------------------
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* A mid-set cable chest press: 6 reps in, velocity decaying from 0.52 → 0.405 m/s,
|
|
85
|
-
* ~22% velocity loss (the VL20–VL30 mid-zone → `threshold` verdict / amber aura).
|
|
86
|
-
*/
|
|
87
|
-
export const dashboardFixture: DashboardModel = {
|
|
88
|
-
live: {
|
|
89
|
-
velocity: 0.41,
|
|
90
|
-
force: 498,
|
|
91
|
-
phase: 'concentric',
|
|
92
|
-
phaseElapsedMs: 700,
|
|
93
|
-
lastRep: { vCon: 0.405, rom: 0.58, peakVelocity: 0.61 },
|
|
94
|
-
repVelocities: [0.52, 0.5, 0.48, 0.46, 0.44, 0.405],
|
|
95
|
-
velocityLossPct: 22,
|
|
96
|
-
peakForce: 542,
|
|
97
|
-
},
|
|
98
|
-
session: {
|
|
99
|
-
exerciseName: 'Cable Chest Press',
|
|
100
|
-
title: 'Push A · Hypertrophy',
|
|
101
|
-
weightLbs: 140,
|
|
102
|
-
unit: 'lbs',
|
|
103
|
-
tempo: [3, 1, 1, 0],
|
|
104
|
-
plannedSets: 4,
|
|
105
|
-
completedSets: [
|
|
106
|
-
{
|
|
107
|
-
weightLbs: 140,
|
|
108
|
-
mode: 'weight',
|
|
109
|
-
repCount: 8,
|
|
110
|
-
reps: [0.55, 0.54, 0.52, 0.51, 0.49, 0.47, 0.45, 0.43],
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
weightLbs: 140,
|
|
114
|
-
mode: 'weight',
|
|
115
|
-
repCount: 8,
|
|
116
|
-
reps: [0.53, 0.52, 0.5, 0.48, 0.46, 0.44, 0.42, 0.4],
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
},
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// --- Derived projections (store read-model → titan presentational props) -------
|
|
123
|
-
|
|
124
|
-
/** Arithmetic mean of a per-rep velocity array (m/s). */
|
|
125
|
-
export function meanVelocity(reps: number[]): number {
|
|
126
|
-
if (reps.length === 0) return 0
|
|
127
|
-
return reps.reduce((a, v) => a + v, 0) / reps.length
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/** Verdict status from velocity loss %, matching FatigueMeter's VL20/VL30 bands. */
|
|
131
|
-
export function verdictFromLoss(lossPct: number): 'productive' | 'threshold' | 'stop' {
|
|
132
|
-
if (lossPct >= 30) return 'stop'
|
|
133
|
-
if (lossPct >= 20) return 'threshold'
|
|
134
|
-
return 'productive'
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* The session rail's exercise list, projected from the model: the current exercise
|
|
139
|
-
* (active), the completed sets behind it, and an upcoming accessory.
|
|
140
|
-
*/
|
|
141
|
-
export function deriveRailExercises(model: DashboardModel): SessionRailExercise[] {
|
|
142
|
-
const { session, live } = model
|
|
143
|
-
return [
|
|
144
|
-
{
|
|
145
|
-
id: 'chest-press',
|
|
146
|
-
name: session.exerciseName,
|
|
147
|
-
summary: {
|
|
148
|
-
sets: session.plannedSets,
|
|
149
|
-
reps: 8,
|
|
150
|
-
weight: session.weightLbs,
|
|
151
|
-
unit: session.unit,
|
|
152
|
-
},
|
|
153
|
-
tempo: session.tempo,
|
|
154
|
-
indicator: 'velocity-loss',
|
|
155
|
-
setStates: [
|
|
156
|
-
{ status: 'done', velocities: session.completedSets[0].reps },
|
|
157
|
-
{ status: 'done', velocities: session.completedSets[1].reps },
|
|
158
|
-
{ status: 'active', velocities: live.repVelocities, planned: 8 },
|
|
159
|
-
{ status: 'todo', planned: 8 },
|
|
160
|
-
],
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
id: 'incline-db',
|
|
164
|
-
name: 'Incline DB Press',
|
|
165
|
-
summary: { sets: 3, reps: 10, weight: 55, unit: 'lbs' },
|
|
166
|
-
tempo: [2, 0, 1, 0],
|
|
167
|
-
setStates: [
|
|
168
|
-
{ status: 'todo', planned: 10 },
|
|
169
|
-
{ status: 'todo', planned: 10 },
|
|
170
|
-
{ status: 'todo', planned: 10 },
|
|
171
|
-
],
|
|
172
|
-
upcoming: true,
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
id: 'cable-fly',
|
|
176
|
-
name: 'Cable Fly',
|
|
177
|
-
summary: { sets: 3, reps: 12, weight: 30, unit: 'lbs' },
|
|
178
|
-
setStates: [
|
|
179
|
-
{ status: 'todo', planned: 12 },
|
|
180
|
-
{ status: 'todo', planned: 12 },
|
|
181
|
-
{ status: 'todo', planned: 12 },
|
|
182
|
-
],
|
|
183
|
-
upcoming: true,
|
|
184
|
-
},
|
|
185
|
-
]
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// --- Dual-mode (bilateral) projection -----------------------------------------
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Split a single-cable model into a bilateral (dual-mode) pair — one model per voltra.
|
|
192
|
-
*
|
|
193
|
-
* A dual-mode exercise drives two Voltra devices as a left/right pair. For v1 the two
|
|
194
|
-
* layers are rendered independently (one {@link LiveModel} each); a unified split-bar
|
|
195
|
-
* treatment is deferred. The fixture gives the RIGHT side a realistic left-dominant
|
|
196
|
-
* deficit (slightly slower reps, more velocity loss, a touch less force) so the two
|
|
197
|
-
* layers read as genuinely different streams rather than a mirror.
|
|
198
|
-
*/
|
|
199
|
-
export function deriveDualModel(base: DashboardModel = dashboardFixture): {
|
|
200
|
-
left: DashboardModel
|
|
201
|
-
right: DashboardModel
|
|
202
|
-
} {
|
|
203
|
-
// Left is the dominant side — the base fixture verbatim.
|
|
204
|
-
const left: DashboardModel = base
|
|
205
|
-
// Right lags: ~8% slower per-rep concentric velocity, +7 pts velocity loss, ~6% less force.
|
|
206
|
-
const scale = (v: number) => Number((v * 0.92).toFixed(3))
|
|
207
|
-
const right: DashboardModel = {
|
|
208
|
-
session: base.session,
|
|
209
|
-
live: {
|
|
210
|
-
...base.live,
|
|
211
|
-
velocity: scale(base.live.velocity),
|
|
212
|
-
force: Math.round(base.live.force * 0.94),
|
|
213
|
-
peakForce: Math.round(base.live.peakForce * 0.94),
|
|
214
|
-
velocityLossPct: base.live.velocityLossPct + 7,
|
|
215
|
-
repVelocities: base.live.repVelocities.map(scale),
|
|
216
|
-
lastRep: {
|
|
217
|
-
vCon: scale(base.live.lastRep.vCon),
|
|
218
|
-
rom: Number((base.live.lastRep.rom * 0.96).toFixed(2)),
|
|
219
|
-
peakVelocity: scale(base.live.lastRep.peakVelocity),
|
|
220
|
-
},
|
|
221
|
-
},
|
|
222
|
-
}
|
|
223
|
-
return { left, right }
|
|
224
|
-
}
|