@burdenoff/microfe-mybodyshield 2026.705.1 → 2026.705.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.
Files changed (44) hide show
  1. package/dist/mybodyshield/components/DataTable.js +8 -4
  2. package/dist/mybodyshield/components/DataTable.js.map +1 -1
  3. package/dist/mybodyshield/components/EvidenceUpload.js +92 -4
  4. package/dist/mybodyshield/components/EvidenceUpload.js.map +1 -0
  5. package/dist/mybodyshield/components/FileLink.js +35 -2
  6. package/dist/mybodyshield/components/FileLink.js.map +1 -0
  7. package/dist/mybodyshield/components/MybDiscussion.js +107 -6
  8. package/dist/mybodyshield/components/MybDiscussion.js.map +1 -0
  9. package/dist/mybodyshield/components/MybTags.js +148 -4
  10. package/dist/mybodyshield/components/MybTags.js.map +1 -0
  11. package/dist/mybodyshield/components/Pagination.js.map +1 -1
  12. package/dist/mybodyshield/components/UserSearchSelect.js +148 -0
  13. package/dist/mybodyshield/components/UserSearchSelect.js.map +1 -0
  14. package/dist/mybodyshield/components/index.js +1 -0
  15. package/dist/mybodyshield/hooks/index.js +1 -0
  16. package/dist/mybodyshield/hooks/useMyBodyShieldApi.js +47 -27
  17. package/dist/mybodyshield/hooks/useMyBodyShieldApi.js.map +1 -1
  18. package/dist/mybodyshield/hooks/useMybComments.js +44 -2
  19. package/dist/mybodyshield/hooks/useMybComments.js.map +1 -0
  20. package/dist/mybodyshield/hooks/useMybFiles.js +80 -3
  21. package/dist/mybodyshield/hooks/useMybFiles.js.map +1 -0
  22. package/dist/mybodyshield/hooks/useMybTags.js +88 -2
  23. package/dist/mybodyshield/hooks/useMybTags.js.map +1 -0
  24. package/dist/mybodyshield/hooks/useMybUsers.js +36 -0
  25. package/dist/mybodyshield/hooks/useMybUsers.js.map +1 -0
  26. package/dist/mybodyshield/pages/DashboardPage.js +41 -36
  27. package/dist/mybodyshield/pages/DashboardPage.js.map +1 -1
  28. package/dist/mybodyshield/pages/_shared/visuals.js +15 -9
  29. package/dist/mybodyshield/pages/_shared/visuals.js.map +1 -1
  30. package/dist/mybodyshield/pages/coaching/CoachingPage.js +171 -147
  31. package/dist/mybodyshield/pages/coaching/CoachingPage.js.map +1 -1
  32. package/dist/mybodyshield/pages/goals/GoalsPage.js +0 -8
  33. package/dist/mybodyshield/pages/goals/GoalsPage.js.map +1 -1
  34. package/dist/mybodyshield/pages/nutrition/NutritionPage.js +352 -278
  35. package/dist/mybodyshield/pages/nutrition/NutritionPage.js.map +1 -1
  36. package/dist/mybodyshield/pages/programs/ProgramDetailPage.js +600 -296
  37. package/dist/mybodyshield/pages/programs/ProgramDetailPage.js.map +1 -1
  38. package/dist/mybodyshield/pages/progress/ProgressPage.js +88 -51
  39. package/dist/mybodyshield/pages/progress/ProgressPage.js.map +1 -1
  40. package/dist/mybodyshield/pages/train/SessionDetailPage.js +146 -126
  41. package/dist/mybodyshield/pages/train/SessionDetailPage.js.map +1 -1
  42. package/dist/mybodyshield/pages/train/SessionsPage.js +1 -4
  43. package/dist/mybodyshield/pages/train/SessionsPage.js.map +1 -1
  44. package/package.json +2 -2
