@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.
- package/dist/mybodyshield/components/DataTable.js +8 -4
- package/dist/mybodyshield/components/DataTable.js.map +1 -1
- package/dist/mybodyshield/components/EvidenceUpload.js +92 -4
- package/dist/mybodyshield/components/EvidenceUpload.js.map +1 -0
- package/dist/mybodyshield/components/FileLink.js +35 -2
- package/dist/mybodyshield/components/FileLink.js.map +1 -0
- package/dist/mybodyshield/components/MybDiscussion.js +107 -6
- package/dist/mybodyshield/components/MybDiscussion.js.map +1 -0
- package/dist/mybodyshield/components/MybTags.js +148 -4
- package/dist/mybodyshield/components/MybTags.js.map +1 -0
- package/dist/mybodyshield/components/Pagination.js.map +1 -1
- package/dist/mybodyshield/components/UserSearchSelect.js +148 -0
- package/dist/mybodyshield/components/UserSearchSelect.js.map +1 -0
- package/dist/mybodyshield/components/index.js +1 -0
- package/dist/mybodyshield/hooks/index.js +1 -0
- package/dist/mybodyshield/hooks/useMyBodyShieldApi.js +47 -27
- package/dist/mybodyshield/hooks/useMyBodyShieldApi.js.map +1 -1
- package/dist/mybodyshield/hooks/useMybComments.js +44 -2
- package/dist/mybodyshield/hooks/useMybComments.js.map +1 -0
- package/dist/mybodyshield/hooks/useMybFiles.js +80 -3
- package/dist/mybodyshield/hooks/useMybFiles.js.map +1 -0
- package/dist/mybodyshield/hooks/useMybTags.js +88 -2
- package/dist/mybodyshield/hooks/useMybTags.js.map +1 -0
- package/dist/mybodyshield/hooks/useMybUsers.js +36 -0
- package/dist/mybodyshield/hooks/useMybUsers.js.map +1 -0
- package/dist/mybodyshield/pages/DashboardPage.js +41 -36
- package/dist/mybodyshield/pages/DashboardPage.js.map +1 -1
- package/dist/mybodyshield/pages/_shared/visuals.js +15 -9
- package/dist/mybodyshield/pages/_shared/visuals.js.map +1 -1
- package/dist/mybodyshield/pages/coaching/CoachingPage.js +171 -147
- package/dist/mybodyshield/pages/coaching/CoachingPage.js.map +1 -1
- package/dist/mybodyshield/pages/goals/GoalsPage.js +0 -8
- package/dist/mybodyshield/pages/goals/GoalsPage.js.map +1 -1
- package/dist/mybodyshield/pages/nutrition/NutritionPage.js +352 -278
- package/dist/mybodyshield/pages/nutrition/NutritionPage.js.map +1 -1
- package/dist/mybodyshield/pages/programs/ProgramDetailPage.js +600 -296
- package/dist/mybodyshield/pages/programs/ProgramDetailPage.js.map +1 -1
- package/dist/mybodyshield/pages/progress/ProgressPage.js +88 -51
- package/dist/mybodyshield/pages/progress/ProgressPage.js.map +1 -1
- package/dist/mybodyshield/pages/train/SessionDetailPage.js +146 -126
- package/dist/mybodyshield/pages/train/SessionDetailPage.js.map +1 -1
- package/dist/mybodyshield/pages/train/SessionsPage.js +1 -4
- package/dist/mybodyshield/pages/train/SessionsPage.js.map +1 -1
- 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
|
|
14
|
-
import { CalendarClock as
|
|
15
|
-
import { jsx as
|
|
16
|
-
import { Button as
|
|
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
|
|
20
|
+
var V = [
|
|
19
21
|
"PENDING",
|
|
20
22
|
"ACTIVE",
|
|
21
23
|
"PAUSED",
|
|
22
24
|
"ENDED"
|
|
23
|
-
],
|
|
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
|
|
51
|
+
function U(e) {
|
|
50
52
|
return e.length <= 10 ? e : `${e.slice(0, 8)}…`;
|
|
51
53
|
}
|
|
52
|
-
function
|
|
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
|
|
63
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
69
|
+
children: [/* @__PURE__ */ k("div", {
|
|
66
70
|
className: "min-w-0",
|
|
67
|
-
children: [/* @__PURE__ */
|
|
71
|
+
children: [/* @__PURE__ */ O(N, {
|
|
68
72
|
htmlFor: e,
|
|
69
73
|
className: "cursor-pointer",
|
|
70
74
|
children: t
|
|
71
|
-
}), /* @__PURE__ */
|
|
75
|
+
}), /* @__PURE__ */ O("p", {
|
|
72
76
|
className: "text-xs text-text-tertiary",
|
|
73
77
|
children: n
|
|
74
78
|
})]
|
|
75
|
-
}), /* @__PURE__ */
|
|
79
|
+
}), /* @__PURE__ */ O(B, {
|
|
76
80
|
id: e,
|
|
77
81
|
checked: r,
|
|
78
82
|
onCheckedChange: i
|
|
79
83
|
})]
|
|
80
84
|
});
|
|
81
85
|
}
|
|
82
|
-
function
|
|
83
|
-
let r = l(), [i, a] =
|
|
84
|
-
e || (a(
|
|
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(
|
|
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__ */
|
|
114
|
+
return /* @__PURE__ */ O(P, {
|
|
111
115
|
open: e,
|
|
112
116
|
onOpenChange: c,
|
|
113
|
-
children: /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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__ */
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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__ */
|
|
150
|
+
/* @__PURE__ */ k("div", {
|
|
168
151
|
className: "space-y-2",
|
|
169
|
-
children: [/* @__PURE__ */
|
|
152
|
+
children: [/* @__PURE__ */ O(N, {
|
|
170
153
|
htmlFor: "myb-coaching-specialty",
|
|
171
154
|
children: "Specialty"
|
|
172
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
165
|
+
/* @__PURE__ */ k("div", {
|
|
183
166
|
className: "space-y-2",
|
|
184
167
|
children: [
|
|
185
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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
|
|
237
|
-
|
|
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: [
|
|
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
|
|
243
|
-
let o = !!t && e.coachId === t, c = !!t && e.memberId === t, l =
|
|
244
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
247
|
+
/* @__PURE__ */ k("div", {
|
|
249
248
|
className: "flex items-start justify-between gap-3",
|
|
250
|
-
children: [/* @__PURE__ */
|
|
249
|
+
children: [/* @__PURE__ */ k("div", {
|
|
251
250
|
className: "flex min-w-0 items-start gap-3",
|
|
252
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
256
|
+
}), /* @__PURE__ */ O("p", {
|
|
258
257
|
className: "text-xs text-text-tertiary",
|
|
259
258
|
children: "Coach ↔ member"
|
|
260
259
|
})]
|
|
261
260
|
})]
|
|
262
|
-
}), /* @__PURE__ */
|
|
261
|
+
}), /* @__PURE__ */ O(r, { status: e.status })]
|
|
263
262
|
}),
|
|
264
|
-
/* @__PURE__ */
|
|
263
|
+
/* @__PURE__ */ k("div", {
|
|
265
264
|
className: "grid grid-cols-2 gap-3",
|
|
266
|
-
children: [/* @__PURE__ */
|
|
265
|
+
children: [/* @__PURE__ */ k("div", {
|
|
267
266
|
className: "rounded-lg bg-bg-sunken/60 p-2.5",
|
|
268
|
-
children: [/* @__PURE__ */
|
|
267
|
+
children: [/* @__PURE__ */ O("p", {
|
|
269
268
|
className: "text-[11px] font-medium uppercase tracking-wide text-text-tertiary",
|
|
270
269
|
children: "Coach"
|
|
271
|
-
}), /* @__PURE__ */
|
|
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" : `#${
|
|
273
|
+
children: o ? "You" : `#${U(e.coachId)}`
|
|
275
274
|
})]
|
|
276
|
-
}), /* @__PURE__ */
|
|
275
|
+
}), /* @__PURE__ */ k("div", {
|
|
277
276
|
className: "rounded-lg bg-bg-sunken/60 p-2.5",
|
|
278
|
-
children: [/* @__PURE__ */
|
|
277
|
+
children: [/* @__PURE__ */ O("p", {
|
|
279
278
|
className: "text-[11px] font-medium uppercase tracking-wide text-text-tertiary",
|
|
280
279
|
children: "Member"
|
|
281
|
-
}), /* @__PURE__ */
|
|
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" : `#${
|
|
283
|
+
children: c ? "You" : `#${U(e.memberId)}`
|
|
285
284
|
})]
|
|
286
285
|
})]
|
|
287
286
|
}),
|
|
288
|
-
/* @__PURE__ */
|
|
287
|
+
/* @__PURE__ */ k("div", {
|
|
289
288
|
className: "flex flex-wrap gap-1.5",
|
|
290
289
|
children: [
|
|
291
|
-
/* @__PURE__ */
|
|
290
|
+
/* @__PURE__ */ O(q, {
|
|
292
291
|
label: "Workouts",
|
|
293
|
-
icon:
|
|
292
|
+
icon: x,
|
|
294
293
|
on: e.shareWorkouts
|
|
295
294
|
}),
|
|
296
|
-
/* @__PURE__ */
|
|
295
|
+
/* @__PURE__ */ O(q, {
|
|
297
296
|
label: "Nutrition",
|
|
298
|
-
icon:
|
|
297
|
+
icon: D,
|
|
299
298
|
on: e.shareNutrition
|
|
300
299
|
}),
|
|
301
|
-
/* @__PURE__ */
|
|
300
|
+
/* @__PURE__ */ O(q, {
|
|
302
301
|
label: "Metrics",
|
|
303
|
-
icon:
|
|
302
|
+
icon: C,
|
|
304
303
|
on: e.shareMetrics
|
|
305
304
|
})
|
|
306
305
|
]
|
|
307
306
|
}),
|
|
308
|
-
(e.startedAt || e.endedAt) && /* @__PURE__ */
|
|
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__ */
|
|
309
|
+
children: [e.startedAt && /* @__PURE__ */ k("span", {
|
|
311
310
|
className: "inline-flex items-center gap-1",
|
|
312
311
|
children: [
|
|
313
|
-
/* @__PURE__ */
|
|
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__ */
|
|
316
|
+
}), e.endedAt && /* @__PURE__ */ k("span", {
|
|
318
317
|
className: "inline-flex items-center gap-1",
|
|
319
318
|
children: [
|
|
320
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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
|
|
340
|
-
let { currentUser: n } = e(), [r, s] =
|
|
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
|
|
368
|
+
for (let t of x) e[t.status] += 1;
|
|
348
369
|
return e;
|
|
349
|
-
}, [
|
|
370
|
+
}, [x]), w = m(() => [{
|
|
350
371
|
value: "ALL",
|
|
351
372
|
label: "All",
|
|
352
|
-
count:
|
|
353
|
-
}, ...
|
|
373
|
+
count: x.length
|
|
374
|
+
}, ...V.map((e) => ({
|
|
354
375
|
value: e,
|
|
355
376
|
label: e.charAt(0) + e.slice(1).toLowerCase(),
|
|
356
|
-
count:
|
|
357
|
-
}))], [
|
|
358
|
-
g(e),
|
|
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
|
|
381
|
+
await b.mutateAsync({
|
|
361
382
|
id: e,
|
|
362
383
|
status: t
|
|
363
384
|
});
|
|
364
385
|
} catch (e) {
|
|
365
|
-
|
|
386
|
+
v(e instanceof Error ? e.message : "Failed to update the relationship.");
|
|
366
387
|
} finally {
|
|
367
388
|
g(null);
|
|
368
389
|
}
|
|
369
|
-
}, j =
|
|
370
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
374
|
-
onClick: () =>
|
|
375
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
399
|
+
/* @__PURE__ */ O("div", {
|
|
379
400
|
className: "mb-6",
|
|
380
|
-
children: /* @__PURE__ */
|
|
381
|
-
options:
|
|
401
|
+
children: /* @__PURE__ */ O(d, {
|
|
402
|
+
options: w,
|
|
382
403
|
value: r,
|
|
383
404
|
onChange: s
|
|
384
405
|
})
|
|
385
406
|
}),
|
|
386
|
-
|
|
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:
|
|
409
|
+
children: _
|
|
389
410
|
}),
|
|
390
|
-
j ? /* @__PURE__ */
|
|
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
|
|
393
|
-
}) :
|
|
413
|
+
onRetry: () => void y.refetch()
|
|
414
|
+
}) : T.length === 0 ? /* @__PURE__ */ O(o, {
|
|
394
415
|
illustration: "empty-data",
|
|
395
|
-
icon: /* @__PURE__ */
|
|
396
|
-
title:
|
|
397
|
-
description:
|
|
398
|
-
action: /* @__PURE__ */
|
|
399
|
-
onClick: () =>
|
|
400
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
423
|
+
}) : /* @__PURE__ */ O("div", {
|
|
403
424
|
className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",
|
|
404
|
-
children:
|
|
425
|
+
children: T.map((e) => /* @__PURE__ */ O(J, {
|
|
405
426
|
relationship: e,
|
|
406
427
|
currentUserId: n?.id,
|
|
407
|
-
busy:
|
|
408
|
-
onTransition: (e, t) => void
|
|
428
|
+
busy: p === e.id,
|
|
429
|
+
onTransition: (e, t) => void D(e, t)
|
|
409
430
|
}, e.id))
|
|
410
431
|
}),
|
|
411
|
-
/* @__PURE__ */
|
|
432
|
+
/* @__PURE__ */ O(K, {
|
|
412
433
|
open: l,
|
|
413
|
-
onOpenChange:
|
|
414
|
-
|
|
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 {
|
|
444
|
+
export { Y as CoachingPage };
|
|
421
445
|
|
|
422
446
|
//# sourceMappingURL=CoachingPage.js.map
|