@burdenoff/microfe-mybodyshield 2026.821.2 → 2026.827.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/mybodyshield/pages/ai/AiControlsPage.d.ts.map +1 -1
- package/dist/mybodyshield/pages/ai/AiControlsPage.js +167 -108
- package/dist/mybodyshield/pages/ai/AiControlsPage.js.map +1 -1
- package/dist/mybodyshield/pages/coaching/CoachingPage.d.ts.map +1 -1
- package/dist/mybodyshield/pages/coaching/CoachingPage.js +222 -151
- package/dist/mybodyshield/pages/coaching/CoachingPage.js.map +1 -1
- package/dist/mybodyshield/pages/insights/InsightsPage.d.ts.map +1 -1
- package/dist/mybodyshield/pages/insights/InsightsPage.js +135 -34
- package/dist/mybodyshield/pages/insights/InsightsPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,37 +3,37 @@ import { PageLayout as t } from "../../components/PageLayout.js";
|
|
|
3
3
|
import { formatDate as n } from "../../utils/formatters.js";
|
|
4
4
|
import { StatusBadge as r } from "../../components/StatusBadge.js";
|
|
5
5
|
import { EmptyState as i } from "../../components/EmptyState.js";
|
|
6
|
-
import { ErrorView as a, LoadingView as o } from "../../components/StateViews.js";
|
|
7
|
-
import { FilterTabs as
|
|
6
|
+
import { ErrorView as a, LoadingView as o, Section as s } from "../../components/StateViews.js";
|
|
7
|
+
import { FilterTabs as c } from "../../components/FilterTabs.js";
|
|
8
8
|
import "../../context/index.js";
|
|
9
|
-
import { useMybCoaching as
|
|
9
|
+
import { useMybCoaching as l, useMybCreateCoaching as u, useMybTransitionCoaching as d } from "../../hooks/useMyBodyShieldApi.js";
|
|
10
10
|
import "../../hooks/index.js";
|
|
11
|
-
import { MybDiscussion as
|
|
12
|
-
import { UserSearchSelect as
|
|
11
|
+
import { MybDiscussion as f } from "../../components/MybDiscussion.js";
|
|
12
|
+
import { UserSearchSelect as p } from "../../components/UserSearchSelect.js";
|
|
13
13
|
import "../../components/index.js";
|
|
14
|
-
import { AnimatePresence as
|
|
15
|
-
import { motion as
|
|
16
|
-
import { useReducedMotion as
|
|
17
|
-
import { IconChip as
|
|
18
|
-
import { useMemo as
|
|
19
|
-
import { CalendarClock as
|
|
20
|
-
import { jsx as
|
|
21
|
-
import { Button as
|
|
14
|
+
import { AnimatePresence as m } from "../../../node_modules/framer-motion/dist/es/components/AnimatePresence/index.js";
|
|
15
|
+
import { motion as h } from "../../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js";
|
|
16
|
+
import { useReducedMotion as g } from "../../../node_modules/framer-motion/dist/es/utils/reduced-motion/use-reduced-motion.js";
|
|
17
|
+
import { IconChip as _ } from "../_shared/visuals.js";
|
|
18
|
+
import { useMemo as v, useState as y } from "react";
|
|
19
|
+
import { CalendarClock as b, CalendarX as x, Check as S, ChevronDown as C, ChevronUp as w, Dumbbell as T, EyeOff as E, FileLock2 as D, HeartHandshake as O, LineChart as k, Lock as A, MessageSquare as j, Minus as ee, Plus as M, Salad as te, ScanEye as ne, ShieldCheck as re, User as N } from "lucide-react";
|
|
20
|
+
import { jsx as P, jsxs as F } from "react/jsx-runtime";
|
|
21
|
+
import { Button as I, GlassCard as L, Input as ie, Label as R, ResponsiveDialog as z, ResponsiveDialogContent as B, ResponsiveDialogDescription as V, ResponsiveDialogFooter as H, ResponsiveDialogHeader as U, ResponsiveDialogTitle as W, Switch as G } from "@burdenoff/fe-libs/ui";
|
|
22
22
|
//#region src/mybodyshield/pages/coaching/CoachingPage.tsx
|
|
23
|
-
var
|
|
23
|
+
var K = [
|
|
24
24
|
"PENDING",
|
|
25
25
|
"ACTIVE",
|
|
26
26
|
"PAUSED",
|
|
27
27
|
"ENDED"
|
|
28
|
-
],
|
|
28
|
+
], q = [
|
|
29
29
|
.16,
|
|
30
30
|
1,
|
|
31
31
|
.3,
|
|
32
32
|
1
|
|
33
|
-
],
|
|
33
|
+
], J = {
|
|
34
34
|
hidden: {},
|
|
35
35
|
show: { transition: { staggerChildren: .06 } }
|
|
36
|
-
},
|
|
36
|
+
}, ae = {
|
|
37
37
|
hidden: {
|
|
38
38
|
opacity: 0,
|
|
39
39
|
y: 12
|
|
@@ -43,14 +43,18 @@ var G = [
|
|
|
43
43
|
y: 0,
|
|
44
44
|
transition: {
|
|
45
45
|
duration: .35,
|
|
46
|
-
ease:
|
|
46
|
+
ease: q
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
},
|
|
49
|
+
}, oe = {
|
|
50
50
|
PENDING: [{
|
|
51
51
|
to: "ACTIVE",
|
|
52
52
|
label: "Accept",
|
|
53
53
|
primary: !0
|
|
54
|
+
}, {
|
|
55
|
+
to: "ENDED",
|
|
56
|
+
label: "End request",
|
|
57
|
+
primary: !1
|
|
54
58
|
}],
|
|
55
59
|
ACTIVE: [{
|
|
56
60
|
to: "PAUSED",
|
|
@@ -71,11 +75,42 @@ var G = [
|
|
|
71
75
|
primary: !1
|
|
72
76
|
}],
|
|
73
77
|
ENDED: []
|
|
74
|
-
}
|
|
75
|
-
|
|
78
|
+
}, se = {
|
|
79
|
+
PENDING: "Nothing is shared yet. The other party has to accept this request — the person who sent it cannot accept it themselves.",
|
|
80
|
+
ACTIVE: "The coach can read the categories marked On. Pausing or ending this revokes that access on the next request.",
|
|
81
|
+
PAUSED: "Sharing is suspended while paused. Resuming restores exactly the scope above.",
|
|
82
|
+
ENDED: "Access was revoked when this relationship ended."
|
|
83
|
+
}, ce = [
|
|
84
|
+
{
|
|
85
|
+
icon: ne,
|
|
86
|
+
title: "Checked on every read",
|
|
87
|
+
detail: "Each request re-checks the relationship and the matching switch. Access is not granted once and cached for the session."
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
icon: E,
|
|
91
|
+
title: "Refusals look like \"not found\"",
|
|
92
|
+
detail: "Asking for data you have not shared returns not-found, never \"forbidden\" — so nobody can use the error to confirm a record exists."
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
icon: A,
|
|
96
|
+
title: "Health values are encrypted at rest",
|
|
97
|
+
detail: "Body metrics, recovery scores, sleep hours and free-text notes are stored encrypted and decrypted only when returned to someone allowed to read them."
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
icon: D,
|
|
101
|
+
title: "Health fields are redacted from the audit log",
|
|
102
|
+
detail: "Every mutation is audited, but weights, scores, macros and notes are replaced with a redaction marker before the entry leaves this service."
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
icon: re,
|
|
106
|
+
title: "Scope is fixed for the life of the relationship",
|
|
107
|
+
detail: "The three switches are chosen when the relationship is created. To change them, end this one and create a new relationship with the scope you want."
|
|
108
|
+
}
|
|
109
|
+
];
|
|
110
|
+
function Y(e) {
|
|
76
111
|
return e.length <= 10 ? e : `${e.slice(0, 8)}…`;
|
|
77
112
|
}
|
|
78
|
-
function
|
|
113
|
+
function X(e) {
|
|
79
114
|
return {
|
|
80
115
|
memberId: e.userId,
|
|
81
116
|
memberName: e.displayName,
|
|
@@ -87,30 +122,30 @@ function Z(e) {
|
|
|
87
122
|
shareMetrics: !0
|
|
88
123
|
};
|
|
89
124
|
}
|
|
90
|
-
function
|
|
91
|
-
return /* @__PURE__ */
|
|
125
|
+
function Z({ id: e, label: t, description: n, checked: r, onChange: i }) {
|
|
126
|
+
return /* @__PURE__ */ F("div", {
|
|
92
127
|
className: "flex items-center justify-between gap-4 rounded-xl bg-bg-sunken/60 p-3",
|
|
93
|
-
children: [/* @__PURE__ */
|
|
128
|
+
children: [/* @__PURE__ */ F("div", {
|
|
94
129
|
className: "min-w-0",
|
|
95
|
-
children: [/* @__PURE__ */
|
|
130
|
+
children: [/* @__PURE__ */ P(R, {
|
|
96
131
|
htmlFor: e,
|
|
97
132
|
className: "cursor-pointer",
|
|
98
133
|
children: t
|
|
99
|
-
}), /* @__PURE__ */
|
|
134
|
+
}), /* @__PURE__ */ P("p", {
|
|
100
135
|
className: "text-xs text-text-tertiary",
|
|
101
136
|
children: n
|
|
102
137
|
})]
|
|
103
|
-
}), /* @__PURE__ */
|
|
138
|
+
}), /* @__PURE__ */ P(G, {
|
|
104
139
|
id: e,
|
|
105
140
|
checked: r,
|
|
106
141
|
onCheckedChange: i
|
|
107
142
|
})]
|
|
108
143
|
});
|
|
109
144
|
}
|
|
110
|
-
function
|
|
111
|
-
let r =
|
|
112
|
-
e || (a(
|
|
113
|
-
},
|
|
145
|
+
function le({ open: e, onOpenChange: t, defaultMember: n }) {
|
|
146
|
+
let r = u(), [i, a] = y(() => X(n)), [o, s] = y(null), c = (e) => {
|
|
147
|
+
e || (a(X(n)), s(null)), t(e);
|
|
148
|
+
}, l = async () => {
|
|
114
149
|
let e = i.coachId.trim(), o = i.memberId.trim();
|
|
115
150
|
if (!e) {
|
|
116
151
|
s("Coach user id is required.");
|
|
@@ -130,25 +165,25 @@ function ee({ open: e, onOpenChange: t, defaultMember: n }) {
|
|
|
130
165
|
shareMetrics: i.shareMetrics
|
|
131
166
|
};
|
|
132
167
|
try {
|
|
133
|
-
await r.mutateAsync(c), a(
|
|
168
|
+
await r.mutateAsync(c), a(X(n)), t(!1);
|
|
134
169
|
} catch (e) {
|
|
135
170
|
s(e instanceof Error ? e.message : "Failed to create coaching relationship.");
|
|
136
171
|
}
|
|
137
172
|
};
|
|
138
|
-
return /* @__PURE__ */
|
|
173
|
+
return /* @__PURE__ */ P(z, {
|
|
139
174
|
open: e,
|
|
140
175
|
onOpenChange: c,
|
|
141
|
-
children: /* @__PURE__ */
|
|
176
|
+
children: /* @__PURE__ */ F(B, { children: [/* @__PURE__ */ F(U, { children: [/* @__PURE__ */ P(W, { children: "New coaching" }), /* @__PURE__ */ P(V, { children: "Link a coach and member, and choose exactly what training, nutrition and progress data is shared." })] }), /* @__PURE__ */ F("form", {
|
|
142
177
|
className: "space-y-4",
|
|
143
178
|
onSubmit: (e) => {
|
|
144
|
-
e.preventDefault(),
|
|
179
|
+
e.preventDefault(), l();
|
|
145
180
|
},
|
|
146
181
|
children: [
|
|
147
|
-
o && /* @__PURE__ */
|
|
182
|
+
o && /* @__PURE__ */ P("p", {
|
|
148
183
|
className: "rounded-lg bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
|
|
149
184
|
children: o
|
|
150
185
|
}),
|
|
151
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ P(p, {
|
|
152
187
|
label: "Coach",
|
|
153
188
|
required: !0,
|
|
154
189
|
htmlId: "myb-coaching-coach",
|
|
@@ -160,7 +195,7 @@ function ee({ open: e, onOpenChange: t, defaultMember: n }) {
|
|
|
160
195
|
coachName: t
|
|
161
196
|
}))
|
|
162
197
|
}),
|
|
163
|
-
/* @__PURE__ */
|
|
198
|
+
/* @__PURE__ */ P(p, {
|
|
164
199
|
label: "Member",
|
|
165
200
|
htmlId: "myb-coaching-member",
|
|
166
201
|
userId: i.memberId,
|
|
@@ -171,12 +206,12 @@ function ee({ open: e, onOpenChange: t, defaultMember: n }) {
|
|
|
171
206
|
memberName: t
|
|
172
207
|
}))
|
|
173
208
|
}),
|
|
174
|
-
/* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ F("div", {
|
|
175
210
|
className: "space-y-2",
|
|
176
|
-
children: [/* @__PURE__ */
|
|
211
|
+
children: [/* @__PURE__ */ P(R, {
|
|
177
212
|
htmlFor: "myb-coaching-specialty",
|
|
178
213
|
children: "Specialty"
|
|
179
|
-
}), /* @__PURE__ */
|
|
214
|
+
}), /* @__PURE__ */ P(ie, {
|
|
180
215
|
id: "myb-coaching-specialty",
|
|
181
216
|
value: i.specialty,
|
|
182
217
|
onChange: (e) => a((t) => ({
|
|
@@ -186,14 +221,14 @@ function ee({ open: e, onOpenChange: t, defaultMember: n }) {
|
|
|
186
221
|
placeholder: "e.g., Strength & conditioning"
|
|
187
222
|
})]
|
|
188
223
|
}),
|
|
189
|
-
/* @__PURE__ */
|
|
224
|
+
/* @__PURE__ */ F("div", {
|
|
190
225
|
className: "space-y-2",
|
|
191
226
|
children: [
|
|
192
|
-
/* @__PURE__ */
|
|
227
|
+
/* @__PURE__ */ P("p", {
|
|
193
228
|
className: "text-sm font-medium text-text-primary",
|
|
194
229
|
children: "Shared with the coach"
|
|
195
230
|
}),
|
|
196
|
-
/* @__PURE__ */
|
|
231
|
+
/* @__PURE__ */ P(Z, {
|
|
197
232
|
id: "myb-coaching-share-workouts",
|
|
198
233
|
label: "Workouts",
|
|
199
234
|
description: "Programs, sessions and logged sets.",
|
|
@@ -203,7 +238,7 @@ function ee({ open: e, onOpenChange: t, defaultMember: n }) {
|
|
|
203
238
|
shareWorkouts: e
|
|
204
239
|
}))
|
|
205
240
|
}),
|
|
206
|
-
/* @__PURE__ */
|
|
241
|
+
/* @__PURE__ */ P(Z, {
|
|
207
242
|
id: "myb-coaching-share-nutrition",
|
|
208
243
|
label: "Nutrition",
|
|
209
244
|
description: "Plans, meals and daily macros.",
|
|
@@ -213,7 +248,7 @@ function ee({ open: e, onOpenChange: t, defaultMember: n }) {
|
|
|
213
248
|
shareNutrition: e
|
|
214
249
|
}))
|
|
215
250
|
}),
|
|
216
|
-
/* @__PURE__ */
|
|
251
|
+
/* @__PURE__ */ P(Z, {
|
|
217
252
|
id: "myb-coaching-share-metrics",
|
|
218
253
|
label: "Metrics",
|
|
219
254
|
description: "Body metrics and recovery logs.",
|
|
@@ -225,13 +260,13 @@ function ee({ open: e, onOpenChange: t, defaultMember: n }) {
|
|
|
225
260
|
})
|
|
226
261
|
]
|
|
227
262
|
}),
|
|
228
|
-
/* @__PURE__ */
|
|
263
|
+
/* @__PURE__ */ F(H, { children: [/* @__PURE__ */ P(I, {
|
|
229
264
|
type: "button",
|
|
230
265
|
variant: "outline",
|
|
231
266
|
onClick: () => c(!1),
|
|
232
267
|
disabled: r.isPending,
|
|
233
268
|
children: "Cancel"
|
|
234
|
-
}), /* @__PURE__ */
|
|
269
|
+
}), /* @__PURE__ */ P(I, {
|
|
235
270
|
type: "submit",
|
|
236
271
|
disabled: r.isPending,
|
|
237
272
|
children: r.isPending ? "Creating…" : "Create coaching"
|
|
@@ -240,22 +275,22 @@ function ee({ open: e, onOpenChange: t, defaultMember: n }) {
|
|
|
240
275
|
})] })
|
|
241
276
|
});
|
|
242
277
|
}
|
|
243
|
-
function
|
|
244
|
-
let r = t, i = n ?
|
|
245
|
-
return /* @__PURE__ */
|
|
278
|
+
function Q({ label: e, icon: t, on: n }) {
|
|
279
|
+
let r = t, i = n ? S : ee;
|
|
280
|
+
return /* @__PURE__ */ F("span", {
|
|
246
281
|
"aria-label": `${e} ${n ? "shared" : "not shared"}`,
|
|
247
282
|
className: `inline-flex items-center gap-1.5 rounded-full py-0.5 pl-1 pr-2.5 text-xs font-medium ${n ? "bg-status-success-bg-subtle text-status-success-text ring-1 ring-inset ring-[color-mix(in_oklab,var(--color-status-success-text)_28%,transparent)]" : "bg-bg-sunken text-text-tertiary ring-1 ring-inset ring-border-seam"}`,
|
|
248
283
|
children: [
|
|
249
|
-
/* @__PURE__ */
|
|
284
|
+
/* @__PURE__ */ P("span", {
|
|
250
285
|
"aria-hidden": "true",
|
|
251
286
|
className: `inline-flex size-4 items-center justify-center rounded-full ${n ? "bg-[color-mix(in_oklab,var(--color-status-success-text)_22%,transparent)]" : "bg-[color-mix(in_oklab,var(--color-text-tertiary)_18%,transparent)]"}`,
|
|
252
|
-
children: /* @__PURE__ */
|
|
287
|
+
children: /* @__PURE__ */ P(i, { className: "h-2.5 w-2.5" })
|
|
253
288
|
}),
|
|
254
|
-
/* @__PURE__ */
|
|
289
|
+
/* @__PURE__ */ P(r, {
|
|
255
290
|
className: "h-3 w-3",
|
|
256
291
|
"aria-hidden": "true"
|
|
257
292
|
}),
|
|
258
|
-
/* @__PURE__ */
|
|
293
|
+
/* @__PURE__ */ F("span", { children: [
|
|
259
294
|
e,
|
|
260
295
|
" · ",
|
|
261
296
|
n ? "On" : "Off"
|
|
@@ -263,108 +298,114 @@ function $({ label: e, icon: t, on: n }) {
|
|
|
263
298
|
]
|
|
264
299
|
});
|
|
265
300
|
}
|
|
266
|
-
function
|
|
267
|
-
let o = !!t && e.coachId === t, s = !!t && e.memberId === t, c =
|
|
268
|
-
return /* @__PURE__ */
|
|
301
|
+
function $({ relationship: e, currentUserId: t, busy: i, onTransition: a }) {
|
|
302
|
+
let o = !!t && e.coachId === t, s = !!t && e.memberId === t, c = oe[e.status], l = e.status === "ACTIVE" || e.status === "PAUSED", [u, d] = y(!1), p = g();
|
|
303
|
+
return /* @__PURE__ */ F(L, {
|
|
269
304
|
treatment: "glass",
|
|
270
305
|
glow: e.status === "ACTIVE",
|
|
271
306
|
className: "flex h-full flex-col gap-4 p-5 transition-shadow hover:shadow-float" + (e.status === "PENDING" ? " ring-1 ring-inset ring-[color-mix(in_oklab,var(--color-status-warning-text)_35%,transparent)]" : ""),
|
|
272
307
|
children: [
|
|
273
|
-
/* @__PURE__ */
|
|
308
|
+
/* @__PURE__ */ F("div", {
|
|
274
309
|
className: "flex items-start justify-between gap-3",
|
|
275
|
-
children: [/* @__PURE__ */
|
|
310
|
+
children: [/* @__PURE__ */ F("div", {
|
|
276
311
|
className: "flex min-w-0 items-start gap-3",
|
|
277
|
-
children: [/* @__PURE__ */
|
|
312
|
+
children: [/* @__PURE__ */ P(_, { icon: /* @__PURE__ */ P(O, { className: "h-4 w-4" }) }), /* @__PURE__ */ F("div", {
|
|
278
313
|
className: "min-w-0",
|
|
279
|
-
children: [/* @__PURE__ */
|
|
314
|
+
children: [/* @__PURE__ */ P("p", {
|
|
280
315
|
className: "truncate text-sm font-semibold text-text-primary",
|
|
281
316
|
children: e.specialty?.trim() || "Coaching relationship"
|
|
282
|
-
}), /* @__PURE__ */
|
|
317
|
+
}), /* @__PURE__ */ P("p", {
|
|
283
318
|
className: "text-xs text-text-tertiary",
|
|
284
319
|
children: "Coach ↔ member"
|
|
285
320
|
})]
|
|
286
321
|
})]
|
|
287
|
-
}), /* @__PURE__ */
|
|
322
|
+
}), /* @__PURE__ */ P(r, { status: e.status })]
|
|
288
323
|
}),
|
|
289
|
-
/* @__PURE__ */
|
|
324
|
+
/* @__PURE__ */ F("div", {
|
|
290
325
|
className: "grid grid-cols-2 gap-3",
|
|
291
|
-
children: [/* @__PURE__ */
|
|
326
|
+
children: [/* @__PURE__ */ F("div", {
|
|
292
327
|
className: "flex items-center gap-2.5 rounded-lg bg-bg-sunken/60 p-2.5",
|
|
293
|
-
children: [/* @__PURE__ */
|
|
328
|
+
children: [/* @__PURE__ */ P("span", {
|
|
294
329
|
"aria-hidden": "true",
|
|
295
330
|
className: `flex size-8 shrink-0 items-center justify-center rounded-full ring-1 ring-inset ${o ? "bg-[color-mix(in_oklab,var(--color-action-primary-bg)_16%,transparent)] text-action-primary-bg ring-[color-mix(in_oklab,var(--color-action-primary-bg)_40%,transparent)]" : "bg-bg-surface text-text-tertiary ring-border-seam"}`,
|
|
296
|
-
children: /* @__PURE__ */
|
|
297
|
-
}), /* @__PURE__ */
|
|
331
|
+
children: /* @__PURE__ */ P(N, { className: "h-4 w-4" })
|
|
332
|
+
}), /* @__PURE__ */ F("div", {
|
|
298
333
|
className: "min-w-0",
|
|
299
|
-
children: [/* @__PURE__ */
|
|
334
|
+
children: [/* @__PURE__ */ P("p", {
|
|
300
335
|
className: "text-[11px] font-medium uppercase tracking-wide text-text-tertiary",
|
|
301
336
|
children: "Coach"
|
|
302
|
-
}), /* @__PURE__ */
|
|
337
|
+
}), /* @__PURE__ */ P("p", {
|
|
303
338
|
className: "mt-0.5 truncate text-sm font-medium text-text-primary",
|
|
304
339
|
title: e.coachId,
|
|
305
|
-
children: o ? "You" : `#${
|
|
340
|
+
children: o ? "You" : `#${Y(e.coachId)}`
|
|
306
341
|
})]
|
|
307
342
|
})]
|
|
308
|
-
}), /* @__PURE__ */
|
|
343
|
+
}), /* @__PURE__ */ F("div", {
|
|
309
344
|
className: "flex items-center gap-2.5 rounded-lg bg-bg-sunken/60 p-2.5",
|
|
310
|
-
children: [/* @__PURE__ */
|
|
345
|
+
children: [/* @__PURE__ */ P("span", {
|
|
311
346
|
"aria-hidden": "true",
|
|
312
347
|
className: `flex size-8 shrink-0 items-center justify-center rounded-full ring-1 ring-inset ${s ? "bg-[color-mix(in_oklab,var(--color-action-primary-bg)_16%,transparent)] text-action-primary-bg ring-[color-mix(in_oklab,var(--color-action-primary-bg)_40%,transparent)]" : "bg-bg-surface text-text-tertiary ring-border-seam"}`,
|
|
313
|
-
children: /* @__PURE__ */
|
|
314
|
-
}), /* @__PURE__ */
|
|
348
|
+
children: /* @__PURE__ */ P(N, { className: "h-4 w-4" })
|
|
349
|
+
}), /* @__PURE__ */ F("div", {
|
|
315
350
|
className: "min-w-0",
|
|
316
|
-
children: [/* @__PURE__ */
|
|
351
|
+
children: [/* @__PURE__ */ P("p", {
|
|
317
352
|
className: "text-[11px] font-medium uppercase tracking-wide text-text-tertiary",
|
|
318
353
|
children: "Member"
|
|
319
|
-
}), /* @__PURE__ */
|
|
354
|
+
}), /* @__PURE__ */ P("p", {
|
|
320
355
|
className: "mt-0.5 truncate text-sm font-medium text-text-primary",
|
|
321
356
|
title: e.memberId,
|
|
322
|
-
children: s ? "You" : `#${
|
|
357
|
+
children: s ? "You" : `#${Y(e.memberId)}`
|
|
323
358
|
})]
|
|
324
359
|
})]
|
|
325
360
|
})]
|
|
326
361
|
}),
|
|
327
|
-
/* @__PURE__ */
|
|
328
|
-
className: "
|
|
329
|
-
children: [
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
362
|
+
/* @__PURE__ */ F("div", {
|
|
363
|
+
className: "space-y-2",
|
|
364
|
+
children: [/* @__PURE__ */ F("div", {
|
|
365
|
+
className: "flex flex-wrap gap-1.5",
|
|
366
|
+
children: [
|
|
367
|
+
/* @__PURE__ */ P(Q, {
|
|
368
|
+
label: "Workouts",
|
|
369
|
+
icon: T,
|
|
370
|
+
on: e.shareWorkouts
|
|
371
|
+
}),
|
|
372
|
+
/* @__PURE__ */ P(Q, {
|
|
373
|
+
label: "Nutrition",
|
|
374
|
+
icon: te,
|
|
375
|
+
on: e.shareNutrition
|
|
376
|
+
}),
|
|
377
|
+
/* @__PURE__ */ P(Q, {
|
|
378
|
+
label: "Metrics",
|
|
379
|
+
icon: k,
|
|
380
|
+
on: e.shareMetrics
|
|
381
|
+
})
|
|
382
|
+
]
|
|
383
|
+
}), /* @__PURE__ */ P("p", {
|
|
384
|
+
className: "text-xs leading-relaxed text-text-tertiary",
|
|
385
|
+
children: se[e.status]
|
|
386
|
+
})]
|
|
346
387
|
}),
|
|
347
|
-
(e.startedAt || e.endedAt) && /* @__PURE__ */
|
|
388
|
+
(e.startedAt || e.endedAt) && /* @__PURE__ */ F("div", {
|
|
348
389
|
className: "flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-text-tertiary",
|
|
349
|
-
children: [e.startedAt && /* @__PURE__ */
|
|
390
|
+
children: [e.startedAt && /* @__PURE__ */ F("span", {
|
|
350
391
|
className: "inline-flex items-center gap-1",
|
|
351
392
|
children: [
|
|
352
|
-
/* @__PURE__ */
|
|
393
|
+
/* @__PURE__ */ P(b, { className: "h-3.5 w-3.5" }),
|
|
353
394
|
"Started ",
|
|
354
395
|
n(e.startedAt)
|
|
355
396
|
]
|
|
356
|
-
}), e.endedAt && /* @__PURE__ */
|
|
397
|
+
}), e.endedAt && /* @__PURE__ */ F("span", {
|
|
357
398
|
className: "inline-flex items-center gap-1",
|
|
358
399
|
children: [
|
|
359
|
-
/* @__PURE__ */
|
|
400
|
+
/* @__PURE__ */ P(x, { className: "h-3.5 w-3.5" }),
|
|
360
401
|
"Ended ",
|
|
361
402
|
n(e.endedAt)
|
|
362
403
|
]
|
|
363
404
|
})]
|
|
364
405
|
}),
|
|
365
|
-
c.length > 0 && /* @__PURE__ */
|
|
406
|
+
c.length > 0 && /* @__PURE__ */ P("div", {
|
|
366
407
|
className: "mt-auto flex flex-wrap gap-2 pt-1",
|
|
367
|
-
children: c.map((t) => /* @__PURE__ */
|
|
408
|
+
children: c.map((t) => /* @__PURE__ */ P(I, {
|
|
368
409
|
size: "sm",
|
|
369
410
|
variant: t.primary ? void 0 : "outline",
|
|
370
411
|
disabled: i,
|
|
@@ -372,22 +413,22 @@ function te({ relationship: e, currentUserId: t, busy: i, onTransition: a }) {
|
|
|
372
413
|
children: t.label
|
|
373
414
|
}, t.to))
|
|
374
415
|
}),
|
|
375
|
-
l && /* @__PURE__ */
|
|
416
|
+
l && /* @__PURE__ */ F("div", {
|
|
376
417
|
className: `border-t border-border-seam pt-3 ${c.length === 0 ? "mt-auto" : ""}`,
|
|
377
|
-
children: [/* @__PURE__ */
|
|
418
|
+
children: [/* @__PURE__ */ F("button", {
|
|
378
419
|
type: "button",
|
|
379
|
-
onClick: () =>
|
|
420
|
+
onClick: () => d((e) => !e),
|
|
380
421
|
"aria-expanded": u,
|
|
381
422
|
className: "inline-flex items-center gap-1.5 text-sm font-medium text-accent hover:underline",
|
|
382
423
|
children: [
|
|
383
|
-
/* @__PURE__ */
|
|
424
|
+
/* @__PURE__ */ P(j, { className: "h-4 w-4" }),
|
|
384
425
|
u ? "Hide discussion" : "Discussion",
|
|
385
|
-
|
|
426
|
+
P(u ? w : C, { className: "h-4 w-4" })
|
|
386
427
|
]
|
|
387
|
-
}), /* @__PURE__ */
|
|
428
|
+
}), /* @__PURE__ */ P(m, {
|
|
388
429
|
initial: !1,
|
|
389
|
-
children: u && /* @__PURE__ */
|
|
390
|
-
initial:
|
|
430
|
+
children: u && /* @__PURE__ */ P(h.div, {
|
|
431
|
+
initial: p ? !1 : {
|
|
391
432
|
opacity: 0,
|
|
392
433
|
height: 0
|
|
393
434
|
},
|
|
@@ -395,18 +436,18 @@ function te({ relationship: e, currentUserId: t, busy: i, onTransition: a }) {
|
|
|
395
436
|
opacity: 1,
|
|
396
437
|
height: "auto"
|
|
397
438
|
},
|
|
398
|
-
exit:
|
|
439
|
+
exit: p ? { opacity: 0 } : {
|
|
399
440
|
opacity: 0,
|
|
400
441
|
height: 0
|
|
401
442
|
},
|
|
402
|
-
transition:
|
|
443
|
+
transition: p ? { duration: 0 } : {
|
|
403
444
|
duration: .25,
|
|
404
|
-
ease:
|
|
445
|
+
ease: q
|
|
405
446
|
},
|
|
406
447
|
className: "overflow-hidden",
|
|
407
|
-
children: /* @__PURE__ */
|
|
448
|
+
children: /* @__PURE__ */ P("div", {
|
|
408
449
|
className: "mt-3",
|
|
409
|
-
children: /* @__PURE__ */
|
|
450
|
+
children: /* @__PURE__ */ P(f, {
|
|
410
451
|
entityType: "mybodyshield-coaching",
|
|
411
452
|
entityId: e.id,
|
|
412
453
|
title: "Coaching discussion",
|
|
@@ -419,8 +460,37 @@ function te({ relationship: e, currentUserId: t, busy: i, onTransition: a }) {
|
|
|
419
460
|
]
|
|
420
461
|
});
|
|
421
462
|
}
|
|
422
|
-
function
|
|
423
|
-
|
|
463
|
+
function ue() {
|
|
464
|
+
return /* @__PURE__ */ P(s, {
|
|
465
|
+
title: "How sharing is enforced",
|
|
466
|
+
description: "Private by default — a coach only ever sees the categories you switched on, for as long as the relationship is active.",
|
|
467
|
+
children: /* @__PURE__ */ P(L, {
|
|
468
|
+
treatment: "plain",
|
|
469
|
+
className: "p-5",
|
|
470
|
+
children: /* @__PURE__ */ P("ul", {
|
|
471
|
+
className: "grid gap-4 sm:grid-cols-2",
|
|
472
|
+
children: ce.map((e) => {
|
|
473
|
+
let t = e.icon;
|
|
474
|
+
return /* @__PURE__ */ F("li", {
|
|
475
|
+
className: "flex items-start gap-3",
|
|
476
|
+
children: [/* @__PURE__ */ P(_, { icon: /* @__PURE__ */ P(t, { className: "h-4 w-4" }) }), /* @__PURE__ */ F("div", {
|
|
477
|
+
className: "min-w-0",
|
|
478
|
+
children: [/* @__PURE__ */ P("p", {
|
|
479
|
+
className: "text-sm font-medium text-text-primary",
|
|
480
|
+
children: e.title
|
|
481
|
+
}), /* @__PURE__ */ P("p", {
|
|
482
|
+
className: "mt-0.5 text-xs leading-relaxed text-text-secondary",
|
|
483
|
+
children: e.detail
|
|
484
|
+
})]
|
|
485
|
+
})]
|
|
486
|
+
}, e.title);
|
|
487
|
+
})
|
|
488
|
+
})
|
|
489
|
+
})
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
function de() {
|
|
493
|
+
let { currentUser: n } = e(), r = g(), [s, u] = y("ALL"), [f, p] = y(!1), [m, _] = y(null), [b, x] = y(null), S = l(), C = d(), w = S.data?.items ?? [], T = v(() => {
|
|
424
494
|
let e = {
|
|
425
495
|
PENDING: 0,
|
|
426
496
|
ACTIVE: 0,
|
|
@@ -429,16 +499,16 @@ function ne() {
|
|
|
429
499
|
};
|
|
430
500
|
for (let t of w) e[t.status] += 1;
|
|
431
501
|
return e;
|
|
432
|
-
}, [w]),
|
|
502
|
+
}, [w]), E = v(() => [{
|
|
433
503
|
value: "ALL",
|
|
434
504
|
label: "All",
|
|
435
505
|
count: w.length
|
|
436
|
-
}, ...
|
|
506
|
+
}, ...K.map((e) => ({
|
|
437
507
|
value: e,
|
|
438
508
|
label: e.charAt(0) + e.slice(1).toLowerCase(),
|
|
439
|
-
count:
|
|
440
|
-
}))], [w.length,
|
|
441
|
-
|
|
509
|
+
count: T[e]
|
|
510
|
+
}))], [w.length, T]), D = v(() => s === "ALL" ? w : w.filter((e) => e.status === s), [w, s]), k = async (e, t) => {
|
|
511
|
+
_(e), x(null);
|
|
442
512
|
try {
|
|
443
513
|
await C.mutateAsync({
|
|
444
514
|
id: e,
|
|
@@ -447,58 +517,59 @@ function ne() {
|
|
|
447
517
|
} catch (e) {
|
|
448
518
|
x(e instanceof Error ? e.message : "Failed to update the relationship.");
|
|
449
519
|
} finally {
|
|
450
|
-
|
|
520
|
+
_(null);
|
|
451
521
|
}
|
|
452
|
-
},
|
|
453
|
-
return /* @__PURE__ */
|
|
522
|
+
}, A = S.isLoading && !S.data;
|
|
523
|
+
return /* @__PURE__ */ F(t, {
|
|
454
524
|
title: "Coaching",
|
|
455
525
|
description: "Coach ↔ member relationships and what's shared.",
|
|
456
|
-
actions: /* @__PURE__ */
|
|
526
|
+
actions: /* @__PURE__ */ F(I, {
|
|
457
527
|
onClick: () => p(!0),
|
|
458
|
-
children: [/* @__PURE__ */ M
|
|
528
|
+
children: [/* @__PURE__ */ P(M, { className: "mr-2 h-4 w-4" }), "New coaching"]
|
|
459
529
|
}),
|
|
460
530
|
children: [
|
|
461
|
-
/* @__PURE__ */
|
|
531
|
+
/* @__PURE__ */ P("div", {
|
|
462
532
|
className: "mb-6",
|
|
463
|
-
children: /* @__PURE__ */
|
|
464
|
-
options:
|
|
465
|
-
value:
|
|
466
|
-
onChange:
|
|
533
|
+
children: /* @__PURE__ */ P(c, {
|
|
534
|
+
options: E,
|
|
535
|
+
value: s,
|
|
536
|
+
onChange: u
|
|
467
537
|
})
|
|
468
538
|
}),
|
|
469
|
-
b && /* @__PURE__ */
|
|
539
|
+
b && /* @__PURE__ */ P("p", {
|
|
470
540
|
className: "mb-4 rounded-lg bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
|
|
471
541
|
children: b
|
|
472
542
|
}),
|
|
473
|
-
|
|
543
|
+
A ? /* @__PURE__ */ P(o, { label: "Loading coaching relationships…" }) : S.isError ? /* @__PURE__ */ P(a, {
|
|
474
544
|
message: "We couldn't load your coaching relationships.",
|
|
475
545
|
onRetry: () => void S.refetch()
|
|
476
|
-
}) :
|
|
546
|
+
}) : D.length === 0 ? /* @__PURE__ */ P(i, {
|
|
477
547
|
illustration: "empty-data",
|
|
478
|
-
icon: /* @__PURE__ */
|
|
548
|
+
icon: /* @__PURE__ */ P(O, { className: "h-10 w-10" }),
|
|
479
549
|
title: w.length === 0 ? "No coaching relationships" : "No relationships match this filter",
|
|
480
550
|
description: w.length === 0 ? "Connect a coach and a member to start sharing training, nutrition and progress data." : "Try a different status filter, or create a new coaching relationship.",
|
|
481
|
-
action: /* @__PURE__ */
|
|
551
|
+
action: /* @__PURE__ */ F(I, {
|
|
482
552
|
onClick: () => p(!0),
|
|
483
|
-
children: [/* @__PURE__ */ M
|
|
553
|
+
children: [/* @__PURE__ */ P(M, { className: "mr-2 h-4 w-4" }), "New coaching"]
|
|
484
554
|
})
|
|
485
|
-
}) : /* @__PURE__ */
|
|
555
|
+
}) : /* @__PURE__ */ P(h.div, {
|
|
486
556
|
className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",
|
|
487
|
-
variants: r ? void 0 :
|
|
557
|
+
variants: r ? void 0 : J,
|
|
488
558
|
initial: r ? !1 : "hidden",
|
|
489
559
|
animate: "show",
|
|
490
|
-
children:
|
|
560
|
+
children: D.map((e) => /* @__PURE__ */ P(h.div, {
|
|
491
561
|
className: "h-full",
|
|
492
|
-
variants: r ? void 0 :
|
|
493
|
-
children: /* @__PURE__ */
|
|
562
|
+
variants: r ? void 0 : ae,
|
|
563
|
+
children: /* @__PURE__ */ P($, {
|
|
494
564
|
relationship: e,
|
|
495
565
|
currentUserId: n?.id,
|
|
496
|
-
busy:
|
|
497
|
-
onTransition: (e, t) => void
|
|
566
|
+
busy: m === e.id,
|
|
567
|
+
onTransition: (e, t) => void k(e, t)
|
|
498
568
|
})
|
|
499
569
|
}, e.id))
|
|
500
570
|
}),
|
|
501
|
-
/* @__PURE__ */
|
|
571
|
+
/* @__PURE__ */ P(ue, {}),
|
|
572
|
+
/* @__PURE__ */ P(le, {
|
|
502
573
|
open: f,
|
|
503
574
|
onOpenChange: p,
|
|
504
575
|
defaultMember: {
|
|
@@ -510,6 +581,6 @@ function ne() {
|
|
|
510
581
|
});
|
|
511
582
|
}
|
|
512
583
|
//#endregion
|
|
513
|
-
export {
|
|
584
|
+
export { de as CoachingPage };
|
|
514
585
|
|
|
515
586
|
//# sourceMappingURL=CoachingPage.js.map
|