@@ -9,18 +9,20 @@ import "../../context/index.js";
9
9
  import { useMybCoaching as c, useMybCreateCoaching as l, useMybTransitionCoaching as u } from "../../hooks/useMyBodyShieldApi.js";
10
10
  import "../../hooks/index.js";
11
11
  import { FilterTabs as d } from "../../components/FilterTabs.js";
12
+ import { MybDiscussion as f } from "../../components/MybDiscussion.js";
13
+ import { UserSearchSelect as p } from "../../components/UserSearchSelect.js";
12
14
  import "../../components/index.js";
13
- import { useMemo as f, useState as p } from "react";
14
- import { CalendarClock as m, CalendarX as h, Dumbbell as g, HeartHandshake as _, LineChart as v, Plus as y, Salad as b } from "lucide-react";
15
- import { jsx as x, jsxs as S } from "react/jsx-runtime";
16
- import { Button as C, GlassCard as w, Input as T, Label as E, ResponsiveDialog as D, ResponsiveDialogContent as O, ResponsiveDialogDescription as k, ResponsiveDialogFooter as A, ResponsiveDialogHeader as j, ResponsiveDialogTitle as M, Switch as N } from "@burdenoff/fe-libs/ui";
15
+ import { useMemo as m, useState as h } from "react";
16
+ import { CalendarClock as g, CalendarX as _, Check as v, ChevronDown as y, ChevronUp as b, Dumbbell as x, HeartHandshake as S, LineChart as C, MessageSquare as w, Minus as T, Plus as E, Salad as D } from "lucide-react";
17
+ import { jsx as O, jsxs as k } from "react/jsx-runtime";
18
+ import { Button as A, GlassCard as j, Input as M, Label as N, ResponsiveDialog as P, ResponsiveDialogContent as F, ResponsiveDialogDescription as I, ResponsiveDialogFooter as L, ResponsiveDialogHeader as R, ResponsiveDialogTitle as z, Switch as B } from "@burdenoff/fe-libs/ui";
17
19
  //#region src/mybodyshield/pages/coaching/CoachingPage.tsx
