@burdenoff/microfe-mybodyshield 2026.830.1 → 2026.1026.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/MyBodyShieldRoutes.d.ts.map +1 -1
- package/dist/mybodyshield/MyBodyShieldRoutes.js +35 -24
- package/dist/mybodyshield/MyBodyShieldRoutes.js.map +1 -1
- package/dist/mybodyshield/components/FilterTabs.js +1 -1
- package/dist/mybodyshield/components/FilterTabs.js.map +1 -1
- package/dist/mybodyshield/hooks/useMyBodyShieldApi.d.ts +4 -1
- package/dist/mybodyshield/hooks/useMyBodyShieldApi.d.ts.map +1 -1
- package/dist/mybodyshield/hooks/useMyBodyShieldApi.js +85 -60
- package/dist/mybodyshield/hooks/useMyBodyShieldApi.js.map +1 -1
- package/dist/mybodyshield/pages/insights/InsightsPage.js +1 -1
- package/dist/mybodyshield/pages/insights/InsightsPage.js.map +1 -1
- package/dist/mybodyshield/pages/recovery/MindfulnessPage.d.ts +2 -0
- package/dist/mybodyshield/pages/recovery/MindfulnessPage.d.ts.map +1 -0
- package/dist/mybodyshield/pages/recovery/MindfulnessPage.js +181 -0
- package/dist/mybodyshield/pages/recovery/MindfulnessPage.js.map +1 -0
- package/dist/mybodyshield/pages/recovery/RecoveryPage.d.ts.map +1 -1
- package/dist/mybodyshield/pages/recovery/RecoveryPage.js +210 -201
- package/dist/mybodyshield/pages/recovery/RecoveryPage.js.map +1 -1
- package/dist/mybodyshield/types/index.d.ts +31 -0
- package/dist/mybodyshield/types/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
1
|
+
import { useMyBodyShield as e } from "../../context/MyBodyShieldContext.js";
|
|
2
|
+
import { PageLayout as t } from "../../components/PageLayout.js";
|
|
3
|
+
import { MetricsCard as n } from "../../components/MetricsCard.js";
|
|
4
|
+
import { formatDate as ee, formatNumber as r, formatRelativeTime as i } from "../../utils/formatters.js";
|
|
5
|
+
import { EmptyState as te } from "../../components/EmptyState.js";
|
|
6
|
+
import "../../context/index.js";
|
|
7
|
+
import { useMybLogRecovery as ne, useMybRecoveryLogs as a } from "../../hooks/useMyBodyShieldApi.js";
|
|
8
|
+
import { useTr as re } from "../../hooks/useTr.js";
|
|
7
9
|
import "../../hooks/index.js";
|
|
8
|
-
import { ErrorView as
|
|
9
|
-
import { DataTable as
|
|
10
|
-
import { FilterTabs as
|
|
10
|
+
import { ErrorView as o, LoadingView as ie, Section as s } from "../../components/StateViews.js";
|
|
11
|
+
import { DataTable as ae } from "../../components/DataTable.js";
|
|
12
|
+
import { FilterTabs as oe } from "../../components/FilterTabs.js";
|
|
11
13
|
import "../../components/index.js";
|
|
12
|
-
import { motion as
|
|
13
|
-
import { useReducedMotion as
|
|
14
|
-
import { IconChip as
|
|
15
|
-
import { Tooltip as
|
|
16
|
-
import { ResponsiveContainer as
|
|
17
|
-
import { ReferenceDot as
|
|
18
|
-
import { CartesianGrid as
|
|
19
|
-
import { Area as
|
|
20
|
-
import { XAxis as
|
|
21
|
-
import { YAxis as
|
|
22
|
-
import { AreaChart as
|
|
23
|
-
import { useMemo as
|
|
24
|
-
import { HeartPulse as
|
|
25
|
-
import { jsx as
|
|
26
|
-
import { Button as
|
|
14
|
+
import { motion as c } from "../../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js";
|
|
15
|
+
import { useReducedMotion as se } from "../../../node_modules/framer-motion/dist/es/utils/reduced-motion/use-reduced-motion.js";
|
|
16
|
+
import { IconChip as l, RECOVERY_META as u } from "../_shared/visuals.js";
|
|
17
|
+
import { Tooltip as ce } from "../../../node_modules/recharts/es6/component/Tooltip.js";
|
|
18
|
+
import { ResponsiveContainer as le } from "../../../node_modules/recharts/es6/component/ResponsiveContainer.js";
|
|
19
|
+
import { ReferenceDot as d } from "../../../node_modules/recharts/es6/cartesian/ReferenceDot.js";
|
|
20
|
+
import { CartesianGrid as ue } from "../../../node_modules/recharts/es6/cartesian/CartesianGrid.js";
|
|
21
|
+
import { Area as de } from "../../../node_modules/recharts/es6/cartesian/Area.js";
|
|
22
|
+
import { XAxis as fe } from "../../../node_modules/recharts/es6/cartesian/XAxis.js";
|
|
23
|
+
import { YAxis as pe } from "../../../node_modules/recharts/es6/cartesian/YAxis.js";
|
|
24
|
+
import { AreaChart as f } from "../../../node_modules/recharts/es6/chart/AreaChart.js";
|
|
25
|
+
import { useMemo as p, useState as m } from "react";
|
|
26
|
+
import { HeartPulse as h, Plus as g } from "lucide-react";
|
|
27
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
28
|
+
import { Button as y, GlassCard as b, Input as x, Label as S, ResponsiveDialog as me, ResponsiveDialogContent as he, ResponsiveDialogDescription as ge, ResponsiveDialogFooter as _e, ResponsiveDialogHeader as ve, ResponsiveDialogTitle as ye, Select as be, SelectContent as xe, SelectItem as Se, SelectTrigger as Ce, SelectValue as we, Spinner as Te, Textarea as Ee } from "@burdenoff/fe-libs/ui";
|
|
27
29
|
//#region src/mybodyshield/pages/recovery/RecoveryPage.tsx
|
|
28
30
|
var C = [
|
|
29
31
|
"SLEEP",
|
|
@@ -54,7 +56,7 @@ function k(e, t) {
|
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
58
|
function A() {
|
|
57
|
-
let D =
|
|
59
|
+
let D = re(), { navigateTo: A } = e(), [j, De] = m("ALL"), [Oe, M] = m(!1), [N, P] = m(O), [F, I] = m(null), ke = a("READINESS"), Ae = a("SLEEP"), je = a("MOOD"), L = a(j === "ALL" ? void 0 : j), R = ne(), z = se(), B = (e, t = !0) => z ? { initial: !1 } : {
|
|
58
60
|
initial: {
|
|
59
61
|
opacity: 0,
|
|
60
62
|
y: 14
|
|
@@ -76,64 +78,64 @@ function A() {
|
|
|
76
78
|
damping: 22
|
|
77
79
|
}
|
|
78
80
|
} } : {}
|
|
79
|
-
},
|
|
81
|
+
}, V = ke.data?.items ?? [], H = Ae.data?.items ?? [], U = je.data?.items ?? [], W = L.data?.items ?? [], G = p(() => [...V].sort((e, t) => new Date(t.loggedAt).getTime() - new Date(e.loggedAt).getTime())[0], [V]), K = p(() => [...U].sort((e, t) => new Date(t.loggedAt).getTime() - new Date(e.loggedAt).getTime())[0], [U]), q = p(() => H.length === 0 ? null : H.reduce((e, t) => e + t.sleepHours, 0) / H.length, [H]), J = j === "SLEEP", Y = j === "ALL" ? D("mybodyshield.pages.recovery.allMetrics", "All metrics") : k(D, j), Me = [{
|
|
80
82
|
value: "ALL",
|
|
81
83
|
label: D("mybodyshield.common.all", "All")
|
|
82
84
|
}, ...C.map((e) => ({
|
|
83
85
|
value: e,
|
|
84
86
|
label: k(D, e)
|
|
85
|
-
}))],
|
|
86
|
-
label:
|
|
87
|
-
value:
|
|
88
|
-
})), [
|
|
89
|
-
|
|
90
|
-
},
|
|
91
|
-
if (
|
|
92
|
-
if (
|
|
93
|
-
|
|
87
|
+
}))], X = p(() => [...W].sort((e, t) => new Date(e.loggedAt).getTime() - new Date(t.loggedAt).getTime()).map((e) => ({
|
|
88
|
+
label: ee(e.loggedAt),
|
|
89
|
+
value: J ? e.sleepHours : e.score
|
|
90
|
+
})), [W, J]), Z = X.length > 0 ? X[X.length - 1] : void 0, Q = (e = "READINESS") => {
|
|
91
|
+
P(O(e)), I(null), M(!0);
|
|
92
|
+
}, $ = N.metric === "SLEEP", Ne = async () => {
|
|
93
|
+
if (I(null), $) {
|
|
94
|
+
if (N.sleepHours.trim() === "") {
|
|
95
|
+
I(D("mybodyshield.pages.recovery.sleepHoursRequired", "Sleep hours is required for sleep entries."));
|
|
94
96
|
return;
|
|
95
97
|
}
|
|
96
|
-
let e = Number(
|
|
98
|
+
let e = Number(N.sleepHours);
|
|
97
99
|
if (!Number.isFinite(e) || e < 0 || e > 24) {
|
|
98
|
-
|
|
100
|
+
I(D("mybodyshield.pages.recovery.sleepHoursRange", "Enter sleep hours between 0 and 24."));
|
|
99
101
|
return;
|
|
100
102
|
}
|
|
101
|
-
} else if (
|
|
102
|
-
|
|
103
|
+
} else if (N.score.trim() === "") {
|
|
104
|
+
I(D("mybodyshield.pages.recovery.scoreRequired", "A score is required."));
|
|
103
105
|
return;
|
|
104
106
|
}
|
|
105
|
-
if (
|
|
106
|
-
let e = Number(
|
|
107
|
+
if (N.score.trim() !== "") {
|
|
108
|
+
let e = Number(N.score);
|
|
107
109
|
if (!Number.isFinite(e) || e < 0 || e > 100) {
|
|
108
|
-
|
|
110
|
+
I(D("mybodyshield.pages.recovery.scoreRange", "Enter a score between 0 and 100."));
|
|
109
111
|
return;
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
114
|
let e = {
|
|
113
|
-
metric:
|
|
114
|
-
score:
|
|
115
|
-
sleepHours:
|
|
116
|
-
notes:
|
|
117
|
-
loggedAt:
|
|
115
|
+
metric: N.metric,
|
|
116
|
+
score: N.score.trim() === "" ? void 0 : Number(N.score),
|
|
117
|
+
sleepHours: N.sleepHours.trim() === "" ? void 0 : Number(N.sleepHours),
|
|
118
|
+
notes: N.notes.trim() || void 0,
|
|
119
|
+
loggedAt: N.loggedAt ? new Date(N.loggedAt).toISOString() : void 0
|
|
118
120
|
};
|
|
119
121
|
try {
|
|
120
|
-
await
|
|
122
|
+
await R.mutateAsync(e), M(!1);
|
|
121
123
|
} catch (e) {
|
|
122
|
-
|
|
124
|
+
I(e instanceof Error ? e.message : D("mybodyshield.pages.recovery.failedToLog", "Failed to log recovery."));
|
|
123
125
|
}
|
|
124
|
-
},
|
|
126
|
+
}, Pe = [
|
|
125
127
|
{
|
|
126
128
|
key: "metric",
|
|
127
129
|
header: D("mybodyshield.pages.recovery.metricColumn", "Metric"),
|
|
128
130
|
sortValue: (e) => k(D, e.metric),
|
|
129
131
|
render: (e) => {
|
|
130
|
-
let t =
|
|
131
|
-
return /* @__PURE__ */
|
|
132
|
+
let t = u[e.metric], n = t.icon;
|
|
133
|
+
return /* @__PURE__ */ v("span", {
|
|
132
134
|
className: "inline-flex items-center gap-2.5",
|
|
133
|
-
children: [/* @__PURE__ */
|
|
134
|
-
icon: /* @__PURE__ */
|
|
135
|
+
children: [/* @__PURE__ */ _(l, {
|
|
136
|
+
icon: /* @__PURE__ */ _(n, { className: "h-4 w-4" }),
|
|
135
137
|
tint: t.tint
|
|
136
|
-
}), /* @__PURE__ */
|
|
138
|
+
}), /* @__PURE__ */ _("span", {
|
|
137
139
|
className: "font-medium text-text-primary",
|
|
138
140
|
children: k(D, e.metric)
|
|
139
141
|
})]
|
|
@@ -145,10 +147,10 @@ function A() {
|
|
|
145
147
|
header: D("mybodyshield.pages.recovery.valueColumn", "Value"),
|
|
146
148
|
align: "right",
|
|
147
149
|
sortValue: (e) => e.metric === "SLEEP" ? e.sleepHours : e.score,
|
|
148
|
-
render: (e) => e.metric === "SLEEP" ? /* @__PURE__ */
|
|
150
|
+
render: (e) => e.metric === "SLEEP" ? /* @__PURE__ */ v("span", {
|
|
149
151
|
className: "tabular-nums text-text-primary",
|
|
150
152
|
children: [r(e.sleepHours, { maximumFractionDigits: 1 }), " h"]
|
|
151
|
-
}) : /* @__PURE__ */
|
|
153
|
+
}) : /* @__PURE__ */ _("span", {
|
|
152
154
|
className: "tabular-nums text-text-primary",
|
|
153
155
|
children: r(e.score)
|
|
154
156
|
})
|
|
@@ -157,10 +159,10 @@ function A() {
|
|
|
157
159
|
key: "notes",
|
|
158
160
|
header: D("mybodyshield.pages.recovery.notesColumn", "Notes"),
|
|
159
161
|
hideOnMobile: !0,
|
|
160
|
-
render: (e) => e.notes && e.notes.trim() ? /* @__PURE__ */
|
|
162
|
+
render: (e) => e.notes && e.notes.trim() ? /* @__PURE__ */ _("span", {
|
|
161
163
|
className: "text-text-secondary",
|
|
162
164
|
children: e.notes
|
|
163
|
-
}) : /* @__PURE__ */
|
|
165
|
+
}) : /* @__PURE__ */ _("span", {
|
|
164
166
|
className: "text-text-tertiary",
|
|
165
167
|
children: "—"
|
|
166
168
|
})
|
|
@@ -170,131 +172,138 @@ function A() {
|
|
|
170
172
|
header: D("mybodyshield.pages.recovery.loggedColumn", "Logged"),
|
|
171
173
|
align: "right",
|
|
172
174
|
sortValue: (e) => new Date(e.loggedAt).getTime(),
|
|
173
|
-
render: (e) => /* @__PURE__ */
|
|
175
|
+
render: (e) => /* @__PURE__ */ _("span", {
|
|
174
176
|
className: "whitespace-nowrap text-text-tertiary",
|
|
175
177
|
children: i(e.loggedAt)
|
|
176
178
|
})
|
|
177
179
|
}
|
|
178
|
-
],
|
|
179
|
-
return /* @__PURE__ */
|
|
180
|
+
], Fe = u.READINESS.icon, Ie = u.SLEEP.icon, Le = u.MOOD.icon;
|
|
181
|
+
return /* @__PURE__ */ v(t, {
|
|
180
182
|
title: D("mybodyshield.pages.recovery.title", "Recovery"),
|
|
181
183
|
description: D("mybodyshield.pages.recovery.description", "Sleep, readiness, soreness, stress & mood."),
|
|
182
|
-
actions: /* @__PURE__ */
|
|
183
|
-
className: "gap-2",
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
actions: /* @__PURE__ */ v("div", {
|
|
185
|
+
className: "flex gap-2",
|
|
186
|
+
children: [/* @__PURE__ */ _(y, {
|
|
187
|
+
variant: "outline",
|
|
188
|
+
onClick: () => A("mindfulness"),
|
|
189
|
+
children: "Mindfulness"
|
|
190
|
+
}), /* @__PURE__ */ v(y, {
|
|
191
|
+
className: "gap-2",
|
|
192
|
+
onClick: () => Q(),
|
|
193
|
+
children: [/* @__PURE__ */ _(g, { className: "h-4 w-4" }), D("mybodyshield.pages.recovery.logRecoveryButton", "Log recovery")]
|
|
194
|
+
})]
|
|
186
195
|
}),
|
|
187
196
|
children: [
|
|
188
|
-
/* @__PURE__ */
|
|
189
|
-
...
|
|
197
|
+
/* @__PURE__ */ v(c.div, {
|
|
198
|
+
...B(0),
|
|
190
199
|
className: "grid grid-cols-1 gap-4 sm:grid-cols-3",
|
|
191
200
|
children: [
|
|
192
|
-
/* @__PURE__ */
|
|
193
|
-
icon: /* @__PURE__ */
|
|
194
|
-
icon: /* @__PURE__ */
|
|
195
|
-
tint:
|
|
201
|
+
/* @__PURE__ */ _(n, {
|
|
202
|
+
icon: /* @__PURE__ */ _(l, {
|
|
203
|
+
icon: /* @__PURE__ */ _(Fe, { className: "h-5 w-5" }),
|
|
204
|
+
tint: u.READINESS.tint
|
|
196
205
|
}),
|
|
197
|
-
value:
|
|
206
|
+
value: G ? r(G.score) : "—",
|
|
198
207
|
label: D("mybodyshield.pages.recovery.latestReadiness", "Latest readiness"),
|
|
199
|
-
accent:
|
|
200
|
-
footer:
|
|
208
|
+
accent: G ? T(G.score) : void 0,
|
|
209
|
+
footer: G ? /* @__PURE__ */ _("p", {
|
|
201
210
|
className: "text-xs text-text-tertiary",
|
|
202
|
-
children: i(
|
|
203
|
-
}) : /* @__PURE__ */
|
|
211
|
+
children: i(G.loggedAt)
|
|
212
|
+
}) : /* @__PURE__ */ _("button", {
|
|
204
213
|
type: "button",
|
|
205
|
-
onClick: () =>
|
|
214
|
+
onClick: () => Q("READINESS"),
|
|
206
215
|
className: "text-xs font-medium text-accent hover:underline",
|
|
207
216
|
children: D("mybodyshield.pages.recovery.logReadiness", "Log readiness →")
|
|
208
217
|
})
|
|
209
218
|
}),
|
|
210
|
-
/* @__PURE__ */
|
|
211
|
-
icon: /* @__PURE__ */
|
|
212
|
-
icon: /* @__PURE__ */
|
|
213
|
-
tint:
|
|
219
|
+
/* @__PURE__ */ _(n, {
|
|
220
|
+
icon: /* @__PURE__ */ _(l, {
|
|
221
|
+
icon: /* @__PURE__ */ _(Ie, { className: "h-5 w-5" }),
|
|
222
|
+
tint: u.SLEEP.tint
|
|
214
223
|
}),
|
|
215
|
-
value:
|
|
224
|
+
value: q == null ? "—" : `${r(q, { maximumFractionDigits: 1 })} h`,
|
|
216
225
|
label: D("mybodyshield.pages.recovery.avgSleep", "Avg sleep"),
|
|
217
|
-
accent:
|
|
218
|
-
footer:
|
|
226
|
+
accent: q == null ? void 0 : E(q),
|
|
227
|
+
footer: H.length > 0 ? /* @__PURE__ */ v("p", {
|
|
219
228
|
className: "text-xs text-text-tertiary",
|
|
220
229
|
children: [
|
|
221
|
-
/* @__PURE__ */
|
|
230
|
+
/* @__PURE__ */ _("span", {
|
|
222
231
|
className: "tabular-nums text-text-secondary",
|
|
223
|
-
children:
|
|
232
|
+
children: H.length
|
|
224
233
|
}),
|
|
225
234
|
" ",
|
|
226
|
-
|
|
235
|
+
H.length === 1 ? D("mybodyshield.pages.recovery.nightsLogged", "{{count}} night logged", { count: H.length }) : D("mybodyshield.pages.recovery.nightsLoggedPlural", "{{count}} nights logged", { count: H.length })
|
|
227
236
|
]
|
|
228
|
-
}) : /* @__PURE__ */
|
|
237
|
+
}) : /* @__PURE__ */ _("button", {
|
|
229
238
|
type: "button",
|
|
230
|
-
onClick: () =>
|
|
239
|
+
onClick: () => Q("SLEEP"),
|
|
231
240
|
className: "text-xs font-medium text-accent hover:underline",
|
|
232
241
|
children: D("mybodyshield.pages.recovery.logSleep", "Log sleep →")
|
|
233
242
|
})
|
|
234
243
|
}),
|
|
235
|
-
/* @__PURE__ */
|
|
236
|
-
icon: /* @__PURE__ */
|
|
237
|
-
icon: /* @__PURE__ */
|
|
238
|
-
tint:
|
|
244
|
+
/* @__PURE__ */ _(n, {
|
|
245
|
+
icon: /* @__PURE__ */ _(l, {
|
|
246
|
+
icon: /* @__PURE__ */ _(Le, { className: "h-5 w-5" }),
|
|
247
|
+
tint: u.MOOD.tint
|
|
239
248
|
}),
|
|
240
|
-
value:
|
|
249
|
+
value: K ? r(K.score) : "—",
|
|
241
250
|
label: D("mybodyshield.pages.recovery.latestMood", "Latest mood"),
|
|
242
|
-
accent:
|
|
243
|
-
footer:
|
|
251
|
+
accent: K ? T(K.score) : void 0,
|
|
252
|
+
footer: K ? /* @__PURE__ */ _("p", {
|
|
244
253
|
className: "text-xs text-text-tertiary",
|
|
245
|
-
children: i(
|
|
246
|
-
}) : /* @__PURE__ */
|
|
254
|
+
children: i(K.loggedAt)
|
|
255
|
+
}) : /* @__PURE__ */ _("button", {
|
|
247
256
|
type: "button",
|
|
248
|
-
onClick: () =>
|
|
257
|
+
onClick: () => Q("MOOD"),
|
|
249
258
|
className: "text-xs font-medium text-accent hover:underline",
|
|
250
259
|
children: D("mybodyshield.pages.recovery.logMood", "Log mood →")
|
|
251
260
|
})
|
|
252
261
|
})
|
|
253
262
|
]
|
|
254
263
|
}),
|
|
255
|
-
/* @__PURE__ */
|
|
264
|
+
/* @__PURE__ */ _("div", {
|
|
256
265
|
className: "mt-6 flex flex-wrap items-center gap-3",
|
|
257
|
-
children: /* @__PURE__ */
|
|
258
|
-
options:
|
|
259
|
-
value:
|
|
260
|
-
onChange:
|
|
266
|
+
children: /* @__PURE__ */ _(oe, {
|
|
267
|
+
options: Me,
|
|
268
|
+
value: j,
|
|
269
|
+
onChange: De
|
|
261
270
|
})
|
|
262
271
|
}),
|
|
263
|
-
/* @__PURE__ */
|
|
264
|
-
title: D("mybodyshield.pages.recovery.trendTitle", "{{metric}} trend", { metric:
|
|
265
|
-
description:
|
|
266
|
-
children: /* @__PURE__ */
|
|
267
|
-
...
|
|
268
|
-
children: /* @__PURE__ */
|
|
272
|
+
/* @__PURE__ */ _(s, {
|
|
273
|
+
title: D("mybodyshield.pages.recovery.trendTitle", "{{metric}} trend", { metric: Y }),
|
|
274
|
+
description: J ? D("mybodyshield.pages.recovery.sleepTrendDescription", "Sleep hours over time.") : D("mybodyshield.pages.recovery.scoreTrendDescription", "Recovery score over time."),
|
|
275
|
+
children: /* @__PURE__ */ _(c.div, {
|
|
276
|
+
...B(.08),
|
|
277
|
+
children: /* @__PURE__ */ _(b, {
|
|
269
278
|
treatment: "glass",
|
|
270
279
|
className: "rounded-2xl p-6 transition-shadow duration-300 hover:shadow-2xl",
|
|
271
|
-
children:
|
|
280
|
+
children: L.isLoading ? /* @__PURE__ */ _("div", {
|
|
272
281
|
className: "flex h-[280px] items-center justify-center",
|
|
273
|
-
children: /* @__PURE__ */
|
|
274
|
-
}) :
|
|
282
|
+
children: /* @__PURE__ */ _(Te, { size: "lg" })
|
|
283
|
+
}) : L.isError ? /* @__PURE__ */ _(o, {
|
|
275
284
|
message: D("mybodyshield.pages.recovery.chartError", "We couldn't load this metric's history."),
|
|
276
|
-
onRetry: () =>
|
|
277
|
-
}) :
|
|
285
|
+
onRetry: () => L.refetch()
|
|
286
|
+
}) : X.length === 0 ? /* @__PURE__ */ v("div", {
|
|
278
287
|
className: "flex h-[280px] flex-col items-center justify-center text-center",
|
|
279
288
|
children: [
|
|
280
|
-
/* @__PURE__ */
|
|
289
|
+
/* @__PURE__ */ _("span", {
|
|
281
290
|
className: "flex size-11 items-center justify-center rounded-full bg-[var(--color-accent-soft)]",
|
|
282
|
-
children: /* @__PURE__ */
|
|
291
|
+
children: /* @__PURE__ */ _(h, { className: "h-5 w-5 text-accent" })
|
|
283
292
|
}),
|
|
284
|
-
/* @__PURE__ */
|
|
293
|
+
/* @__PURE__ */ _("p", {
|
|
285
294
|
className: "mt-3 text-sm font-medium text-text-primary",
|
|
286
295
|
children: D("mybodyshield.pages.recovery.emptyChartTitle", "Nothing to chart yet")
|
|
287
296
|
}),
|
|
288
|
-
/* @__PURE__ */
|
|
297
|
+
/* @__PURE__ */ _("p", {
|
|
289
298
|
className: "mt-1 max-w-xs text-xs text-text-tertiary",
|
|
290
|
-
children: D("mybodyshield.pages.recovery.emptyChartDescription", "Log a few {{metric}} entries to see your trend here.", { metric:
|
|
299
|
+
children: D("mybodyshield.pages.recovery.emptyChartDescription", "Log a few {{metric}} entries to see your trend here.", { metric: Y.toLowerCase() })
|
|
291
300
|
})
|
|
292
301
|
]
|
|
293
|
-
}) : /* @__PURE__ */
|
|
302
|
+
}) : /* @__PURE__ */ _(le, {
|
|
294
303
|
width: "100%",
|
|
295
304
|
height: 280,
|
|
296
|
-
children: /* @__PURE__ */
|
|
297
|
-
data:
|
|
305
|
+
children: /* @__PURE__ */ v(f, {
|
|
306
|
+
data: X,
|
|
298
307
|
margin: {
|
|
299
308
|
top: 12,
|
|
300
309
|
right: 16,
|
|
@@ -302,36 +311,36 @@ function A() {
|
|
|
302
311
|
left: 4
|
|
303
312
|
},
|
|
304
313
|
children: [
|
|
305
|
-
/* @__PURE__ */
|
|
314
|
+
/* @__PURE__ */ _("defs", { children: /* @__PURE__ */ v("linearGradient", {
|
|
306
315
|
id: "myb-recovery-fill",
|
|
307
316
|
x1: "0",
|
|
308
317
|
y1: "0",
|
|
309
318
|
x2: "0",
|
|
310
319
|
y2: "1",
|
|
311
320
|
children: [
|
|
312
|
-
/* @__PURE__ */
|
|
321
|
+
/* @__PURE__ */ _("stop", {
|
|
313
322
|
offset: "0%",
|
|
314
323
|
stopColor: w,
|
|
315
324
|
stopOpacity: .38
|
|
316
325
|
}),
|
|
317
|
-
/* @__PURE__ */
|
|
326
|
+
/* @__PURE__ */ _("stop", {
|
|
318
327
|
offset: "55%",
|
|
319
328
|
stopColor: w,
|
|
320
329
|
stopOpacity: .12
|
|
321
330
|
}),
|
|
322
|
-
/* @__PURE__ */
|
|
331
|
+
/* @__PURE__ */ _("stop", {
|
|
323
332
|
offset: "100%",
|
|
324
333
|
stopColor: w,
|
|
325
334
|
stopOpacity: 0
|
|
326
335
|
})
|
|
327
336
|
]
|
|
328
337
|
}) }),
|
|
329
|
-
/* @__PURE__ */
|
|
338
|
+
/* @__PURE__ */ _(ue, {
|
|
330
339
|
vertical: !1,
|
|
331
340
|
stroke: "var(--color-border-seam)",
|
|
332
341
|
strokeDasharray: "4 4"
|
|
333
342
|
}),
|
|
334
|
-
/* @__PURE__ */
|
|
343
|
+
/* @__PURE__ */ _(fe, {
|
|
335
344
|
dataKey: "label",
|
|
336
345
|
tickLine: !1,
|
|
337
346
|
axisLine: !1,
|
|
@@ -342,7 +351,7 @@ function A() {
|
|
|
342
351
|
fontSize: 12
|
|
343
352
|
}
|
|
344
353
|
}),
|
|
345
|
-
/* @__PURE__ */
|
|
354
|
+
/* @__PURE__ */ _(pe, {
|
|
346
355
|
width: 44,
|
|
347
356
|
tickLine: !1,
|
|
348
357
|
axisLine: !1,
|
|
@@ -351,7 +360,7 @@ function A() {
|
|
|
351
360
|
fontSize: 12
|
|
352
361
|
}
|
|
353
362
|
}),
|
|
354
|
-
/* @__PURE__ */
|
|
363
|
+
/* @__PURE__ */ _(ce, {
|
|
355
364
|
contentStyle: {
|
|
356
365
|
background: "var(--color-bg-surface)",
|
|
357
366
|
border: "1px solid var(--color-border-seam)",
|
|
@@ -365,10 +374,10 @@ function A() {
|
|
|
365
374
|
strokeDasharray: "4 4"
|
|
366
375
|
}
|
|
367
376
|
}),
|
|
368
|
-
/* @__PURE__ */
|
|
377
|
+
/* @__PURE__ */ _(de, {
|
|
369
378
|
type: "monotone",
|
|
370
379
|
dataKey: "value",
|
|
371
|
-
name:
|
|
380
|
+
name: J ? D("mybodyshield.pages.recovery.sleepHours", "Sleep hours") : D("mybodyshield.pages.recovery.score", "Score"),
|
|
372
381
|
stroke: w,
|
|
373
382
|
strokeWidth: 2.5,
|
|
374
383
|
fill: "url(#myb-recovery-fill)",
|
|
@@ -380,12 +389,12 @@ function A() {
|
|
|
380
389
|
stroke: "var(--color-bg-surface)",
|
|
381
390
|
fill: w
|
|
382
391
|
},
|
|
383
|
-
isAnimationActive: !
|
|
392
|
+
isAnimationActive: !z,
|
|
384
393
|
animationDuration: 900
|
|
385
394
|
}),
|
|
386
|
-
|
|
387
|
-
x:
|
|
388
|
-
y:
|
|
395
|
+
Z && /* @__PURE__ */ _(d, {
|
|
396
|
+
x: Z.label,
|
|
397
|
+
y: Z.value,
|
|
389
398
|
r: 12,
|
|
390
399
|
isFront: !0,
|
|
391
400
|
ifOverflow: "visible",
|
|
@@ -393,9 +402,9 @@ function A() {
|
|
|
393
402
|
fillOpacity: .16,
|
|
394
403
|
stroke: "none"
|
|
395
404
|
}),
|
|
396
|
-
|
|
397
|
-
x:
|
|
398
|
-
y:
|
|
405
|
+
Z && /* @__PURE__ */ _(d, {
|
|
406
|
+
x: Z.label,
|
|
407
|
+
y: Z.value,
|
|
399
408
|
r: 5,
|
|
400
409
|
isFront: !0,
|
|
401
410
|
ifOverflow: "visible",
|
|
@@ -409,27 +418,27 @@ function A() {
|
|
|
409
418
|
})
|
|
410
419
|
})
|
|
411
420
|
}),
|
|
412
|
-
/* @__PURE__ */
|
|
413
|
-
...
|
|
414
|
-
children: /* @__PURE__ */
|
|
421
|
+
/* @__PURE__ */ _(c.div, {
|
|
422
|
+
...B(.16, !1),
|
|
423
|
+
children: /* @__PURE__ */ _(s, {
|
|
415
424
|
title: D("mybodyshield.pages.recovery.recoveryLog", "Recovery log"),
|
|
416
425
|
description: D("mybodyshield.pages.recovery.recoveryLogDescription", "Every recovery entry, most recent first."),
|
|
417
|
-
children:
|
|
426
|
+
children: L.isLoading ? /* @__PURE__ */ _(ie, { label: D("mybodyshield.pages.recovery.loading", "Loading recovery logs…") }) : L.isError ? /* @__PURE__ */ _(o, {
|
|
418
427
|
message: D("mybodyshield.pages.recovery.error", "We couldn't load your recovery logs."),
|
|
419
|
-
onRetry: () =>
|
|
420
|
-
}) :
|
|
428
|
+
onRetry: () => L.refetch()
|
|
429
|
+
}) : W.length === 0 ? /* @__PURE__ */ _(te, {
|
|
421
430
|
illustration: "empty-data",
|
|
422
|
-
icon: /* @__PURE__ */
|
|
431
|
+
icon: /* @__PURE__ */ _(h, { className: "h-10 w-10" }),
|
|
423
432
|
title: D("mybodyshield.pages.recovery.emptyTitle", "No recovery logs yet"),
|
|
424
433
|
description: D("mybodyshield.pages.recovery.emptyDescription", "Track your sleep, readiness, soreness, stress or mood to see how your body is recovering between sessions."),
|
|
425
|
-
action: /* @__PURE__ */ y
|
|
434
|
+
action: /* @__PURE__ */ v(y, {
|
|
426
435
|
className: "gap-2",
|
|
427
|
-
onClick: () =>
|
|
428
|
-
children: [/* @__PURE__ */
|
|
436
|
+
onClick: () => Q(),
|
|
437
|
+
children: [/* @__PURE__ */ _(g, { className: "h-4 w-4" }), D("mybodyshield.pages.recovery.logRecoveryButton", "Log recovery")]
|
|
429
438
|
})
|
|
430
|
-
}) : /* @__PURE__ */
|
|
431
|
-
columns:
|
|
432
|
-
rows:
|
|
439
|
+
}) : /* @__PURE__ */ _(ae, {
|
|
440
|
+
columns: Pe,
|
|
441
|
+
rows: W,
|
|
433
442
|
rowKey: (e) => e.id,
|
|
434
443
|
defaultSort: {
|
|
435
444
|
key: "loggedAt",
|
|
@@ -438,134 +447,134 @@ function A() {
|
|
|
438
447
|
})
|
|
439
448
|
})
|
|
440
449
|
}),
|
|
441
|
-
/* @__PURE__ */
|
|
442
|
-
open:
|
|
443
|
-
onOpenChange:
|
|
444
|
-
children: /* @__PURE__ */
|
|
450
|
+
/* @__PURE__ */ _(me, {
|
|
451
|
+
open: Oe,
|
|
452
|
+
onOpenChange: M,
|
|
453
|
+
children: /* @__PURE__ */ v(he, {
|
|
445
454
|
className: "sm:max-w-[480px]",
|
|
446
455
|
children: [
|
|
447
|
-
/* @__PURE__ */
|
|
448
|
-
/* @__PURE__ */
|
|
456
|
+
/* @__PURE__ */ v(ve, { children: [/* @__PURE__ */ _(ye, { children: D("mybodyshield.pages.recovery.dialogTitle", "Log recovery") }), /* @__PURE__ */ _(ge, { children: D("mybodyshield.pages.recovery.dialogDescription", "Capture how your body is recovering — one metric per entry.") })] }),
|
|
457
|
+
/* @__PURE__ */ v("div", {
|
|
449
458
|
className: "space-y-4 py-2",
|
|
450
459
|
children: [
|
|
451
|
-
/* @__PURE__ */
|
|
460
|
+
/* @__PURE__ */ v("div", {
|
|
452
461
|
className: "space-y-1.5",
|
|
453
|
-
children: [/* @__PURE__ */
|
|
462
|
+
children: [/* @__PURE__ */ _(S, {
|
|
454
463
|
htmlFor: "myb-recovery-metric",
|
|
455
464
|
children: D("mybodyshield.pages.recovery.metric", "Metric")
|
|
456
|
-
}), /* @__PURE__ */
|
|
457
|
-
value:
|
|
458
|
-
onValueChange: (e) =>
|
|
465
|
+
}), /* @__PURE__ */ v(be, {
|
|
466
|
+
value: N.metric,
|
|
467
|
+
onValueChange: (e) => P((t) => ({
|
|
459
468
|
...t,
|
|
460
469
|
metric: e
|
|
461
470
|
})),
|
|
462
|
-
children: [/* @__PURE__ */
|
|
471
|
+
children: [/* @__PURE__ */ _(Ce, {
|
|
463
472
|
id: "myb-recovery-metric",
|
|
464
|
-
children: /* @__PURE__ */
|
|
465
|
-
}), /* @__PURE__ */
|
|
473
|
+
children: /* @__PURE__ */ _(we, {})
|
|
474
|
+
}), /* @__PURE__ */ _(xe, { children: C.map((e) => /* @__PURE__ */ _(Se, {
|
|
466
475
|
value: e,
|
|
467
476
|
children: k(D, e)
|
|
468
477
|
}, e)) })]
|
|
469
478
|
})]
|
|
470
479
|
}),
|
|
471
|
-
|
|
480
|
+
$ && /* @__PURE__ */ v("div", {
|
|
472
481
|
className: "space-y-1.5",
|
|
473
482
|
children: [
|
|
474
|
-
/* @__PURE__ */
|
|
483
|
+
/* @__PURE__ */ _(S, {
|
|
475
484
|
htmlFor: "myb-recovery-sleep",
|
|
476
485
|
children: D("mybodyshield.pages.recovery.sleepHours", "Sleep hours")
|
|
477
486
|
}),
|
|
478
|
-
/* @__PURE__ */
|
|
487
|
+
/* @__PURE__ */ _(x, {
|
|
479
488
|
id: "myb-recovery-sleep",
|
|
480
489
|
type: "number",
|
|
481
490
|
min: "0",
|
|
482
491
|
max: "24",
|
|
483
492
|
step: "0.1",
|
|
484
|
-
value:
|
|
485
|
-
onChange: (e) =>
|
|
493
|
+
value: N.sleepHours,
|
|
494
|
+
onChange: (e) => P((t) => ({
|
|
486
495
|
...t,
|
|
487
496
|
sleepHours: e.target.value
|
|
488
497
|
})),
|
|
489
498
|
placeholder: D("mybodyshield.pages.recovery.sleepHoursPlaceholder", "e.g. 7.5")
|
|
490
499
|
}),
|
|
491
|
-
/* @__PURE__ */
|
|
500
|
+
/* @__PURE__ */ _("p", {
|
|
492
501
|
className: "text-xs text-text-tertiary",
|
|
493
502
|
children: D("mybodyshield.pages.recovery.sleepHoursHint", "Primary measure for sleep entries.")
|
|
494
503
|
})
|
|
495
504
|
]
|
|
496
505
|
}),
|
|
497
|
-
/* @__PURE__ */
|
|
506
|
+
/* @__PURE__ */ v("div", {
|
|
498
507
|
className: "space-y-1.5",
|
|
499
508
|
children: [
|
|
500
|
-
/* @__PURE__ */
|
|
509
|
+
/* @__PURE__ */ _(S, {
|
|
501
510
|
htmlFor: "myb-recovery-score",
|
|
502
|
-
children:
|
|
511
|
+
children: $ ? D("mybodyshield.pages.recovery.scoreOptional", "Score (optional)") : D("mybodyshield.pages.recovery.score", "Score")
|
|
503
512
|
}),
|
|
504
|
-
/* @__PURE__ */
|
|
513
|
+
/* @__PURE__ */ _(x, {
|
|
505
514
|
id: "myb-recovery-score",
|
|
506
515
|
type: "number",
|
|
507
516
|
min: "0",
|
|
508
517
|
max: "100",
|
|
509
518
|
step: "1",
|
|
510
|
-
value:
|
|
511
|
-
onChange: (e) =>
|
|
519
|
+
value: N.score,
|
|
520
|
+
onChange: (e) => P((t) => ({
|
|
512
521
|
...t,
|
|
513
522
|
score: e.target.value
|
|
514
523
|
})),
|
|
515
524
|
placeholder: D("mybodyshield.pages.recovery.scorePlaceholder", "0–100")
|
|
516
525
|
}),
|
|
517
|
-
/* @__PURE__ */
|
|
526
|
+
/* @__PURE__ */ _("p", {
|
|
518
527
|
className: "text-xs text-text-tertiary",
|
|
519
|
-
children:
|
|
528
|
+
children: $ ? D("mybodyshield.pages.recovery.sleepScoreHint", "Optional 0–100 sleep-quality score.") : D("mybodyshield.pages.recovery.scoreHint", "A 0–100 rating for this metric.")
|
|
520
529
|
})
|
|
521
530
|
]
|
|
522
531
|
}),
|
|
523
|
-
/* @__PURE__ */
|
|
532
|
+
/* @__PURE__ */ v("div", {
|
|
524
533
|
className: "space-y-1.5",
|
|
525
|
-
children: [/* @__PURE__ */
|
|
534
|
+
children: [/* @__PURE__ */ _(S, {
|
|
526
535
|
htmlFor: "myb-recovery-at",
|
|
527
536
|
children: D("mybodyshield.pages.recovery.loggedAt", "Logged at")
|
|
528
|
-
}), /* @__PURE__ */
|
|
537
|
+
}), /* @__PURE__ */ _(x, {
|
|
529
538
|
id: "myb-recovery-at",
|
|
530
539
|
type: "datetime-local",
|
|
531
|
-
value:
|
|
532
|
-
onChange: (e) =>
|
|
540
|
+
value: N.loggedAt,
|
|
541
|
+
onChange: (e) => P((t) => ({
|
|
533
542
|
...t,
|
|
534
543
|
loggedAt: e.target.value
|
|
535
544
|
}))
|
|
536
545
|
})]
|
|
537
546
|
}),
|
|
538
|
-
/* @__PURE__ */
|
|
547
|
+
/* @__PURE__ */ v("div", {
|
|
539
548
|
className: "space-y-1.5",
|
|
540
|
-
children: [/* @__PURE__ */
|
|
549
|
+
children: [/* @__PURE__ */ _(S, {
|
|
541
550
|
htmlFor: "myb-recovery-notes",
|
|
542
551
|
children: D("mybodyshield.common.notes", "Notes")
|
|
543
|
-
}), /* @__PURE__ */
|
|
552
|
+
}), /* @__PURE__ */ _(Ee, {
|
|
544
553
|
id: "myb-recovery-notes",
|
|
545
554
|
rows: 3,
|
|
546
|
-
value:
|
|
547
|
-
onChange: (e) =>
|
|
555
|
+
value: N.notes,
|
|
556
|
+
onChange: (e) => P((t) => ({
|
|
548
557
|
...t,
|
|
549
558
|
notes: e.target.value
|
|
550
559
|
})),
|
|
551
560
|
placeholder: D("mybodyshield.pages.recovery.notesPlaceholder", "How are you feeling? (optional)")
|
|
552
561
|
})]
|
|
553
562
|
}),
|
|
554
|
-
|
|
563
|
+
F && /* @__PURE__ */ _("p", {
|
|
555
564
|
className: "text-sm text-status-error-text",
|
|
556
|
-
children:
|
|
565
|
+
children: F
|
|
557
566
|
})
|
|
558
567
|
]
|
|
559
568
|
}),
|
|
560
|
-
/* @__PURE__ */
|
|
569
|
+
/* @__PURE__ */ v(_e, { children: [/* @__PURE__ */ _(y, {
|
|
561
570
|
variant: "outline",
|
|
562
|
-
onClick: () =>
|
|
563
|
-
disabled:
|
|
571
|
+
onClick: () => M(!1),
|
|
572
|
+
disabled: R.isPending,
|
|
564
573
|
children: D("mybodyshield.common.cancel", "Cancel")
|
|
565
|
-
}), /* @__PURE__ */
|
|
566
|
-
onClick:
|
|
567
|
-
disabled:
|
|
568
|
-
children:
|
|
574
|
+
}), /* @__PURE__ */ _(y, {
|
|
575
|
+
onClick: Ne,
|
|
576
|
+
disabled: R.isPending,
|
|
577
|
+
children: R.isPending ? D("mybodyshield.common.saving", "Saving…") : D("mybodyshield.pages.recovery.logRecoveryButton", "Log recovery")
|
|
569
578
|
})] })
|
|
570
579
|
]
|
|
571
580
|
})
|