@burdenoff/microfe-atheletebridge 2026.1116.1 → 2026.1123.1
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/atheletebridge/AthleteBridgeRoot.js +71 -55
- package/dist/atheletebridge/AthleteBridgeRoot.js.map +1 -1
- package/dist/atheletebridge/AthleteBridgeRoutes.js +30 -6
- package/dist/atheletebridge/AthleteBridgeRoutes.js.map +1 -1
- package/dist/atheletebridge/components/MatchupRow.js +11 -2
- package/dist/atheletebridge/components/MatchupRow.js.map +1 -1
- package/dist/atheletebridge/components/analytics/AiInsightsPanel.d.ts +5 -0
- package/dist/atheletebridge/components/analytics/AiInsightsPanel.js +617 -0
- package/dist/atheletebridge/components/analytics/AiInsightsPanel.js.map +1 -0
- package/dist/atheletebridge/components/wearables/ConnectedDevicesPanel.d.ts +5 -0
- package/dist/atheletebridge/components/wearables/ConnectedDevicesPanel.js +453 -0
- package/dist/atheletebridge/components/wearables/ConnectedDevicesPanel.js.map +1 -0
- package/dist/atheletebridge/hooks/index.d.ts +2 -0
- package/dist/atheletebridge/hooks/index.js +1 -0
- package/dist/atheletebridge/hooks/useInsightsWearablesMarketplaceApi.d.ts +62 -0
- package/dist/atheletebridge/hooks/useInsightsWearablesMarketplaceApi.js +362 -0
- package/dist/atheletebridge/hooks/useInsightsWearablesMarketplaceApi.js.map +1 -0
- package/dist/atheletebridge/pages/DashboardPage.js +71 -1
- package/dist/atheletebridge/pages/DashboardPage.js.map +1 -1
- package/dist/atheletebridge/pages/analytics/CoachAnalyticsPage.d.ts +3 -1
- package/dist/atheletebridge/pages/analytics/CoachAnalyticsPage.js +346 -317
- package/dist/atheletebridge/pages/analytics/CoachAnalyticsPage.js.map +1 -1
- package/dist/atheletebridge/pages/athletes/AthleteProfilePage.js +171 -159
- package/dist/atheletebridge/pages/athletes/AthleteProfilePage.js.map +1 -1
- package/dist/atheletebridge/pages/devices/ConnectedDevicesPage.d.ts +1 -0
- package/dist/atheletebridge/pages/devices/ConnectedDevicesPage.js +14 -0
- package/dist/atheletebridge/pages/devices/ConnectedDevicesPage.js.map +1 -0
- package/dist/atheletebridge/pages/marketplace/MarketplacePage.d.ts +1 -0
- package/dist/atheletebridge/pages/marketplace/MarketplacePage.js +756 -0
- package/dist/atheletebridge/pages/marketplace/MarketplacePage.js.map +1 -0
- package/dist/atheletebridge/pages/performance/PerformancePage.js +296 -277
- package/dist/atheletebridge/pages/performance/PerformancePage.js.map +1 -1
- package/dist/atheletebridge/pages/sessions/SessionDetailPage.js +279 -147
- package/dist/atheletebridge/pages/sessions/SessionDetailPage.js.map +1 -1
- package/dist/atheletebridge/types/index.d.ts +1 -0
- package/dist/atheletebridge/types/insights.d.ts +270 -0
- package/package.json +1 -1
|
@@ -0,0 +1,617 @@
|
|
|
1
|
+
import "../viz/index.js";
|
|
2
|
+
import { StatusBadge as e } from "../StatusBadge.js";
|
|
3
|
+
import { Sparkline as t } from "../viz/Sparkline.js";
|
|
4
|
+
import { ErrorState as n, LoadingState as r } from "../LoadingState.js";
|
|
5
|
+
import { useAthleteBridge as i } from "../../context/AthleteBridgeContext.js";
|
|
6
|
+
import { useAiPerformanceInsights as a, useProjectedProgress as o } from "../../hooks/useInsightsWearablesMarketplaceApi.js";
|
|
7
|
+
import { formatDate as s } from "../../utils/formatters.js";
|
|
8
|
+
import { cn as c } from "../../utils/cn.js";
|
|
9
|
+
import { useMemo as l, useState as u } from "react";
|
|
10
|
+
import { Activity as d, AlertTriangle as f, ArrowDownRight as p, ArrowUpRight as m, CalendarClock as h, CheckCircle2 as g, ChevronRight as _, HeartPulse as v, Info as y, ShieldAlert as b, Sparkles as x, Target as S, TrendingUp as C } from "lucide-react";
|
|
11
|
+
import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
12
|
+
import { Badge as D, GlassCard as O, Tooltip as k, TooltipContent as A, TooltipProvider as j, TooltipTrigger as M } from "@burdenoff/fe-libs/ui";
|
|
13
|
+
// src/atheletebridge/components/analytics/AiInsightsPanel.tsx
|
|
14
|
+
var N = {
|
|
15
|
+
LOW: {
|
|
16
|
+
label: "Low",
|
|
17
|
+
toneClass: "text-[var(--color-accent-teal)]",
|
|
18
|
+
arcStroke: "var(--color-accent-teal)",
|
|
19
|
+
progressPct: 30
|
|
20
|
+
},
|
|
21
|
+
MODERATE: {
|
|
22
|
+
label: "Moderate",
|
|
23
|
+
toneClass: "text-status-warning-text",
|
|
24
|
+
arcStroke: "var(--color-status-warning-text)",
|
|
25
|
+
progressPct: 62
|
|
26
|
+
},
|
|
27
|
+
HIGH: {
|
|
28
|
+
label: "High",
|
|
29
|
+
toneClass: "text-status-error-text",
|
|
30
|
+
arcStroke: "var(--color-status-error-text)",
|
|
31
|
+
progressPct: 90
|
|
32
|
+
},
|
|
33
|
+
INSUFFICIENT_DATA: {
|
|
34
|
+
label: "Not enough data",
|
|
35
|
+
toneClass: "text-text-muted",
|
|
36
|
+
arcStroke: "var(--color-border-seam)",
|
|
37
|
+
progressPct: 0
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
function P(e) {
|
|
41
|
+
switch (e) {
|
|
42
|
+
case "CRITICAL": return "border-status-error-border bg-status-error-bg-subtle text-status-error-text";
|
|
43
|
+
case "WARNING": return "border-status-warning-border bg-status-warning-bg-subtle text-status-warning-text";
|
|
44
|
+
case "POSITIVE": return "border-status-success-border bg-status-success-bg-subtle text-status-success-text";
|
|
45
|
+
case "INFO": return "border-border-seam bg-bg-sunken text-text-secondary";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function F({ title: e, icon: n, kpi: r }) {
|
|
49
|
+
let i = r.deltaPct;
|
|
50
|
+
return /* @__PURE__ */ E(O, {
|
|
51
|
+
treatment: "metric",
|
|
52
|
+
className: "flex flex-col justify-between gap-3 p-5",
|
|
53
|
+
children: [/* @__PURE__ */ E("div", {
|
|
54
|
+
className: "flex items-start justify-between gap-2",
|
|
55
|
+
children: [/* @__PURE__ */ E("div", {
|
|
56
|
+
className: "flex items-center gap-2.5",
|
|
57
|
+
children: [/* @__PURE__ */ T("span", {
|
|
58
|
+
className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-[var(--color-accent-soft)] text-[var(--color-accent-teal)]",
|
|
59
|
+
children: n
|
|
60
|
+
}), /* @__PURE__ */ T("span", {
|
|
61
|
+
className: "text-sm font-medium text-text-secondary",
|
|
62
|
+
children: e
|
|
63
|
+
})]
|
|
64
|
+
}), /* @__PURE__ */ T(j, { children: /* @__PURE__ */ E(k, { children: [/* @__PURE__ */ T(M, {
|
|
65
|
+
asChild: !0,
|
|
66
|
+
children: /* @__PURE__ */ T("button", {
|
|
67
|
+
type: "button",
|
|
68
|
+
"aria-label": `About ${e}`,
|
|
69
|
+
className: "rounded-full p-1 text-text-muted transition-colors hover:text-text-primary",
|
|
70
|
+
children: /* @__PURE__ */ T(y, { className: "h-3.5 w-3.5" })
|
|
71
|
+
})
|
|
72
|
+
}), /* @__PURE__ */ T(A, {
|
|
73
|
+
className: "max-w-xs",
|
|
74
|
+
children: r.note
|
|
75
|
+
})] }) })]
|
|
76
|
+
}), /* @__PURE__ */ E("div", {
|
|
77
|
+
className: "flex items-end justify-between gap-3",
|
|
78
|
+
children: [/* @__PURE__ */ E("div", { children: [r.dataAvailable && r.value !== null ? /* @__PURE__ */ E("p", {
|
|
79
|
+
className: "text-3xl font-bold leading-none tabular-nums text-text-primary",
|
|
80
|
+
children: [r.value.toLocaleString(), r.unit ? /* @__PURE__ */ T("span", {
|
|
81
|
+
className: "ml-1 text-sm font-medium text-text-secondary",
|
|
82
|
+
children: r.unit
|
|
83
|
+
}) : null]
|
|
84
|
+
}) : /* @__PURE__ */ T("p", {
|
|
85
|
+
className: "text-base font-semibold text-text-muted",
|
|
86
|
+
children: "Not logged"
|
|
87
|
+
}), /* @__PURE__ */ T("div", {
|
|
88
|
+
className: "mt-2 flex items-center gap-1 text-xs",
|
|
89
|
+
children: r.dataAvailable && i !== null ? /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ E("span", {
|
|
90
|
+
className: c("inline-flex items-center font-semibold tabular-nums", i >= 0 ? "text-status-success-text" : "text-status-warning-text"),
|
|
91
|
+
children: [
|
|
92
|
+
T(i >= 0 ? m : p, {
|
|
93
|
+
className: "h-3.5 w-3.5",
|
|
94
|
+
"aria-hidden": "true"
|
|
95
|
+
}),
|
|
96
|
+
Math.abs(i),
|
|
97
|
+
"%"
|
|
98
|
+
]
|
|
99
|
+
}), /* @__PURE__ */ T("span", {
|
|
100
|
+
className: "text-text-muted",
|
|
101
|
+
children: "vs last 7 days"
|
|
102
|
+
})] }) : /* @__PURE__ */ T("span", {
|
|
103
|
+
className: "text-text-muted line-clamp-1",
|
|
104
|
+
children: r.note
|
|
105
|
+
})
|
|
106
|
+
})] }), r.trend.length > 1 ? /* @__PURE__ */ T("div", {
|
|
107
|
+
className: "w-20 shrink-0",
|
|
108
|
+
children: /* @__PURE__ */ T(t, {
|
|
109
|
+
data: r.trend,
|
|
110
|
+
variant: "area",
|
|
111
|
+
height: 34,
|
|
112
|
+
label: `${e} trend`
|
|
113
|
+
})
|
|
114
|
+
}) : null]
|
|
115
|
+
})]
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function I({ level: e, acwr: t }) {
|
|
119
|
+
let n = N[e], r = 2 * Math.PI * 56, i = r * .75, a = i * (n.progressPct / 100);
|
|
120
|
+
return /* @__PURE__ */ E("div", {
|
|
121
|
+
className: "relative mx-auto flex h-36 w-36 items-center justify-center",
|
|
122
|
+
children: [/* @__PURE__ */ E("svg", {
|
|
123
|
+
viewBox: "0 0 140 140",
|
|
124
|
+
className: "h-full w-full",
|
|
125
|
+
role: "img",
|
|
126
|
+
"aria-label": `Injury risk: ${n.label}`,
|
|
127
|
+
children: [/* @__PURE__ */ T("circle", {
|
|
128
|
+
cx: "70",
|
|
129
|
+
cy: "70",
|
|
130
|
+
r: 56,
|
|
131
|
+
fill: "none",
|
|
132
|
+
stroke: "var(--color-border-seam)",
|
|
133
|
+
strokeWidth: "10",
|
|
134
|
+
strokeLinecap: "round",
|
|
135
|
+
strokeDasharray: `${i} ${r}`,
|
|
136
|
+
transform: "rotate(135 70 70)"
|
|
137
|
+
}), a > 0 ? /* @__PURE__ */ T("circle", {
|
|
138
|
+
cx: "70",
|
|
139
|
+
cy: "70",
|
|
140
|
+
r: 56,
|
|
141
|
+
fill: "none",
|
|
142
|
+
stroke: n.arcStroke,
|
|
143
|
+
strokeWidth: "10",
|
|
144
|
+
strokeLinecap: "round",
|
|
145
|
+
strokeDasharray: `${a} ${r}`,
|
|
146
|
+
transform: "rotate(135 70 70)"
|
|
147
|
+
}) : null]
|
|
148
|
+
}), /* @__PURE__ */ E("div", {
|
|
149
|
+
className: "absolute inset-0 flex flex-col items-center justify-center text-center",
|
|
150
|
+
children: [/* @__PURE__ */ T("span", {
|
|
151
|
+
className: c("text-xl font-bold leading-tight", n.toneClass),
|
|
152
|
+
children: n.label
|
|
153
|
+
}), /* @__PURE__ */ T("span", {
|
|
154
|
+
className: "mt-0.5 text-[0.7rem] uppercase tracking-wide text-text-muted",
|
|
155
|
+
children: t === null ? "Injury Risk" : `ACWR ${t.toFixed(2)}`
|
|
156
|
+
})]
|
|
157
|
+
})]
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
function L({ data: e }) {
|
|
161
|
+
let t = l(() => [...e.actualPoints, ...e.projectedPoints], [e.actualPoints, e.projectedPoints]);
|
|
162
|
+
if (!e.sufficientData || e.actualPoints.length < 2) return /* @__PURE__ */ E("div", {
|
|
163
|
+
className: "flex h-52 flex-col items-center justify-center rounded-xl border border-dashed border-border-seam bg-bg-sunken/40 p-6 text-center",
|
|
164
|
+
children: [
|
|
165
|
+
/* @__PURE__ */ T(C, {
|
|
166
|
+
className: "mb-2 h-8 w-8 text-text-muted",
|
|
167
|
+
"aria-hidden": "true"
|
|
168
|
+
}),
|
|
169
|
+
/* @__PURE__ */ T("p", {
|
|
170
|
+
className: "text-sm font-medium text-text-primary",
|
|
171
|
+
children: "Not enough readings to project yet"
|
|
172
|
+
}),
|
|
173
|
+
/* @__PURE__ */ T("p", {
|
|
174
|
+
className: "mt-1 max-w-xs text-xs text-text-muted",
|
|
175
|
+
children: e.note
|
|
176
|
+
})
|
|
177
|
+
]
|
|
178
|
+
});
|
|
179
|
+
let n = {
|
|
180
|
+
top: 18,
|
|
181
|
+
right: 16,
|
|
182
|
+
bottom: 32,
|
|
183
|
+
left: 40
|
|
184
|
+
}, r = 400 - n.left - n.right, i = 210 - n.top - n.bottom, a = t.map((e) => e.value), o = Math.min(...a), s = Math.max(...a), c = s - o || Math.abs(s) * .2 || 10, u = o - c * .15, d = s + c * .15, f = (e) => n.left + (t.length > 1 ? e / (t.length - 1) * r : r / 2), p = (e) => n.top + i - (e - u) / (d - u || 1) * i, m = e.actualPoints.map((e, t) => ({
|
|
185
|
+
x: f(t),
|
|
186
|
+
y: p(e.value),
|
|
187
|
+
point: e
|
|
188
|
+
})), h = m[m.length - 1], g = e.projectedPoints.map((t, n) => ({
|
|
189
|
+
x: f(e.actualPoints.length + n),
|
|
190
|
+
y: p(t.value),
|
|
191
|
+
point: t
|
|
192
|
+
})), _ = m.map((e, t) => `${t === 0 ? "M" : "L"} ${e.x.toFixed(1)} ${e.y.toFixed(1)}`).join(" "), v = [h, ...g].filter((e) => !!e).map((e, t) => `${t === 0 ? "M" : "L"} ${e.x.toFixed(1)} ${e.y.toFixed(1)}`).join(" "), y = [
|
|
193
|
+
0,
|
|
194
|
+
.33,
|
|
195
|
+
.66,
|
|
196
|
+
1
|
|
197
|
+
].map((e) => u + (d - u) * e);
|
|
198
|
+
return /* @__PURE__ */ T("div", {
|
|
199
|
+
className: "w-full",
|
|
200
|
+
children: /* @__PURE__ */ E("svg", {
|
|
201
|
+
viewBox: "0 0 400 210",
|
|
202
|
+
className: "h-52 w-full",
|
|
203
|
+
role: "img",
|
|
204
|
+
"aria-label": `Projected progress for ${e.metricLabel}`,
|
|
205
|
+
children: [
|
|
206
|
+
y.map((e, t) => {
|
|
207
|
+
let r = p(e);
|
|
208
|
+
return /* @__PURE__ */ E("g", { children: [/* @__PURE__ */ T("line", {
|
|
209
|
+
x1: n.left,
|
|
210
|
+
x2: 400 - n.right,
|
|
211
|
+
y1: r,
|
|
212
|
+
y2: r,
|
|
213
|
+
stroke: "var(--color-border-seam)",
|
|
214
|
+
strokeDasharray: "2 4",
|
|
215
|
+
strokeWidth: "1"
|
|
216
|
+
}), /* @__PURE__ */ T("text", {
|
|
217
|
+
x: n.left - 8,
|
|
218
|
+
y: r + 4,
|
|
219
|
+
textAnchor: "end",
|
|
220
|
+
className: "fill-text-muted text-[10px] tabular-nums",
|
|
221
|
+
children: Math.round(e)
|
|
222
|
+
})] }, t);
|
|
223
|
+
}),
|
|
224
|
+
h ? /* @__PURE__ */ E("g", { children: [/* @__PURE__ */ T("line", {
|
|
225
|
+
x1: h.x,
|
|
226
|
+
x2: h.x,
|
|
227
|
+
y1: n.top,
|
|
228
|
+
y2: 210 - n.bottom,
|
|
229
|
+
stroke: "var(--color-border-strong)",
|
|
230
|
+
strokeDasharray: "3 3",
|
|
231
|
+
strokeWidth: "1"
|
|
232
|
+
}), /* @__PURE__ */ T("text", {
|
|
233
|
+
x: h.x,
|
|
234
|
+
y: 204,
|
|
235
|
+
textAnchor: "middle",
|
|
236
|
+
className: "fill-text-primary text-[10px] font-semibold",
|
|
237
|
+
children: "Latest"
|
|
238
|
+
})] }) : null,
|
|
239
|
+
/* @__PURE__ */ T("path", {
|
|
240
|
+
d: _,
|
|
241
|
+
fill: "none",
|
|
242
|
+
stroke: "var(--color-accent-teal)",
|
|
243
|
+
strokeWidth: "2.5",
|
|
244
|
+
strokeLinecap: "round"
|
|
245
|
+
}),
|
|
246
|
+
v ? /* @__PURE__ */ T("path", {
|
|
247
|
+
d: v,
|
|
248
|
+
fill: "none",
|
|
249
|
+
stroke: "var(--color-action-primary-bg)",
|
|
250
|
+
strokeWidth: "2.5",
|
|
251
|
+
strokeDasharray: "5 5",
|
|
252
|
+
strokeLinecap: "round"
|
|
253
|
+
}) : null,
|
|
254
|
+
m.map((e, t) => /* @__PURE__ */ T("circle", {
|
|
255
|
+
cx: e.x,
|
|
256
|
+
cy: e.y,
|
|
257
|
+
r: "3.5",
|
|
258
|
+
fill: "var(--color-accent-teal)",
|
|
259
|
+
stroke: "var(--color-bg-surface)",
|
|
260
|
+
strokeWidth: "1.5"
|
|
261
|
+
}, `a-${t}`)),
|
|
262
|
+
g.map((e, t) => /* @__PURE__ */ T("circle", {
|
|
263
|
+
cx: e.x,
|
|
264
|
+
cy: e.y,
|
|
265
|
+
r: "3.5",
|
|
266
|
+
fill: "var(--color-action-primary-bg)",
|
|
267
|
+
stroke: "var(--color-bg-surface)",
|
|
268
|
+
strokeWidth: "1.5"
|
|
269
|
+
}, `p-${t}`)),
|
|
270
|
+
m[0] ? /* @__PURE__ */ T("text", {
|
|
271
|
+
x: m[0].x,
|
|
272
|
+
y: 192,
|
|
273
|
+
textAnchor: "start",
|
|
274
|
+
className: "fill-text-muted text-[10px]",
|
|
275
|
+
children: m[0].point.label
|
|
276
|
+
}) : null,
|
|
277
|
+
g[g.length - 1] ? /* @__PURE__ */ T("text", {
|
|
278
|
+
x: g[g.length - 1].x,
|
|
279
|
+
y: 192,
|
|
280
|
+
textAnchor: "end",
|
|
281
|
+
className: "fill-text-muted text-[10px]",
|
|
282
|
+
children: g[g.length - 1].point.label
|
|
283
|
+
}) : null
|
|
284
|
+
]
|
|
285
|
+
})
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
function R({ athleteId: t, windowDays: p = 28 }) {
|
|
289
|
+
let { navigateTo: m } = i(), C = a({
|
|
290
|
+
athleteId: t,
|
|
291
|
+
windowDays: p
|
|
292
|
+
}), w = l(() => C.data?.availableMetrics ?? [], [C.data?.availableMetrics]), [R, z] = u(""), B = l(() => {
|
|
293
|
+
if (R) {
|
|
294
|
+
let e = w.find((e) => `${e.type}::${e.label}` === R);
|
|
295
|
+
if (e) return e;
|
|
296
|
+
}
|
|
297
|
+
return w[0] ?? null;
|
|
298
|
+
}, [w, R]), V = B ? `${B.type}::${B.label}` : "", H = o({
|
|
299
|
+
metricType: B?.type ?? "SPEED",
|
|
300
|
+
metricLabel: B?.label,
|
|
301
|
+
athleteId: t,
|
|
302
|
+
horizonDays: 42,
|
|
303
|
+
enabled: !!C.data
|
|
304
|
+
});
|
|
305
|
+
if (C.isLoading) return /* @__PURE__ */ T(r, { label: "Analyzing logged workouts, metrics and AI coaching runs…" });
|
|
306
|
+
if (C.isError || !C.data) return /* @__PURE__ */ T(n, {
|
|
307
|
+
title: "AI Performance Insights unavailable",
|
|
308
|
+
message: C.error instanceof Error ? C.error.message : "We could not load AI performance insights right now.",
|
|
309
|
+
onRetry: () => void C.refetch()
|
|
310
|
+
});
|
|
311
|
+
let U = C.data, W = N[U.injuryRisk.level];
|
|
312
|
+
return /* @__PURE__ */ E("div", {
|
|
313
|
+
className: "space-y-6",
|
|
314
|
+
"data-testid": "ai-insights-dashboard",
|
|
315
|
+
children: [/* @__PURE__ */ E("div", {
|
|
316
|
+
className: "grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4",
|
|
317
|
+
children: [
|
|
318
|
+
/* @__PURE__ */ T(F, {
|
|
319
|
+
title: "Training Load",
|
|
320
|
+
icon: /* @__PURE__ */ T(d, { className: "h-4 w-4" }),
|
|
321
|
+
kpi: U.trainingLoad
|
|
322
|
+
}),
|
|
323
|
+
/* @__PURE__ */ T(F, {
|
|
324
|
+
title: "Wellness Score",
|
|
325
|
+
icon: /* @__PURE__ */ T(v, { className: "h-4 w-4" }),
|
|
326
|
+
kpi: U.wellnessScore
|
|
327
|
+
}),
|
|
328
|
+
/* @__PURE__ */ E(O, {
|
|
329
|
+
treatment: "metric",
|
|
330
|
+
className: "flex flex-col justify-between gap-3 p-5",
|
|
331
|
+
children: [/* @__PURE__ */ E("div", {
|
|
332
|
+
className: "flex items-start justify-between gap-2",
|
|
333
|
+
children: [/* @__PURE__ */ E("div", {
|
|
334
|
+
className: "flex items-center gap-2.5",
|
|
335
|
+
children: [/* @__PURE__ */ T("span", {
|
|
336
|
+
className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-status-warning-bg-subtle text-status-warning-text",
|
|
337
|
+
children: /* @__PURE__ */ T(b, { className: "h-4 w-4" })
|
|
338
|
+
}), /* @__PURE__ */ T("span", {
|
|
339
|
+
className: "text-sm font-medium text-text-secondary",
|
|
340
|
+
children: "Injury Risk"
|
|
341
|
+
})]
|
|
342
|
+
}), /* @__PURE__ */ T(j, { children: /* @__PURE__ */ E(k, { children: [/* @__PURE__ */ T(M, {
|
|
343
|
+
asChild: !0,
|
|
344
|
+
children: /* @__PURE__ */ T("button", {
|
|
345
|
+
type: "button",
|
|
346
|
+
"aria-label": "About Injury Risk",
|
|
347
|
+
className: "rounded-full p-1 text-text-muted transition-colors hover:text-text-primary",
|
|
348
|
+
children: /* @__PURE__ */ T(y, { className: "h-3.5 w-3.5" })
|
|
349
|
+
})
|
|
350
|
+
}), /* @__PURE__ */ T(A, {
|
|
351
|
+
className: "max-w-xs",
|
|
352
|
+
children: U.injuryRisk.summary
|
|
353
|
+
})] }) })]
|
|
354
|
+
}), /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("p", {
|
|
355
|
+
className: c("text-3xl font-bold leading-none", W.toneClass),
|
|
356
|
+
children: W.label
|
|
357
|
+
}), /* @__PURE__ */ T("p", {
|
|
358
|
+
className: "mt-2 text-xs text-text-muted",
|
|
359
|
+
children: U.injuryRisk.deltaLabel
|
|
360
|
+
})] })]
|
|
361
|
+
}),
|
|
362
|
+
/* @__PURE__ */ T(F, {
|
|
363
|
+
title: "Readiness",
|
|
364
|
+
icon: /* @__PURE__ */ T(S, { className: "h-4 w-4" }),
|
|
365
|
+
kpi: U.readiness
|
|
366
|
+
})
|
|
367
|
+
]
|
|
368
|
+
}), /* @__PURE__ */ E("div", {
|
|
369
|
+
className: "grid grid-cols-1 gap-6 lg:grid-cols-12",
|
|
370
|
+
children: [
|
|
371
|
+
/* @__PURE__ */ E(O, {
|
|
372
|
+
treatment: "insight",
|
|
373
|
+
className: "flex flex-col justify-between gap-5 p-6 lg:col-span-5",
|
|
374
|
+
children: [/* @__PURE__ */ E("div", { children: [/* @__PURE__ */ E("div", {
|
|
375
|
+
className: "flex items-center justify-between gap-2",
|
|
376
|
+
children: [/* @__PURE__ */ E("div", { children: [/* @__PURE__ */ E("div", {
|
|
377
|
+
className: "flex items-center gap-2",
|
|
378
|
+
children: [/* @__PURE__ */ T("h2", {
|
|
379
|
+
className: "text-lg font-semibold text-text-primary",
|
|
380
|
+
children: "AI Performance Insights"
|
|
381
|
+
}), /* @__PURE__ */ T(D, {
|
|
382
|
+
variant: "secondary",
|
|
383
|
+
children: "BETA"
|
|
384
|
+
})]
|
|
385
|
+
}), /* @__PURE__ */ T("p", {
|
|
386
|
+
className: "mt-0.5 text-xs text-text-secondary",
|
|
387
|
+
children: "Reads your logged workouts, metrics & AI coaching runs."
|
|
388
|
+
})] }), /* @__PURE__ */ E(D, {
|
|
389
|
+
variant: "outline",
|
|
390
|
+
className: "tabular-nums",
|
|
391
|
+
children: [
|
|
392
|
+
U.dataCompleteness.workoutLogCount,
|
|
393
|
+
" logs · ",
|
|
394
|
+
U.dataCompleteness.metricCount,
|
|
395
|
+
" ",
|
|
396
|
+
"metrics"
|
|
397
|
+
]
|
|
398
|
+
})]
|
|
399
|
+
}), /* @__PURE__ */ E("div", {
|
|
400
|
+
className: "mt-5 grid grid-cols-1 gap-5 sm:grid-cols-12",
|
|
401
|
+
children: [/* @__PURE__ */ E("div", {
|
|
402
|
+
className: "flex flex-col items-center justify-center sm:col-span-5",
|
|
403
|
+
children: [/* @__PURE__ */ T(I, {
|
|
404
|
+
level: U.injuryRisk.level,
|
|
405
|
+
acwr: U.injuryRisk.acwr
|
|
406
|
+
}), /* @__PURE__ */ T("p", {
|
|
407
|
+
className: "mt-2 text-center text-xs leading-relaxed text-text-secondary",
|
|
408
|
+
children: U.injuryRisk.summary
|
|
409
|
+
})]
|
|
410
|
+
}), /* @__PURE__ */ E("div", {
|
|
411
|
+
className: "space-y-2.5 sm:col-span-7",
|
|
412
|
+
children: [/* @__PURE__ */ T("h3", {
|
|
413
|
+
className: "text-xs font-semibold uppercase tracking-wide text-text-muted",
|
|
414
|
+
children: "Top Recommendations"
|
|
415
|
+
}), U.recommendations.length === 0 ? /* @__PURE__ */ T("div", {
|
|
416
|
+
className: "rounded-xl border border-dashed border-border-seam bg-bg-sunken/40 p-4 text-xs text-text-muted",
|
|
417
|
+
children: "Log workouts, record performance metrics, or run an AI coaching assessment to unlock personalized recommendations."
|
|
418
|
+
}) : /* @__PURE__ */ T("div", {
|
|
419
|
+
className: "space-y-2",
|
|
420
|
+
children: U.recommendations.slice(0, 3).map((e) => /* @__PURE__ */ E("button", {
|
|
421
|
+
type: "button",
|
|
422
|
+
onClick: () => m(e.programId ? `/programs/${e.programId}` : "/ai"),
|
|
423
|
+
className: c("flex w-full items-start justify-between gap-2 rounded-xl border p-3 text-left transition-colors hover:brightness-105", P(e.severity)),
|
|
424
|
+
children: [/* @__PURE__ */ E("div", {
|
|
425
|
+
className: "min-w-0 flex-1",
|
|
426
|
+
children: [/* @__PURE__ */ T("p", {
|
|
427
|
+
className: "text-xs font-semibold leading-snug text-text-primary",
|
|
428
|
+
children: e.title
|
|
429
|
+
}), /* @__PURE__ */ T("p", {
|
|
430
|
+
className: "mt-0.5 line-clamp-2 text-[0.72rem] text-text-secondary",
|
|
431
|
+
children: e.description
|
|
432
|
+
})]
|
|
433
|
+
}), /* @__PURE__ */ T(_, { className: "mt-0.5 h-4 w-4 shrink-0 text-text-muted" })]
|
|
434
|
+
}, e.id))
|
|
435
|
+
})]
|
|
436
|
+
})]
|
|
437
|
+
})] }), /* @__PURE__ */ E("div", {
|
|
438
|
+
className: "space-y-3 border-t border-border-seam pt-4",
|
|
439
|
+
children: [/* @__PURE__ */ E("button", {
|
|
440
|
+
type: "button",
|
|
441
|
+
onClick: () => m("/ai"),
|
|
442
|
+
className: "inline-flex w-full items-center justify-center gap-2 rounded-lg border border-action-primary-bg/40 bg-action-primary-bg/10 px-4 py-2.5 text-sm font-semibold text-action-primary-bg transition-colors hover:bg-action-primary-bg/20 sm:w-auto",
|
|
443
|
+
children: [/* @__PURE__ */ T(x, {
|
|
444
|
+
className: "h-4 w-4",
|
|
445
|
+
"aria-hidden": "true"
|
|
446
|
+
}), "View Full AI Report"]
|
|
447
|
+
}), /* @__PURE__ */ E("p", {
|
|
448
|
+
className: "flex items-center gap-1.5 text-xs text-text-muted",
|
|
449
|
+
children: [/* @__PURE__ */ T(y, {
|
|
450
|
+
className: "h-3.5 w-3.5 shrink-0",
|
|
451
|
+
"aria-hidden": "true"
|
|
452
|
+
}), "AI insights improve as more workout logs and metrics are recorded."]
|
|
453
|
+
})]
|
|
454
|
+
})]
|
|
455
|
+
}),
|
|
456
|
+
/* @__PURE__ */ E(O, {
|
|
457
|
+
treatment: "insight",
|
|
458
|
+
className: "flex flex-col justify-between gap-4 p-6 lg:col-span-4",
|
|
459
|
+
children: [/* @__PURE__ */ E("div", { children: [
|
|
460
|
+
/* @__PURE__ */ E("div", {
|
|
461
|
+
className: "mb-3 flex flex-wrap items-center justify-between gap-2",
|
|
462
|
+
children: [/* @__PURE__ */ T("h2", {
|
|
463
|
+
className: "text-lg font-semibold text-text-primary",
|
|
464
|
+
children: "Projected Progress"
|
|
465
|
+
}), w.length > 0 ? /* @__PURE__ */ T("select", {
|
|
466
|
+
"aria-label": "Select metric for projection",
|
|
467
|
+
value: V,
|
|
468
|
+
onChange: (e) => z(e.target.value),
|
|
469
|
+
className: "rounded-lg border border-border-seam bg-bg-surface px-2.5 py-1.5 text-xs font-medium text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]",
|
|
470
|
+
children: w.map((e) => /* @__PURE__ */ E("option", {
|
|
471
|
+
value: `${e.type}::${e.label}`,
|
|
472
|
+
children: [
|
|
473
|
+
e.label,
|
|
474
|
+
" (",
|
|
475
|
+
e.sampleCount,
|
|
476
|
+
")"
|
|
477
|
+
]
|
|
478
|
+
}, `${e.type}::${e.label}`))
|
|
479
|
+
}) : null]
|
|
480
|
+
}),
|
|
481
|
+
/* @__PURE__ */ E("div", {
|
|
482
|
+
className: "mb-3 flex items-center justify-between gap-2 text-xs",
|
|
483
|
+
children: [/* @__PURE__ */ E("div", {
|
|
484
|
+
className: "flex items-center gap-4 text-text-secondary",
|
|
485
|
+
children: [/* @__PURE__ */ E("span", {
|
|
486
|
+
className: "inline-flex items-center gap-1.5",
|
|
487
|
+
children: [/* @__PURE__ */ T("span", {
|
|
488
|
+
className: "h-0.5 w-3 bg-[var(--color-accent-teal)]",
|
|
489
|
+
"aria-hidden": "true"
|
|
490
|
+
}), "Actual"]
|
|
491
|
+
}), /* @__PURE__ */ E("span", {
|
|
492
|
+
className: "inline-flex items-center gap-1.5",
|
|
493
|
+
children: [/* @__PURE__ */ T("span", {
|
|
494
|
+
className: "h-0.5 w-3 border-t-2 border-dashed border-action-primary-bg",
|
|
495
|
+
"aria-hidden": "true"
|
|
496
|
+
}), "Projected"]
|
|
497
|
+
})]
|
|
498
|
+
}), H.data?.projectedDeltaPct == null ? null : /* @__PURE__ */ E(D, {
|
|
499
|
+
variant: "default",
|
|
500
|
+
className: "tabular-nums",
|
|
501
|
+
children: [
|
|
502
|
+
H.data.projectedDeltaPct >= 0 ? "+" : "",
|
|
503
|
+
H.data.projectedDeltaPct,
|
|
504
|
+
"%",
|
|
505
|
+
H.data.horizonDate ? ` by ${new Date(H.data.horizonDate).toLocaleDateString(void 0, {
|
|
506
|
+
month: "short",
|
|
507
|
+
day: "numeric"
|
|
508
|
+
})}` : ""
|
|
509
|
+
]
|
|
510
|
+
})]
|
|
511
|
+
}),
|
|
512
|
+
H.isLoading ? /* @__PURE__ */ T(r, { label: "Calculating trend projection…" }) : H.data ? /* @__PURE__ */ T(L, { data: H.data }) : /* @__PURE__ */ T("div", {
|
|
513
|
+
className: "flex h-52 items-center justify-center text-xs text-text-muted",
|
|
514
|
+
children: "Record metrics in Performance to unlock projections."
|
|
515
|
+
})
|
|
516
|
+
] }), /* @__PURE__ */ E("div", {
|
|
517
|
+
className: "rounded-lg border border-border-seam bg-bg-sunken/60 px-3 py-2 text-xs text-text-secondary",
|
|
518
|
+
children: [/* @__PURE__ */ T(x, { className: "mr-1.5 inline h-3.5 w-3.5 text-[var(--color-accent-teal)]" }), "Projections adapt with new data. Keep logging!"]
|
|
519
|
+
})]
|
|
520
|
+
}),
|
|
521
|
+
/* @__PURE__ */ E("div", {
|
|
522
|
+
className: "flex flex-col gap-6 lg:col-span-3",
|
|
523
|
+
children: [/* @__PURE__ */ E(O, {
|
|
524
|
+
treatment: "insight",
|
|
525
|
+
className: "p-5",
|
|
526
|
+
children: [/* @__PURE__ */ E("div", {
|
|
527
|
+
className: "mb-3 flex items-center justify-between gap-2",
|
|
528
|
+
children: [/* @__PURE__ */ T("h2", {
|
|
529
|
+
className: "text-base font-semibold text-text-primary",
|
|
530
|
+
children: "Up Next"
|
|
531
|
+
}), /* @__PURE__ */ T("button", {
|
|
532
|
+
type: "button",
|
|
533
|
+
onClick: () => m("/sessions"),
|
|
534
|
+
className: "text-xs font-medium text-text-link hover:underline",
|
|
535
|
+
children: "View All"
|
|
536
|
+
})]
|
|
537
|
+
}), U.upcomingSessions.length === 0 ? /* @__PURE__ */ T("p", {
|
|
538
|
+
className: "text-xs text-text-muted",
|
|
539
|
+
children: "No upcoming sessions scheduled."
|
|
540
|
+
}) : /* @__PURE__ */ T("div", {
|
|
541
|
+
className: "space-y-2.5",
|
|
542
|
+
children: U.upcomingSessions.slice(0, 3).map((t) => /* @__PURE__ */ E("button", {
|
|
543
|
+
type: "button",
|
|
544
|
+
onClick: () => m(`/sessions/${t.id}`),
|
|
545
|
+
className: "flex w-full items-center justify-between gap-2 rounded-lg border border-border-seam bg-bg-sunken/50 p-2.5 text-left transition-colors hover:bg-bg-sunken",
|
|
546
|
+
children: [/* @__PURE__ */ E("div", {
|
|
547
|
+
className: "flex min-w-0 items-center gap-2.5",
|
|
548
|
+
children: [/* @__PURE__ */ T("span", {
|
|
549
|
+
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-[var(--color-accent-soft)] text-[var(--color-accent-teal)]",
|
|
550
|
+
children: /* @__PURE__ */ T(h, {
|
|
551
|
+
className: "h-4 w-4",
|
|
552
|
+
"aria-hidden": "true"
|
|
553
|
+
})
|
|
554
|
+
}), /* @__PURE__ */ E("div", {
|
|
555
|
+
className: "min-w-0",
|
|
556
|
+
children: [/* @__PURE__ */ T("p", {
|
|
557
|
+
className: "truncate text-xs font-semibold text-text-primary",
|
|
558
|
+
children: t.title
|
|
559
|
+
}), /* @__PURE__ */ T("p", {
|
|
560
|
+
className: "truncate text-[0.7rem] text-text-muted",
|
|
561
|
+
children: s(t.scheduledAt)
|
|
562
|
+
})]
|
|
563
|
+
})]
|
|
564
|
+
}), /* @__PURE__ */ T(e, { status: t.status })]
|
|
565
|
+
}, t.id))
|
|
566
|
+
})]
|
|
567
|
+
}), /* @__PURE__ */ E(O, {
|
|
568
|
+
treatment: "insight",
|
|
569
|
+
className: "p-5",
|
|
570
|
+
children: [/* @__PURE__ */ E("div", {
|
|
571
|
+
className: "mb-3 flex items-center justify-between gap-2",
|
|
572
|
+
children: [/* @__PURE__ */ T("h2", {
|
|
573
|
+
className: "text-base font-semibold text-text-primary",
|
|
574
|
+
children: "Alerts"
|
|
575
|
+
}), /* @__PURE__ */ T("button", {
|
|
576
|
+
type: "button",
|
|
577
|
+
onClick: () => m("/performance"),
|
|
578
|
+
className: "text-xs font-medium text-text-link hover:underline",
|
|
579
|
+
children: "View All"
|
|
580
|
+
})]
|
|
581
|
+
}), U.alerts.length === 0 ? /* @__PURE__ */ E("div", {
|
|
582
|
+
className: "flex items-center gap-2.5 rounded-lg border border-status-success-border bg-status-success-bg-subtle p-3",
|
|
583
|
+
children: [/* @__PURE__ */ T(g, { className: "h-4 w-4 shrink-0 text-status-success-text" }), /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("p", {
|
|
584
|
+
className: "text-xs font-semibold text-text-primary",
|
|
585
|
+
children: "All clear"
|
|
586
|
+
}), /* @__PURE__ */ T("p", {
|
|
587
|
+
className: "text-[0.7rem] text-text-secondary",
|
|
588
|
+
children: "No acute workload spikes or fatigue alerts right now."
|
|
589
|
+
})] })]
|
|
590
|
+
}) : /* @__PURE__ */ T("div", {
|
|
591
|
+
className: "space-y-2.5",
|
|
592
|
+
children: U.alerts.map((e) => /* @__PURE__ */ E("div", {
|
|
593
|
+
className: c("flex items-start gap-2.5 rounded-lg border p-3", P(e.severity)),
|
|
594
|
+
children: [/* @__PURE__ */ T(f, {
|
|
595
|
+
className: "mt-0.5 h-4 w-4 shrink-0",
|
|
596
|
+
"aria-hidden": "true"
|
|
597
|
+
}), /* @__PURE__ */ E("div", {
|
|
598
|
+
className: "min-w-0",
|
|
599
|
+
children: [/* @__PURE__ */ T("p", {
|
|
600
|
+
className: "text-xs font-semibold text-text-primary",
|
|
601
|
+
children: e.title
|
|
602
|
+
}), /* @__PURE__ */ T("p", {
|
|
603
|
+
className: "mt-0.5 text-[0.7rem] text-text-secondary",
|
|
604
|
+
children: e.description
|
|
605
|
+
})]
|
|
606
|
+
})]
|
|
607
|
+
}, e.id))
|
|
608
|
+
})]
|
|
609
|
+
})]
|
|
610
|
+
})
|
|
611
|
+
]
|
|
612
|
+
})]
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
export { R as AiInsightsPanel };
|
|
616
|
+
|
|
617
|
+
//# sourceMappingURL=AiInsightsPanel.js.map
|