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