18
- var P = [
20
+ var V = [
19
21
  "PENDING",
20
22
  "ACTIVE",
21
23
  "PAUSED",
22
24
  "ENDED"
23
- ], F = {
25
+ ], H = {
24
26
  PENDING: [{
25
27
  to: "ACTIVE",
26
28
  label: "Accept",
@@ -46,42 +48,44 @@ var P = [
46
48
  }],
47
49
  ENDED: []
48
50
  };
49
- function I(e) {
51
+ function U(e) {
50
52
  return e.length <= 10 ? e : `${e.slice(0, 8)}…`;
51
53
  }
52
- function L(e) {
54
+ function W(e) {
53
55
  return {
54
- memberId: e,
56
+ memberId: e.userId,
57
+ memberName: e.displayName,
55
58
  coachId: "",
59
+ coachName: "",
56
60
  specialty: "",
57
61
  shareWorkouts: !0,
58
62
  shareNutrition: !0,
59
63
  shareMetrics: !0
60
64
  };
61
65
  }
62
- function R({ id: e, label: t, description: n, checked: r, onChange: i }) {
63
- return /* @__PURE__ */ S("div", {
66
+ function G({ id: e, label: t, description: n, checked: r, onChange: i }) {
67
+ return /* @__PURE__ */ k("div", {
64
68
  className: "flex items-center justify-between gap-4 rounded-xl bg-bg-sunken/60 p-3",
65
- children: [/* @__PURE__ */ S("div", {
69
+ children: [/* @__PURE__ */ k("div", {
66
70
  className: "min-w-0",
67
- children: [/* @__PURE__ */ x(E, {
71
+ children: [/* @__PURE__ */ O(N, {
68
72
  htmlFor: e,
69
73
  className: "cursor-pointer",
70
74
  children: t
71
- }), /* @__PURE__ */ x("p", {
75
+ }), /* @__PURE__ */ O("p", {
72
76
  className: "text-xs text-text-tertiary",
73
77
  children: n
74
78
  })]
75
- }), /* @__PURE__ */ x(N, {
79
+ }), /* @__PURE__ */ O(B, {
76
80
  id: e,
77
81
  checked: r,
78
82
  onCheckedChange: i
79
83
  })]
80
84
  });
81
85
  }
82
- function z({ open: e, onOpenChange: t, defaultMemberId: n }) {
83
- let r = l(), [i, a] = p(() => L(n)), [o, s] = p(null), c = (e) => {
84
- e || (a(L(n)), s(null)), t(e);
86
+ function K({ open: e, onOpenChange: t, defaultMember: n }) {
87
+ let r = l(), [i, a] = h(() => W(n)), [o, s] = h(null), c = (e) => {
88
+ e || (a(W(n)), s(null)), t(e);
85
89
  }, u = async () => {
86
90
  let e = i.coachId.trim(), o = i.memberId.trim();
87
91
  if (!e) {
@@ -102,74 +106,53 @@ function z({ open: e, onOpenChange: t, defaultMemberId: n }) {
102
106
  shareMetrics: i.shareMetrics
103
107
  };
104
108
  try {
105
- await r.mutateAsync(c), a(L(n)), t(!1);
109
+ await r.mutateAsync(c), a(W(n)), t(!1);
106
110
  } catch (e) {
107
111
  s(e instanceof Error ? e.message : "Failed to create coaching relationship.");
108
112
  }
109
113
  };
110
- return /* @__PURE__ */ x(D, {
114
+ return /* @__PURE__ */ O(P, {
111
115
  open: e,
112
116
  onOpenChange: c,
113
- children: /* @__PURE__ */ S(O, { children: [/* @__PURE__ */ S(j, { children: [/* @__PURE__ */ x(M, { children: "New coaching" }), /* @__PURE__ */ x(k, { children: "Link a coach and member, and choose exactly what training, nutrition and progress data is shared." })] }), /* @__PURE__ */ S("form", {
117
+ children: /* @__PURE__ */ k(F, { children: [/* @__PURE__ */ k(R, { children: [/* @__PURE__ */ O(z, { children: "New coaching" }), /* @__PURE__ */ O(I, { children: "Link a coach and member, and choose exactly what training, nutrition and progress data is shared." })] }), /* @__PURE__ */ k("form", {
114
118
  className: "space-y-4",
115
119
  onSubmit: (e) => {
116
120
  e.preventDefault(), u();
117
121
  },
118
122
  children: [
119
- o && /* @__PURE__ */ x("p", {
123
+ o && /* @__PURE__ */ O("p", {
120
124
  className: "rounded-lg bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
121
125
  children: o
122
126
  }),
123
- /* @__PURE__ */ S("div", {
124
- className: "space-y-2",
125
- children: [
126
- /* @__PURE__ */ x(E, {
127
- htmlFor: "myb-coaching-member",
128
- children: "Member"
129
- }),
130
- /* @__PURE__ */ x(T, {
131
- id: "myb-coaching-member",
132
- value: i.memberId,
133
- onChange: (e) => a((t) => ({
134
- ...t,
135
- memberId: e.target.value
136
- })),
137
- placeholder: "member user id"
138
- }),
139
- /* @__PURE__ */ x("p", {
140
- className: "text-xs text-text-tertiary",
141
- children: "member user id"
142
- })
143
- ]
127
+ /* @__PURE__ */ O(p, {
128
+ label: "Coach",
129
+ required: !0,
130
+ htmlId: "myb-coaching-coach",
131
+ userId: i.coachId,
132
+ displayName: i.coachName,
133
+ onSelect: ({ userId: e, displayName: t }) => a((n) => ({
134
+ ...n,
135
+ coachId: e,
136
+ coachName: t
137
+ }))
144
138
  }),
145
- /* @__PURE__ */ S("div", {
146
- className: "space-y-2",
147
- children: [
148
- /* @__PURE__ */ x(E, {
149
- htmlFor: "myb-coaching-coach",
150
- children: "Coach"
151
- }),
152
- /* @__PURE__ */ x(T, {
153
- id: "myb-coaching-coach",
154
- value: i.coachId,
155
- onChange: (e) => a((t) => ({
156
- ...t,
157
- coachId: e.target.value
158
- })),
159
- placeholder: "coach user id"
160
- }),
161
- /* @__PURE__ */ x("p", {
162
- className: "text-xs text-text-tertiary",
163
- children: "coach user id"
164
- })
165
- ]
139
+ /* @__PURE__ */ O(p, {
140
+ label: "Member",
141
+ htmlId: "myb-coaching-member",
142
+ userId: i.memberId,
143
+ displayName: i.memberName,
144
+ onSelect: ({ userId: e, displayName: t }) => a((n) => ({
145
+ ...n,
146
+ memberId: e,
147
+ memberName: t
148
+ }))
166
149
  }),
167
- /* @__PURE__ */ S("div", {
150
+ /* @__PURE__ */ k("div", {
168
151
  className: "space-y-2",
169
- children: [/* @__PURE__ */ x(E, {
152
+ children: [/* @__PURE__ */ O(N, {
170
153
  htmlFor: "myb-coaching-specialty",
171
154
  children: "Specialty"
172
- }), /* @__PURE__ */ x(T, {
155
+ }), /* @__PURE__ */ O(M, {
173
156
  id: "myb-coaching-specialty",
174
157
  value: i.specialty,
175
158
  onChange: (e) => a((t) => ({
@@ -179,14 +162,14 @@ function z({ open: e, onOpenChange: t, defaultMemberId: n }) {
179
162
  placeholder: "e.g., Strength & conditioning"
180
163
  })]
181
164
  }),
182
- /* @__PURE__ */ S("div", {
165
+ /* @__PURE__ */ k("div", {
183
166
  className: "space-y-2",
184
167
  children: [
185
- /* @__PURE__ */ x("p", {
168
+ /* @__PURE__ */ O("p", {
186
169
  className: "text-sm font-medium text-text-primary",
187
170
  children: "Shared with the coach"
188
171
  }),
189
- /* @__PURE__ */ x(R, {
172
+ /* @__PURE__ */ O(G, {
190
173
  id: "myb-coaching-share-workouts",
191
174
  label: "Workouts",
192
175
  description: "Programs, sessions and logged sets.",
@@ -196,7 +179,7 @@ function z({ open: e, onOpenChange: t, defaultMemberId: n }) {
196
179
  shareWorkouts: e
197
180
  }))
198
181
  }),
199
- /* @__PURE__ */ x(R, {
182
+ /* @__PURE__ */ O(G, {
200
183
  id: "myb-coaching-share-nutrition",
201
184
  label: "Nutrition",
202
185
  description: "Plans, meals and daily macros.",
@@ -206,7 +189,7 @@ function z({ open: e, onOpenChange: t, defaultMemberId: n }) {
206
189
  shareNutrition: e
207
190
  }))
208
191
  }),
209
- /* @__PURE__ */ x(R, {
192
+ /* @__PURE__ */ O(G, {
210
193
  id: "myb-coaching-share-metrics",
211
194
  label: "Metrics",
212
195
  description: "Body metrics and recovery logs.",
@@ -218,13 +201,13 @@ function z({ open: e, onOpenChange: t, defaultMemberId: n }) {
218
201
  })
219
202
  ]
220
203
  }),
221
- /* @__PURE__ */ S(A, { children: [/* @__PURE__ */ x(C, {
204
+ /* @__PURE__ */ k(L, { children: [/* @__PURE__ */ O(A, {
222
205
  type: "button",
223
206
  variant: "outline",
224
207
  onClick: () => c(!1),
225
208
  disabled: r.isPending,
226
209
  children: "Cancel"
227
- }), /* @__PURE__ */ x(C, {
210
+ }), /* @__PURE__ */ O(A, {
228
211
  type: "submit",
229
212
  disabled: r.isPending,
230
213
  children: r.isPending ? "Creating…" : "Create coaching"
@@ -233,190 +216,231 @@ function z({ open: e, onOpenChange: t, defaultMemberId: n }) {
233
216
  })] })
234
217
  });
235
218
  }
236
- function B({ label: e, icon: t, on: n }) {
237
- return /* @__PURE__ */ S("span", {
219
+ function q({ label: e, icon: t, on: n }) {
220
+ let r = t, i = n ? v : T;
221
+ return /* @__PURE__ */ k("span", {
222
+ "aria-label": `${e} ${n ? "shared" : "not shared"}`,
238
223
  className: `inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium ${n ? "bg-status-success-bg-subtle text-status-success-text" : "bg-bg-sunken text-text-tertiary"}`,
239
- children: [/* @__PURE__ */ x(t, { className: "h-3 w-3" }), e]
224
+ children: [
225
+ /* @__PURE__ */ O(r, {
226
+ className: "h-3 w-3",
227
+ "aria-hidden": "true"
228
+ }),
229
+ e,
230
+ /* @__PURE__ */ O(i, {
231
+ className: "h-3 w-3",
232
+ "aria-hidden": "true"
233
+ }),
234
+ /* @__PURE__ */ O("span", {
235
+ "aria-hidden": "true",
236
+ children: n ? "On" : "Off"
237
+ })
238
+ ]
240
239
  });
241
240
  }
242
- function V({ relationship: e, currentUserId: t, busy: i, onTransition: a }) {
243
- let o = !!t && e.coachId === t, c = !!t && e.memberId === t, l = F[e.status];
244
- return /* @__PURE__ */ S(w, {
241
+ function J({ relationship: e, currentUserId: t, busy: i, onTransition: a }) {
242
+ let o = !!t && e.coachId === t, c = !!t && e.memberId === t, l = H[e.status], u = e.status === "ACTIVE" || e.status === "PAUSED", [d, p] = h(!1);
243
+ return /* @__PURE__ */ k(j, {
245
244
  treatment: "glass",
246
245
  className: "flex flex-col gap-4 p-5",
247
246
  children: [
248
- /* @__PURE__ */ S("div", {
247
+ /* @__PURE__ */ k("div", {
249
248
  className: "flex items-start justify-between gap-3",
250
- children: [/* @__PURE__ */ S("div", {
249
+ children: [/* @__PURE__ */ k("div", {
251
250
  className: "flex min-w-0 items-start gap-3",
252
- children: [/* @__PURE__ */ x(s, { icon: /* @__PURE__ */ x(_, { className: "h-4 w-4" }) }), /* @__PURE__ */ S("div", {
251
+ children: [/* @__PURE__ */ O(s, { icon: /* @__PURE__ */ O(S, { className: "h-4 w-4" }) }), /* @__PURE__ */ k("div", {
253
252
  className: "min-w-0",
254
- children: [/* @__PURE__ */ x("p", {
253
+ children: [/* @__PURE__ */ O("p", {
255
254
  className: "truncate text-sm font-semibold text-text-primary",
256
255
  children: e.specialty?.trim() || "Coaching relationship"
257
- }), /* @__PURE__ */ x("p", {
256
+ }), /* @__PURE__ */ O("p", {
258
257
  className: "text-xs text-text-tertiary",
259
258
  children: "Coach ↔ member"
260
259
  })]
261
260
  })]
262
- }), /* @__PURE__ */ x(r, { status: e.status })]
261
+ }), /* @__PURE__ */ O(r, { status: e.status })]
263
262
  }),
264
- /* @__PURE__ */ S("div", {
263
+ /* @__PURE__ */ k("div", {
265
264
  className: "grid grid-cols-2 gap-3",
266
- children: [/* @__PURE__ */ S("div", {
265
+ children: [/* @__PURE__ */ k("div", {
267
266
  className: "rounded-lg bg-bg-sunken/60 p-2.5",
268
- children: [/* @__PURE__ */ x("p", {
267
+ children: [/* @__PURE__ */ O("p", {
269
268
  className: "text-[11px] font-medium uppercase tracking-wide text-text-tertiary",
270
269
  children: "Coach"
271
- }), /* @__PURE__ */ x("p", {
270
+ }), /* @__PURE__ */ O("p", {
272
271
  className: "mt-0.5 truncate text-sm font-medium text-text-primary",
273
272
  title: e.coachId,
274
- children: o ? "You" : `#${I(e.coachId)}`
273
+ children: o ? "You" : `#${U(e.coachId)}`
275
274
  })]
276
- }), /* @__PURE__ */ S("div", {
275
+ }), /* @__PURE__ */ k("div", {
277
276
  className: "rounded-lg bg-bg-sunken/60 p-2.5",
278
- children: [/* @__PURE__ */ x("p", {
277
+ children: [/* @__PURE__ */ O("p", {
279
278
  className: "text-[11px] font-medium uppercase tracking-wide text-text-tertiary",
280
279
  children: "Member"
281
- }), /* @__PURE__ */ x("p", {
280
+ }), /* @__PURE__ */ O("p", {
282
281
  className: "mt-0.5 truncate text-sm font-medium text-text-primary",
283
282
  title: e.memberId,
284
- children: c ? "You" : `#${I(e.memberId)}`
283
+ children: c ? "You" : `#${U(e.memberId)}`
285
284
  })]
286
285
  })]
287
286
  }),
288
- /* @__PURE__ */ S("div", {
287
+ /* @__PURE__ */ k("div", {
289
288
  className: "flex flex-wrap gap-1.5",
290
289
  children: [
291
- /* @__PURE__ */ x(B, {
290
+ /* @__PURE__ */ O(q, {
292
291
  label: "Workouts",
293
- icon: g,
292
+ icon: x,
294
293
  on: e.shareWorkouts
295
294
  }),
296
- /* @__PURE__ */ x(B, {
295
+ /* @__PURE__ */ O(q, {
297
296
  label: "Nutrition",
298
- icon: b,
297
+ icon: D,
299
298
  on: e.shareNutrition
300
299
  }),
301
- /* @__PURE__ */ x(B, {
300
+ /* @__PURE__ */ O(q, {
302
301
  label: "Metrics",
303
- icon: v,
302
+ icon: C,
304
303
  on: e.shareMetrics
305
304
  })
306
305
  ]
307
306
  }),
308
- (e.startedAt || e.endedAt) && /* @__PURE__ */ S("div", {
307
+ (e.startedAt || e.endedAt) && /* @__PURE__ */ k("div", {
309
308
  className: "flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-text-tertiary",
310
- children: [e.startedAt && /* @__PURE__ */ S("span", {
309
+ children: [e.startedAt && /* @__PURE__ */ k("span", {
311
310
  className: "inline-flex items-center gap-1",
312
311
  children: [
313
- /* @__PURE__ */ x(m, { className: "h-3.5 w-3.5" }),
312
+ /* @__PURE__ */ O(g, { className: "h-3.5 w-3.5" }),
314
313
  "Started ",
315
314
  n(e.startedAt)
316
315
  ]
317
- }), e.endedAt && /* @__PURE__ */ S("span", {
316
+ }), e.endedAt && /* @__PURE__ */ k("span", {
318
317
  className: "inline-flex items-center gap-1",
319
318
  children: [
320
- /* @__PURE__ */ x(h, { className: "h-3.5 w-3.5" }),
319
+ /* @__PURE__ */ O(_, { className: "h-3.5 w-3.5" }),
321
320
  "Ended ",
322
321
  n(e.endedAt)
323
322
  ]
324
323
  })]
325
324
  }),
326
- l.length > 0 && /* @__PURE__ */ x("div", {
325
+ l.length > 0 && /* @__PURE__ */ O("div", {
327
326
  className: "mt-auto flex flex-wrap gap-2 pt-1",
328
- children: l.map((t) => /* @__PURE__ */ x(C, {
327
+ children: l.map((t) => /* @__PURE__ */ O(A, {
329
328
  size: "sm",
330
329
  variant: t.primary ? void 0 : "outline",
331
330
  disabled: i,
332
331
  onClick: () => a(e.id, t.to),
333
332
  children: t.label
334
333
  }, t.to))
334
+ }),
335
+ u && /* @__PURE__ */ k("div", {
336
+ className: `border-t border-border-seam pt-3 ${l.length === 0 ? "mt-auto" : ""}`,
337
+ children: [/* @__PURE__ */ k("button", {
338
+ type: "button",
339
+ onClick: () => p((e) => !e),
340
+ "aria-expanded": d,
341
+ className: "inline-flex items-center gap-1.5 text-sm font-medium text-accent hover:underline",
342
+ children: [
343
+ /* @__PURE__ */ O(w, { className: "h-4 w-4" }),
344
+ d ? "Hide discussion" : "Discussion",
345
+ O(d ? b : y, { className: "h-4 w-4" })
346
+ ]
347
+ }), d && /* @__PURE__ */ O("div", {
348
+ className: "mt-3",
349
+ children: /* @__PURE__ */ O(f, {
350
+ entityType: "mybodyshield-coaching",
351
+ entityId: e.id,
352
+ title: "Coaching discussion",
353
+ description: "A private thread between the coach and member."
354
+ })
355
+ })]
335
356
  })
336
357
  ]
337
358
  });
338
359
  }
339
- function H() {
340
- let { currentUser: n } = e(), [r, s] = p("ALL"), [l, m] = p(!1), [h, g] = p(null), [v, b] = p(null), w = c(), T = u(), E = w.data ?? [], D = f(() => {
360
+ function Y() {
361
+ let { currentUser: n } = e(), [r, s] = h("ALL"), [l, f] = h(!1), [p, g] = h(null), [_, v] = h(null), y = c(), b = u(), x = y.data ?? [], C = m(() => {
341
362
  let e = {
342
363
  PENDING: 0,
343
364
  ACTIVE: 0,
344
365
  PAUSED: 0,
345
366
  ENDED: 0
346
367
  };
347
- for (let t of E) e[t.status] += 1;
368
+ for (let t of x) e[t.status] += 1;
348
369
  return e;
349
- }, [E]), O = f(() => [{
370
+ }, [x]), w = m(() => [{
350
371
  value: "ALL",
351
372
  label: "All",
352
- count: E.length
353
- }, ...P.map((e) => ({
373
+ count: x.length
374
+ }, ...V.map((e) => ({
354
375
  value: e,
355
376
  label: e.charAt(0) + e.slice(1).toLowerCase(),
356
- count: D[e]
357
- }))], [E.length, D]), k = f(() => r === "ALL" ? E : E.filter((e) => e.status === r), [E, r]), A = async (e, t) => {
358
- g(e), b(null);
377
+ count: C[e]
378
+ }))], [x.length, C]), T = m(() => r === "ALL" ? x : x.filter((e) => e.status === r), [x, r]), D = async (e, t) => {
379
+ g(e), v(null);
359
380
  try {
360
- await T.mutateAsync({
381
+ await b.mutateAsync({
361
382
  id: e,
362
383
  status: t
363
384
  });
364
385
  } catch (e) {
365
- b(e instanceof Error ? e.message : "Failed to update the relationship.");
386
+ v(e instanceof Error ? e.message : "Failed to update the relationship.");
366
387
  } finally {
367
388
  g(null);
368
389
  }
369
- }, j = w.isLoading && !w.data;
370
- return /* @__PURE__ */ S(t, {
390
+ }, j = y.isLoading && !y.data;
391
+ return /* @__PURE__ */ k(t, {
371
392
  title: "Coaching",
372
393
  description: "Coach ↔ member relationships and what's shared.",
373
- actions: /* @__PURE__ */ S(C, {
374
- onClick: () => m(!0),
375
- children: [/* @__PURE__ */ x(y, { className: "mr-2 h-4 w-4" }), "New coaching"]
394
+ actions: /* @__PURE__ */ k(A, {
395
+ onClick: () => f(!0),
396
+ children: [/* @__PURE__ */ O(E, { className: "mr-2 h-4 w-4" }), "New coaching"]
376
397
  }),
377
398
  children: [
378
- /* @__PURE__ */ x("div", {
399
+ /* @__PURE__ */ O("div", {
379
400
  className: "mb-6",
380
- children: /* @__PURE__ */ x(d, {
381
- options: O,
401
+ children: /* @__PURE__ */ O(d, {
402
+ options: w,
382
403
  value: r,
383
404
  onChange: s
384
405
  })
385
406
  }),
386
- v && /* @__PURE__ */ x("p", {
407
+ _ && /* @__PURE__ */ O("p", {
387
408
  className: "mb-4 rounded-lg bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
388
- children: v
409
+ children: _
389
410
  }),
390
- j ? /* @__PURE__ */ x(a, { label: "Loading coaching relationships…" }) : w.isError ? /* @__PURE__ */ x(i, {
411
+ j ? /* @__PURE__ */ O(a, { label: "Loading coaching relationships…" }) : y.isError ? /* @__PURE__ */ O(i, {
391
412
  message: "We couldn't load your coaching relationships.",
392
- onRetry: () => void w.refetch()
393
- }) : k.length === 0 ? /* @__PURE__ */ x(o, {
413
+ onRetry: () => void y.refetch()
414
+ }) : T.length === 0 ? /* @__PURE__ */ O(o, {
394
415
  illustration: "empty-data",
395
- icon: /* @__PURE__ */ x(_, { className: "h-10 w-10" }),
396
- title: E.length === 0 ? "No coaching relationships" : "No relationships match this filter",
397
- description: E.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.",
398
- action: /* @__PURE__ */ S(C, {
399
- onClick: () => m(!0),
400
- children: [/* @__PURE__ */ x(y, { className: "mr-2 h-4 w-4" }), "New coaching"]
416
+ icon: /* @__PURE__ */ O(S, { className: "h-10 w-10" }),
417
+ title: x.length === 0 ? "No coaching relationships" : "No relationships match this filter",
418
+ description: x.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.",
419
+ action: /* @__PURE__ */ k(A, {
420
+ onClick: () => f(!0),
421
+ children: [/* @__PURE__ */ O(E, { className: "mr-2 h-4 w-4" }), "New coaching"]
401
422
  })
402
- }) : /* @__PURE__ */ x("div", {
423
+ }) : /* @__PURE__ */ O("div", {
403
424
  className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",
404
- children: k.map((e) => /* @__PURE__ */ x(V, {
425
+ children: T.map((e) => /* @__PURE__ */ O(J, {
405
426
  relationship: e,
406
427
  currentUserId: n?.id,
407
- busy: h === e.id,
408
- onTransition: (e, t) => void A(e, t)
428
+ busy: p === e.id,
429
+ onTransition: (e, t) => void D(e, t)
409
430
  }, e.id))
410
431
  }),
411
- /* @__PURE__ */ x(z, {
432
+ /* @__PURE__ */ O(K, {
412
433
  open: l,
413
- onOpenChange: m,
414
- defaultMemberId: n?.id ?? ""
434
+ onOpenChange: f,
435
+ defaultMember: {
436
+ userId: n?.id ?? "",
437
+ displayName: n?.name || n?.email || ""
438
+ }
415
439
  })
416
440
  ]
417
441
  });
418
442
  }
419
443
  //#endregion
420
- export { H as CoachingPage };
444
+ export { Y as CoachingPage };
421
445
 
422
446
  //# sourceMappingURL=CoachingPage.js.map