@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.
Files changed (90) hide show
  1. package/dist/mybodyshield/MyBodyShieldRoot.d.ts.map +1 -1
  2. package/dist/mybodyshield/MyBodyShieldRoot.js +54 -56
  3. package/dist/mybodyshield/MyBodyShieldRoot.js.map +1 -1
  4. package/dist/mybodyshield/MyBodyShieldRoutes.d.ts.map +1 -1
  5. package/dist/mybodyshield/MyBodyShieldRoutes.js +121 -62
  6. package/dist/mybodyshield/MyBodyShieldRoutes.js.map +1 -1
  7. package/dist/mybodyshield/components/EvidenceUpload.d.ts.map +1 -1
  8. package/dist/mybodyshield/components/EvidenceUpload.js +46 -45
  9. package/dist/mybodyshield/components/EvidenceUpload.js.map +1 -1
  10. package/dist/mybodyshield/components/FileLink.d.ts.map +1 -1
  11. package/dist/mybodyshield/components/FileLink.js +27 -18
  12. package/dist/mybodyshield/components/FileLink.js.map +1 -1
  13. package/dist/mybodyshield/components/MybDiscussion.d.ts +1 -1
  14. package/dist/mybodyshield/components/MybDiscussion.d.ts.map +1 -1
  15. package/dist/mybodyshield/components/MybDiscussion.js +59 -58
  16. package/dist/mybodyshield/components/MybDiscussion.js.map +1 -1
  17. package/dist/mybodyshield/components/MybTags.d.ts +1 -1
  18. package/dist/mybodyshield/components/MybTags.d.ts.map +1 -1
  19. package/dist/mybodyshield/components/MybTags.js +83 -74
  20. package/dist/mybodyshield/components/MybTags.js.map +1 -1
  21. package/dist/mybodyshield/components/PageDisabled.d.ts.map +1 -1
  22. package/dist/mybodyshield/components/PageDisabled.js +16 -11
  23. package/dist/mybodyshield/components/PageDisabled.js.map +1 -1
  24. package/dist/mybodyshield/components/Pagination.d.ts.map +1 -1
  25. package/dist/mybodyshield/components/Pagination.js +36 -27
  26. package/dist/mybodyshield/components/Pagination.js.map +1 -1
  27. package/dist/mybodyshield/components/StateViews.d.ts.map +1 -1
  28. package/dist/mybodyshield/components/StateViews.js +42 -34
  29. package/dist/mybodyshield/components/StateViews.js.map +1 -1
  30. package/dist/mybodyshield/components/UserSearchSelect.d.ts.map +1 -1
  31. package/dist/mybodyshield/components/UserSearchSelect.js +66 -68
  32. package/dist/mybodyshield/components/UserSearchSelect.js.map +1 -1
  33. package/dist/mybodyshield/hooks/index.d.ts +1 -0
  34. package/dist/mybodyshield/hooks/index.d.ts.map +1 -1
  35. package/dist/mybodyshield/hooks/index.js +1 -0
  36. package/dist/mybodyshield/hooks/useTr.d.ts +5 -0
  37. package/dist/mybodyshield/hooks/useTr.d.ts.map +1 -0
  38. package/dist/mybodyshield/hooks/useTr.js +12 -0
  39. package/dist/mybodyshield/hooks/useTr.js.map +1 -0
  40. package/dist/mybodyshield/pages/DashboardPage.d.ts.map +1 -1
  41. package/dist/mybodyshield/pages/DashboardPage.js +157 -136
  42. package/dist/mybodyshield/pages/DashboardPage.js.map +1 -1
  43. package/dist/mybodyshield/pages/SettingsPage.d.ts.map +1 -1
  44. package/dist/mybodyshield/pages/SettingsPage.js +50 -59
  45. package/dist/mybodyshield/pages/SettingsPage.js.map +1 -1
  46. package/dist/mybodyshield/pages/_shared/visuals.d.ts +2 -1
  47. package/dist/mybodyshield/pages/_shared/visuals.d.ts.map +1 -1
  48. package/dist/mybodyshield/pages/_shared/visuals.js +91 -81
  49. package/dist/mybodyshield/pages/_shared/visuals.js.map +1 -1
  50. package/dist/mybodyshield/pages/ai/AiControlsPage.d.ts.map +1 -1
  51. package/dist/mybodyshield/pages/ai/AiControlsPage.js +279 -231
  52. package/dist/mybodyshield/pages/ai/AiControlsPage.js.map +1 -1
  53. package/dist/mybodyshield/pages/coaching/CoachingPage.d.ts.map +1 -1
  54. package/dist/mybodyshield/pages/coaching/CoachingPage.js +349 -258
  55. package/dist/mybodyshield/pages/coaching/CoachingPage.js.map +1 -1
  56. package/dist/mybodyshield/pages/goals/GoalsPage.d.ts.map +1 -1
  57. package/dist/mybodyshield/pages/goals/GoalsPage.js +247 -251
  58. package/dist/mybodyshield/pages/goals/GoalsPage.js.map +1 -1
  59. package/dist/mybodyshield/pages/insights/InsightsCharts.d.ts.map +1 -1
  60. package/dist/mybodyshield/pages/insights/InsightsCharts.js +216 -213
  61. package/dist/mybodyshield/pages/insights/InsightsCharts.js.map +1 -1
  62. package/dist/mybodyshield/pages/insights/InsightsPage.d.ts.map +1 -1
  63. package/dist/mybodyshield/pages/insights/InsightsPage.js +327 -220
  64. package/dist/mybodyshield/pages/insights/InsightsPage.js.map +1 -1
  65. package/dist/mybodyshield/pages/nutrition/NutritionPage.d.ts.map +1 -1
  66. package/dist/mybodyshield/pages/nutrition/NutritionPage.js +575 -529
  67. package/dist/mybodyshield/pages/nutrition/NutritionPage.js.map +1 -1
  68. package/dist/mybodyshield/pages/programs/ProgramDetailPage.d.ts.map +1 -1
  69. package/dist/mybodyshield/pages/programs/ProgramDetailPage.js +333 -275
  70. package/dist/mybodyshield/pages/programs/ProgramDetailPage.js.map +1 -1
  71. package/dist/mybodyshield/pages/programs/ProgramsPage.d.ts.map +1 -1
  72. package/dist/mybodyshield/pages/programs/ProgramsPage.js +258 -253
  73. package/dist/mybodyshield/pages/programs/ProgramsPage.js.map +1 -1
  74. package/dist/mybodyshield/pages/progress/ProgressPage.d.ts.map +1 -1
  75. package/dist/mybodyshield/pages/progress/ProgressPage.js +271 -254
  76. package/dist/mybodyshield/pages/progress/ProgressPage.js.map +1 -1
  77. package/dist/mybodyshield/pages/recovery/RecoveryPage.d.ts.map +1 -1
  78. package/dist/mybodyshield/pages/recovery/RecoveryPage.js +206 -200
  79. package/dist/mybodyshield/pages/recovery/RecoveryPage.js.map +1 -1
  80. package/dist/mybodyshield/pages/train/SessionDetailPage.d.ts.map +1 -1
  81. package/dist/mybodyshield/pages/train/SessionDetailPage.js +327 -294
  82. package/dist/mybodyshield/pages/train/SessionDetailPage.js.map +1 -1
  83. package/dist/mybodyshield/pages/train/SessionsPage.d.ts.map +1 -1
  84. package/dist/mybodyshield/pages/train/SessionsPage.js +180 -163
  85. package/dist/mybodyshield/pages/train/SessionsPage.js.map +1 -1
  86. package/dist/mybodyshield/utils/i18n.d.ts +1 -2
  87. package/dist/mybodyshield/utils/i18n.d.ts.map +1 -1
  88. package/dist/mybodyshield/utils/i18n.js +15 -0
  89. package/dist/mybodyshield/utils/i18n.js.map +1 -0
  90. package/package.json +1 -1
@@ -3,36 +3,41 @@ import { MetricsCard as t } from "../../components/MetricsCard.js";
3
3
  import { formatDate as n, formatEnumLabel as r, formatNumber as i, formatPercent as a, formatRelativeTime as o } from "../../utils/formatters.js";
4
4
  import { StatusBadge as s } from "../../components/StatusBadge.js";
5
5
  import { EmptyState as c } from "../../components/EmptyState.js";
6
- import { ErrorView as l, LoadingView as u } from "../../components/StateViews.js";
7
- import { FilterTabs as d } from "../../components/FilterTabs.js";
8
- import { Pagination as f } from "../../components/Pagination.js";
9
- import { MiniBar as p } from "../../components/MiniBar.js";
10
- import { useMybAchieveGoal as m, useMybCreateGoal as h, useMybGoals as g, useMybUpdateGoal as _ } from "../../hooks/useMyBodyShieldApi.js";
11
- import { useOffsetPager as v } from "../../hooks/usePager.js";
6
+ import { useMybAchieveGoal as l, useMybCreateGoal as u, useMybGoals as d, useMybUpdateGoal as f } from "../../hooks/useMyBodyShieldApi.js";
7
+ import { useOffsetPager as p } from "../../hooks/usePager.js";
8
+ import { useTr as m } from "../../hooks/useTr.js";
12
9
  import "../../hooks/index.js";
10
+ import { ErrorView as h, LoadingView as g } from "../../components/StateViews.js";
11
+ import { FilterTabs as _ } from "../../components/FilterTabs.js";
12
+ import { Pagination as ee } from "../../components/Pagination.js";
13
+ import { MiniBar as v } from "../../components/MiniBar.js";
13
14
  import "../../components/index.js";
14
15
  import { motion as y } from "../../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js";
15
16
  import { useReducedMotion as b } from "../../../node_modules/framer-motion/dist/es/utils/reduced-motion/use-reduced-motion.js";
16
17
  import { GOAL_TYPE_META as x, IconChip as S, Meter as C, computeGoalProgress as w } from "../_shared/visuals.js";
17
- import { useMemo as ee, useState as T } from "react";
18
- import { CalendarClock as E, CheckCircle2 as D, Plus as O, Target as k, TrendingUp as A, Trophy as te } from "lucide-react";
19
- import { Fragment as ne, jsx as j, jsxs as M } from "react/jsx-runtime";
20
- import { Button as N, GlassCard as P, Input as F, Label as I, ResponsiveDialog as L, ResponsiveDialogContent as R, ResponsiveDialogDescription as z, ResponsiveDialogFooter as B, ResponsiveDialogHeader as V, ResponsiveDialogTitle as H, Select as U, SelectContent as W, SelectItem as G, SelectTrigger as K, SelectValue as q, Textarea as J } from "@burdenoff/fe-libs/ui";
18
+ import { useMemo as te, useState as T } from "react";
19
+ import { CalendarClock as E, CheckCircle2 as D, Plus as O, Target as k, TrendingUp as ne, Trophy as A } from "lucide-react";
20
+ import { Fragment as j, jsx as M, jsxs as N } from "react/jsx-runtime";
21
+ import { Button as P, GlassCard as F, Input as I, Label as L, ResponsiveDialog as R, ResponsiveDialogContent as z, ResponsiveDialogDescription as B, ResponsiveDialogFooter as V, ResponsiveDialogHeader as H, ResponsiveDialogTitle as U, Select as W, SelectContent as G, SelectItem as K, SelectTrigger as q, SelectValue as J, Textarea as re } from "@burdenoff/fe-libs/ui";
21
22
  //#region src/mybodyshield/pages/goals/GoalsPage.tsx
22
- var Y = 12, X = 100, re = [
23
- {
24
- value: "ALL",
25
- label: "All"
26
- },
27
- {
28
- value: "ACTIVE",
29
- label: "Active"
30
- },
31
- {
32
- value: "ACHIEVED",
33
- label: "Achieved"
34
- }
35
- ], ie = [
23
+ var Y = 12, X = 100;
24
+ function ie(e) {
25
+ return [
26
+ {
27
+ value: "ALL",
28
+ label: e("mybodyshield.common.all", "All")
29
+ },
30
+ {
31
+ value: "ACTIVE",
32
+ label: e("mybodyshield.common.active", "Active")
33
+ },
34
+ {
35
+ value: "ACHIEVED",
36
+ label: e("mybodyshield.pages.goals.achieved", "Achieved")
37
+ }
38
+ ];
39
+ }
40
+ var ae = [
36
41
  "WEIGHT_LOSS",
37
42
  "MUSCLE_GAIN",
38
43
  "STRENGTH",
@@ -55,261 +60,257 @@ var Q = {
55
60
  targetDate: "",
56
61
  description: ""
57
62
  };
58
- function ae({ open: e, onOpenChange: t }) {
59
- let n = h(), [i, a] = T(Q), [o, s] = T(null), c = (e) => {
60
- e || (a(Q), s(null)), t(e);
61
- }, l = async () => {
62
- let e = i.title.trim();
63
+ function oe({ open: e, onOpenChange: t }) {
64
+ let n = m(), i = u(), [a, o] = T(Q), [s, c] = T(null), l = (e) => {
65
+ e || (o(Q), c(null)), t(e);
66
+ }, d = async () => {
67
+ let e = a.title.trim();
63
68
  if (!e) {
64
- s("Goal title is required.");
69
+ c(n("mybodyshield.pages.goals.goalTitleRequired", "Goal title is required."));
65
70
  return;
66
71
  }
67
- s(null);
72
+ c(null);
68
73
  let r = {
69
74
  title: e,
70
- type: i.type,
71
- description: i.description.trim() || void 0,
72
- baselineValue: Z(i.baselineValue),
73
- targetValue: Z(i.targetValue),
74
- unit: i.unit.trim() || void 0,
75
- targetDate: i.targetDate ? new Date(i.targetDate).toISOString() : void 0
75
+ type: a.type,
76
+ description: a.description.trim() || void 0,
77
+ baselineValue: Z(a.baselineValue),
78
+ targetValue: Z(a.targetValue),
79
+ unit: a.unit.trim() || void 0,
80
+ targetDate: a.targetDate ? new Date(a.targetDate).toISOString() : void 0
76
81
  };
77
82
  try {
78
- await n.mutateAsync(r), a(Q), t(!1);
83
+ await i.mutateAsync(r), o(Q), t(!1);
79
84
  } catch (e) {
80
- s(e instanceof Error ? e.message : "Failed to create goal.");
85
+ c(e instanceof Error ? e.message : n("mybodyshield.pages.goals.failedToCreate", "Failed to create goal."));
81
86
  }
82
87
  };
83
- return /* @__PURE__ */ j(L, {
88
+ return /* @__PURE__ */ M(R, {
84
89
  open: e,
85
- onOpenChange: c,
86
- children: /* @__PURE__ */ M(R, { children: [/* @__PURE__ */ M(V, { children: [/* @__PURE__ */ j(H, { children: "New goal" }), /* @__PURE__ */ j(z, { children: "Set a target across training, nutrition or body composition and track it to completion." })] }), /* @__PURE__ */ M("form", {
90
+ onOpenChange: l,
91
+ children: /* @__PURE__ */ N(z, { children: [/* @__PURE__ */ N(H, { children: [/* @__PURE__ */ M(U, { children: n("mybodyshield.pages.goals.dialogTitle", "New goal") }), /* @__PURE__ */ M(B, { children: n("mybodyshield.pages.goals.dialogDescription", "Set a target across training, nutrition or body composition and track it to completion.") })] }), /* @__PURE__ */ N("form", {
87
92
  className: "space-y-4",
88
93
  onSubmit: (e) => {
89
- e.preventDefault(), l();
94
+ e.preventDefault(), d();
90
95
  },
91
96
  children: [
92
- o && /* @__PURE__ */ j("p", {
97
+ s && /* @__PURE__ */ M("p", {
93
98
  className: "rounded-lg bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
94
- children: o
99
+ children: s
95
100
  }),
96
- /* @__PURE__ */ M("div", {
101
+ /* @__PURE__ */ N("div", {
97
102
  className: "space-y-2",
98
- children: [/* @__PURE__ */ j(I, {
103
+ children: [/* @__PURE__ */ M(L, {
99
104
  htmlFor: "myb-goal-title",
100
- children: "Title"
101
- }), /* @__PURE__ */ j(F, {
105
+ children: n("mybodyshield.pages.goals.titleLabel", "Title")
106
+ }), /* @__PURE__ */ M(I, {
102
107
  id: "myb-goal-title",
103
- value: i.title,
104
- onChange: (e) => a((t) => ({
108
+ value: a.title,
109
+ onChange: (e) => o((t) => ({
105
110
  ...t,
106
111
  title: e.target.value
107
112
  })),
108
- placeholder: "e.g., Squat 140 kg"
113
+ placeholder: n("mybodyshield.pages.goals.titlePlaceholder", "e.g., Squat 140 kg")
109
114
  })]
110
115
  }),
111
- /* @__PURE__ */ M("div", {
116
+ /* @__PURE__ */ N("div", {
112
117
  className: "space-y-2",
113
- children: [/* @__PURE__ */ j(I, {
118
+ children: [/* @__PURE__ */ M(L, {
114
119
  htmlFor: "myb-goal-type",
115
- children: "Type"
116
- }), /* @__PURE__ */ M(U, {
117
- value: i.type,
118
- onValueChange: (e) => a((t) => ({
120
+ children: n("mybodyshield.pages.goals.goalType", "Type")
121
+ }), /* @__PURE__ */ N(W, {
122
+ value: a.type,
123
+ onValueChange: (e) => o((t) => ({
119
124
  ...t,
120
125
  type: e
121
126
  })),
122
- children: [/* @__PURE__ */ j(K, {
127
+ children: [/* @__PURE__ */ M(q, {
123
128
  id: "myb-goal-type",
124
- children: /* @__PURE__ */ j(q, { placeholder: "Select a goal type" })
125
- }), /* @__PURE__ */ j(W, { children: ie.map((e) => /* @__PURE__ */ j(G, {
129
+ children: /* @__PURE__ */ M(J, { placeholder: n("mybodyshield.pages.goals.goalTypePlaceholder", "Select a goal type") })
130
+ }), /* @__PURE__ */ M(G, { children: ae.map((e) => /* @__PURE__ */ M(K, {
126
131
  value: e,
127
132
  children: r(e)
128
133
  }, e)) })]
129
134
  })]
130
135
  }),
131
- /* @__PURE__ */ M("div", {
136
+ /* @__PURE__ */ N("div", {
132
137
  className: "grid grid-cols-1 gap-4 sm:grid-cols-3",
133
138
  children: [
134
- /* @__PURE__ */ M("div", {
139
+ /* @__PURE__ */ N("div", {
135
140
  className: "space-y-2",
136
- children: [/* @__PURE__ */ j(I, {
141
+ children: [/* @__PURE__ */ M(L, {
137
142
  htmlFor: "myb-goal-baseline",
138
- children: "Baseline"
139
- }), /* @__PURE__ */ j(F, {
143
+ children: n("mybodyshield.pages.goals.baseline", "Baseline")
144
+ }), /* @__PURE__ */ M(I, {
140
145
  id: "myb-goal-baseline",
141
146
  type: "number",
142
147
  inputMode: "decimal",
143
- value: i.baselineValue,
144
- onChange: (e) => a((t) => ({
148
+ value: a.baselineValue,
149
+ onChange: (e) => o((t) => ({
145
150
  ...t,
146
151
  baselineValue: e.target.value
147
152
  })),
148
153
  placeholder: "0"
149
154
  })]
150
155
  }),
151
- /* @__PURE__ */ M("div", {
156
+ /* @__PURE__ */ N("div", {
152
157
  className: "space-y-2",
153
- children: [/* @__PURE__ */ j(I, {
158
+ children: [/* @__PURE__ */ M(L, {
154
159
  htmlFor: "myb-goal-target",
155
- children: "Target"
156
- }), /* @__PURE__ */ j(F, {
160
+ children: n("mybodyshield.pages.goals.target", "Target")
161
+ }), /* @__PURE__ */ M(I, {
157
162
  id: "myb-goal-target",
158
163
  type: "number",
159
164
  inputMode: "decimal",
160
- value: i.targetValue,
161
- onChange: (e) => a((t) => ({
165
+ value: a.targetValue,
166
+ onChange: (e) => o((t) => ({
162
167
  ...t,
163
168
  targetValue: e.target.value
164
169
  })),
165
170
  placeholder: "100"
166
171
  })]
167
172
  }),
168
- /* @__PURE__ */ M("div", {
173
+ /* @__PURE__ */ N("div", {
169
174
  className: "space-y-2",
170
- children: [/* @__PURE__ */ j(I, {
175
+ children: [/* @__PURE__ */ M(L, {
171
176
  htmlFor: "myb-goal-unit",
172
- children: "Unit"
173
- }), /* @__PURE__ */ j(F, {
177
+ children: n("mybodyshield.common.unit", "Unit")
178
+ }), /* @__PURE__ */ M(I, {
174
179
  id: "myb-goal-unit",
175
- value: i.unit,
176
- onChange: (e) => a((t) => ({
180
+ value: a.unit,
181
+ onChange: (e) => o((t) => ({
177
182
  ...t,
178
183
  unit: e.target.value
179
184
  })),
180
- placeholder: "kg / reps / min"
185
+ placeholder: n("mybodyshield.pages.goals.unitPlaceholder", "kg / reps / min")
181
186
  })]
182
187
  })
183
188
  ]
184
189
  }),
185
- /* @__PURE__ */ M("div", {
190
+ /* @__PURE__ */ N("div", {
186
191
  className: "space-y-2",
187
- children: [/* @__PURE__ */ j(I, {
192
+ children: [/* @__PURE__ */ M(L, {
188
193
  htmlFor: "myb-goal-date",
189
- children: "Target date"
190
- }), /* @__PURE__ */ j(F, {
194
+ children: n("mybodyshield.pages.goals.targetDate", "Target date")
195
+ }), /* @__PURE__ */ M(I, {
191
196
  id: "myb-goal-date",
192
197
  type: "date",
193
- value: i.targetDate,
194
- onChange: (e) => a((t) => ({
198
+ value: a.targetDate,
199
+ onChange: (e) => o((t) => ({
195
200
  ...t,
196
201
  targetDate: e.target.value
197
202
  }))
198
203
  })]
199
204
  }),
200
- /* @__PURE__ */ M("div", {
205
+ /* @__PURE__ */ N("div", {
201
206
  className: "space-y-2",
202
- children: [/* @__PURE__ */ j(I, {
207
+ children: [/* @__PURE__ */ M(L, {
203
208
  htmlFor: "myb-goal-desc",
204
- children: "Description"
205
- }), /* @__PURE__ */ j(J, {
209
+ children: n("mybodyshield.common.description", "Description")
210
+ }), /* @__PURE__ */ M(re, {
206
211
  id: "myb-goal-desc",
207
212
  rows: 3,
208
- value: i.description,
209
- onChange: (e) => a((t) => ({
213
+ value: a.description,
214
+ onChange: (e) => o((t) => ({
210
215
  ...t,
211
216
  description: e.target.value
212
217
  })),
213
- placeholder: "Why this goal matters and how you'll get there."
218
+ placeholder: n("mybodyshield.pages.goals.descriptionPlaceholder", "Why this goal matters and how you'll get there.")
214
219
  })]
215
220
  }),
216
- /* @__PURE__ */ M(B, { children: [/* @__PURE__ */ j(N, {
221
+ /* @__PURE__ */ N(V, { children: [/* @__PURE__ */ M(P, {
217
222
  type: "button",
218
223
  variant: "outline",
219
- onClick: () => c(!1),
220
- disabled: n.isPending,
221
- children: "Cancel"
222
- }), /* @__PURE__ */ j(N, {
224
+ onClick: () => l(!1),
225
+ disabled: i.isPending,
226
+ children: n("mybodyshield.common.cancel", "Cancel")
227
+ }), /* @__PURE__ */ M(P, {
223
228
  type: "submit",
224
- disabled: n.isPending,
225
- children: n.isPending ? "Creating…" : "Create goal"
229
+ disabled: i.isPending,
230
+ children: i.isPending ? n("mybodyshield.common.creating", "Creating…") : n("mybodyshield.pages.goals.createGoalButton", "Create goal")
226
231
  })] })
227
232
  ]
228
233
  })] })
229
234
  });
230
235
  }
231
- function oe({ goal: e, onOpenChange: t }) {
232
- let n = _(), [r, a] = T(""), [o, s] = T(null), [c, l] = T(null);
233
- e && e.id !== c && (l(e.id), a(String(e.currentValue)), s(null));
234
- let u = async () => {
236
+ function se({ goal: e, onOpenChange: t }) {
237
+ let n = m(), r = f(), [a, o] = T(""), [s, c] = T(null), [l, u] = T(null);
238
+ e && e.id !== l && (u(e.id), o(String(e.currentValue)), c(null));
239
+ let d = async () => {
235
240
  if (!e) return;
236
- let i = Z(r);
241
+ let i = Z(a);
237
242
  if (i === void 0) {
238
- s("Enter a valid number.");
243
+ c(n("mybodyshield.pages.goals.enterValidNumber", "Enter a valid number."));
239
244
  return;
240
245
  }
241
- s(null);
246
+ c(null);
242
247
  try {
243
- await n.mutateAsync({
248
+ await r.mutateAsync({
244
249
  id: e.id,
245
250
  input: { currentValue: i }
246
251
  }), t(!1);
247
252
  } catch (e) {
248
- s(e instanceof Error ? e.message : "Failed to update progress.");
253
+ c(e instanceof Error ? e.message : n("mybodyshield.pages.goals.failedToUpdate", "Failed to update progress."));
249
254
  }
250
255
  };
251
- return /* @__PURE__ */ j(L, {
256
+ return /* @__PURE__ */ M(R, {
252
257
  open: e != null,
253
258
  onOpenChange: t,
254
- children: /* @__PURE__ */ M(R, { children: [/* @__PURE__ */ M(V, { children: [/* @__PURE__ */ j(H, { children: "Update progress" }), /* @__PURE__ */ j(z, { children: e ? e.title : "Log your latest value for this goal." })] }), /* @__PURE__ */ M("form", {
259
+ children: /* @__PURE__ */ N(z, { children: [/* @__PURE__ */ N(H, { children: [/* @__PURE__ */ M(U, { children: n("mybodyshield.pages.goals.updateProgressTitle", "Update progress") }), /* @__PURE__ */ M(B, { children: e ? e.title : n("mybodyshield.pages.goals.updateProgressDescription", "Log your latest value for this goal.") })] }), /* @__PURE__ */ N("form", {
255
260
  className: "space-y-4",
256
261
  onSubmit: (e) => {
257
- e.preventDefault(), u();
262
+ e.preventDefault(), d();
258
263
  },
259
264
  children: [
260
- o && /* @__PURE__ */ j("p", {
265
+ s && /* @__PURE__ */ M("p", {
261
266
  className: "rounded-lg bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
262
- children: o
267
+ children: s
263
268
  }),
264
- /* @__PURE__ */ M("div", {
269
+ /* @__PURE__ */ N("div", {
265
270
  className: "space-y-2",
266
271
  children: [
267
- /* @__PURE__ */ M(I, {
272
+ /* @__PURE__ */ M(L, {
268
273
  htmlFor: "myb-goal-current",
269
- children: ["Current value", e?.unit ? ` (${e.unit})` : ""]
274
+ children: n("mybodyshield.pages.goals.currentValue", "Current value{{unit}}", { unit: e?.unit ? ` (${e.unit})` : "" })
270
275
  }),
271
- /* @__PURE__ */ j(F, {
276
+ /* @__PURE__ */ M(I, {
272
277
  id: "myb-goal-current",
273
278
  type: "number",
274
279
  inputMode: "decimal",
275
280
  autoFocus: !0,
276
- value: r,
277
- onChange: (e) => a(e.target.value),
281
+ value: a,
282
+ onChange: (e) => o(e.target.value),
278
283
  placeholder: "0"
279
284
  }),
280
285
  e && /* @__PURE__ */ M("p", {
281
286
  className: "text-xs text-text-tertiary",
282
- children: [
283
- "Target: ",
284
- i(e.targetValue),
285
- e.unit ? ` ${e.unit}` : ""
286
- ]
287
+ children: n("mybodyshield.pages.goals.targetValue", "Target: {{value}}", { value: i(e.targetValue) + (e.unit ? ` ${e.unit}` : "") })
287
288
  })
288
289
  ]
289
290
  }),
290
- /* @__PURE__ */ M(B, { children: [/* @__PURE__ */ j(N, {
291
+ /* @__PURE__ */ N(V, { children: [/* @__PURE__ */ M(P, {
291
292
  type: "button",
292
293
  variant: "outline",
293
294
  onClick: () => t(!1),
294
- disabled: n.isPending,
295
- children: "Cancel"
296
- }), /* @__PURE__ */ j(N, {
295
+ disabled: r.isPending,
296
+ children: n("mybodyshield.common.cancel", "Cancel")
297
+ }), /* @__PURE__ */ M(P, {
297
298
  type: "submit",
298
- disabled: n.isPending,
299
- children: n.isPending ? "Saving…" : "Save progress"
299
+ disabled: r.isPending,
300
+ children: r.isPending ? n("mybodyshield.common.saving", "Saving…") : n("mybodyshield.pages.goals.saveProgress", "Save progress")
300
301
  })] })
301
302
  ]
302
303
  })] })
303
304
  });
304
305
  }
305
- var se = [
306
+ var ce = [
306
307
  .22,
307
308
  1,
308
309
  .36,
309
310
  1
310
311
  ], $ = ({ index: e = 0, hover: t = !1, className: n, children: r }) => {
311
312
  let i = b();
312
- return /* @__PURE__ */ j(y.div, {
313
+ return /* @__PURE__ */ M(y.div, {
313
314
  className: n,
314
315
  initial: i ? !1 : {
315
316
  opacity: 0,
@@ -322,180 +323,175 @@ var se = [
322
323
  transition: i ? { duration: 0 } : {
323
324
  duration: .35,
324
325
  delay: Math.min(e * .05, .45),
325
- ease: se
326
+ ease: ce
326
327
  },
327
328
  whileHover: i || !t ? void 0 : { y: -4 },
328
329
  children: r
329
330
  });
330
331
  };
331
- function ce({ goal: e, index: t, onUpdateProgress: c, onAchieve: l, isAchieving: u }) {
332
- let d = x[e.type], f = d.icon, p = w(e), m = e.unit ? ` ${e.unit}` : "", h = e.status === "ACHIEVED";
333
- return /* @__PURE__ */ j($, {
332
+ function le({ goal: e, index: t, onUpdateProgress: c, onAchieve: l, isAchieving: u }) {
333
+ let d = m(), f = x[e.type], p = f.icon, h = w(e), g = e.unit ? ` ${e.unit}` : "", _ = e.status === "ACHIEVED";
334
+ return /* @__PURE__ */ M($, {
334
335
  index: t,
335
336
  hover: !0,
336
337
  className: "h-full",
337
- children: /* @__PURE__ */ M(P, {
338
+ children: /* @__PURE__ */ N(F, {
338
339
  treatment: "glass",
339
- glow: h,
340
+ glow: _,
340
341
  className: "flex h-full flex-col gap-3.5 p-5 transition-shadow hover:shadow-[var(--shadow-pop-hover)]",
341
342
  children: [
342
- /* @__PURE__ */ M("div", {
343
+ /* @__PURE__ */ N("div", {
343
344
  className: "flex items-start justify-between gap-3",
344
- children: [/* @__PURE__ */ M("div", {
345
+ children: [/* @__PURE__ */ N("div", {
345
346
  className: "flex min-w-0 items-start gap-3",
346
- children: [/* @__PURE__ */ j(S, {
347
- icon: /* @__PURE__ */ j(f, { className: "h-4 w-4" }),
348
- tint: d.tint
349
- }), /* @__PURE__ */ M("div", {
347
+ children: [/* @__PURE__ */ M(S, {
348
+ icon: /* @__PURE__ */ M(p, { className: "h-4 w-4" }),
349
+ tint: f.tint
350
+ }), /* @__PURE__ */ N("div", {
350
351
  className: "min-w-0",
351
- children: [/* @__PURE__ */ j("p", {
352
+ children: [/* @__PURE__ */ M("p", {
352
353
  className: "truncate text-sm font-semibold text-text-primary",
353
354
  children: e.title
354
- }), /* @__PURE__ */ j("span", {
355
+ }), /* @__PURE__ */ M("span", {
355
356
  className: "mt-1 inline-flex items-center rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-text-secondary",
356
357
  children: r(e.type)
357
358
  })]
358
359
  })]
359
- }), /* @__PURE__ */ j(s, { status: e.status })]
360
+ }), /* @__PURE__ */ M(s, { status: e.status })]
360
361
  }),
361
- e.description && /* @__PURE__ */ j("p", {
362
+ e.description && /* @__PURE__ */ M("p", {
362
363
  className: "line-clamp-2 text-xs text-text-secondary",
363
364
  children: e.description
364
365
  }),
365
- /* @__PURE__ */ M("div", {
366
+ /* @__PURE__ */ N("div", {
366
367
  className: "space-y-2",
367
- children: [/* @__PURE__ */ M("div", {
368
+ children: [/* @__PURE__ */ N("div", {
368
369
  className: "flex items-end justify-between gap-2",
369
- children: [/* @__PURE__ */ M("span", {
370
+ children: [/* @__PURE__ */ N("span", {
370
371
  className: "tabular-nums text-sm text-text-secondary",
371
- children: [/* @__PURE__ */ M("span", {
372
+ children: [/* @__PURE__ */ N("span", {
372
373
  className: "font-semibold text-text-primary",
373
- children: [i(e.currentValue), m]
374
- }), /* @__PURE__ */ M("span", {
374
+ children: [i(e.currentValue), g]
375
+ }), /* @__PURE__ */ N("span", {
375
376
  className: "text-text-tertiary",
376
377
  children: [
377
378
  " ",
378
379
  "/ ",
379
380
  i(e.targetValue),
380
- m
381
+ g
381
382
  ]
382
383
  })]
383
- }), /* @__PURE__ */ j("span", {
384
+ }), /* @__PURE__ */ M("span", {
384
385
  className: "text-lg font-bold leading-none tabular-nums text-action-primary-bg",
385
- children: a(p)
386
+ children: a(h)
386
387
  })]
387
- }), /* @__PURE__ */ j(C, {
388
- value: p,
388
+ }), /* @__PURE__ */ M(C, {
389
+ value: h,
389
390
  height: 10
390
391
  })]
391
392
  }),
392
- (e.targetDate || h && e.achievedAt) && /* @__PURE__ */ M("div", {
393
+ (e.targetDate || _ && e.achievedAt) && /* @__PURE__ */ N("div", {
393
394
  className: "flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-text-tertiary",
394
- children: [e.targetDate && /* @__PURE__ */ M("span", {
395
+ children: [e.targetDate && /* @__PURE__ */ N("span", {
395
396
  className: "inline-flex items-center gap-1",
396
397
  children: [
397
- /* @__PURE__ */ j(E, { className: "h-3.5 w-3.5" }),
398
- "Target ",
399
- n(e.targetDate),
400
- /* @__PURE__ */ M("span", {
398
+ /* @__PURE__ */ M(E, { className: "h-3.5 w-3.5" }),
399
+ d("mybodyshield.pages.goals.targetDateLabel", "Target {{date}}", { date: n(e.targetDate) }),
400
+ /* @__PURE__ */ N("span", {
401
401
  className: "text-text-secondary",
402
402
  children: ["· ", o(e.targetDate)]
403
403
  })
404
404
  ]
405
- }), h && e.achievedAt && /* @__PURE__ */ M("span", {
405
+ }), _ && e.achievedAt && /* @__PURE__ */ N("span", {
406
406
  className: "inline-flex items-center gap-1 text-status-success-text",
407
- children: [
408
- /* @__PURE__ */ j(D, { className: "h-3.5 w-3.5" }),
409
- "Achieved ",
410
- n(e.achievedAt)
411
- ]
407
+ children: [/* @__PURE__ */ M(D, { className: "h-3.5 w-3.5" }), d("mybodyshield.pages.goals.achievedDateLabel", "Achieved {{date}}", { date: n(e.achievedAt) })]
412
408
  })]
413
409
  }),
414
- /* @__PURE__ */ M("div", {
410
+ /* @__PURE__ */ N("div", {
415
411
  className: "mt-auto flex flex-wrap gap-2 pt-1",
416
- children: [/* @__PURE__ */ j(N, {
412
+ children: [/* @__PURE__ */ M(P, {
417
413
  variant: "outline",
418
414
  size: "sm",
419
415
  onClick: () => c(e),
420
- children: "Update progress"
421
- }), e.status === "ACTIVE" && /* @__PURE__ */ j(N, {
416
+ children: d("mybodyshield.pages.goals.updateProgress", "Update progress")
417
+ }), e.status === "ACTIVE" && /* @__PURE__ */ M(P, {
422
418
  size: "sm",
423
419
  onClick: () => l(e),
424
420
  disabled: u,
425
- children: u ? "Marking…" : "Mark achieved"
421
+ children: u ? d("mybodyshield.pages.goals.marking", "Marking…") : d("mybodyshield.pages.goals.markAchieved", "Mark achieved")
426
422
  })]
427
423
  })
428
424
  ]
429
425
  })
430
426
  });
431
427
  }
432
- function le() {
433
- let [n, r] = T("ALL"), [o, s] = T(!1), [h, _] = T(null), [y, b] = T(null), [x, S] = T(null), C = v(Y), E = g({
434
- status: n === "ALL" ? void 0 : n,
428
+ function ue() {
429
+ let n = m(), [r, o] = T("ALL"), [s, u] = T(!1), [f, y] = T(null), [b, x] = T(null), [S, C] = T(null), E = p(Y), D = d({
430
+ status: r === "ALL" ? void 0 : r,
435
431
  pagination: {
436
432
  limit: Y,
437
- offset: C.offset
433
+ offset: E.offset
438
434
  }
439
- }), D = g({
435
+ }), F = d({
440
436
  status: "ACTIVE",
441
437
  pagination: { limit: X }
442
- }), P = g({
438
+ }), I = d({
443
439
  status: "ACHIEVED",
444
440
  pagination: { limit: X }
445
- }), F = m(), I = E.data?.items ?? [], L = D.data?.items ?? [], R = P.data?.items ?? [], z = ee(() => L.length === 0 ? 0 : L.reduce((e, t) => e + w(t), 0) / L.length, [L]), B = (e) => {
446
- r(e), C.reset();
447
- }, V = async (e) => {
448
- b(e.id), S(null);
441
+ }), L = l(), R = D.data?.items ?? [], z = F.data?.items ?? [], B = I.data?.items ?? [], V = te(() => z.length === 0 ? 0 : z.reduce((e, t) => e + w(t), 0) / z.length, [z]), H = (e) => {
442
+ o(e), E.reset();
443
+ }, U = async (e) => {
444
+ x(e.id), C(null);
449
445
  try {
450
- await F.mutateAsync(e.id);
446
+ await L.mutateAsync(e.id);
451
447
  } catch (e) {
452
- S(e instanceof Error ? e.message : "Failed to mark goal as achieved.");
448
+ C(e instanceof Error ? e.message : n("mybodyshield.pages.goals.failedToAchieve", "Failed to mark goal as achieved."));
453
449
  } finally {
454
- b(null);
450
+ x(null);
455
451
  }
456
- }, H = E.isLoading && !E.data;
457
- return /* @__PURE__ */ M(e, {
458
- title: "Goals",
459
- description: "Targets across training, nutrition and body composition.",
460
- actions: /* @__PURE__ */ M(N, {
461
- onClick: () => s(!0),
462
- children: [/* @__PURE__ */ j(O, { className: "mr-2 h-4 w-4" }), "New goal"]
452
+ }, W = D.isLoading && !D.data, G = ie(n);
453
+ return /* @__PURE__ */ N(e, {
454
+ title: n("mybodyshield.pages.goals.title", "Goals"),
455
+ description: n("mybodyshield.pages.goals.description", "Targets across training, nutrition and body composition."),
456
+ actions: /* @__PURE__ */ N(P, {
457
+ onClick: () => u(!0),
458
+ children: [/* @__PURE__ */ M(O, { className: "mr-2 h-4 w-4" }), n("mybodyshield.pages.goals.newGoal", "New goal")]
463
459
  }),
464
460
  children: [
465
- /* @__PURE__ */ M("div", {
461
+ /* @__PURE__ */ N("div", {
466
462
  className: "grid grid-cols-1 gap-4 sm:grid-cols-3",
467
463
  children: [
468
- /* @__PURE__ */ j($, {
464
+ /* @__PURE__ */ M($, {
469
465
  index: 0,
470
466
  className: "h-full",
471
- children: /* @__PURE__ */ j(t, {
467
+ children: /* @__PURE__ */ M(t, {
472
468
  className: "h-full",
473
- icon: /* @__PURE__ */ j(k, { className: "h-5 w-5" }),
474
- value: i(D.data ? L.length : void 0),
475
- label: "Active goals"
469
+ icon: /* @__PURE__ */ M(k, { className: "h-5 w-5" }),
470
+ value: i(F.data ? z.length : void 0),
471
+ label: n("mybodyshield.pages.goals.activeGoals", "Active goals")
476
472
  })
477
473
  }),
478
- /* @__PURE__ */ j($, {
474
+ /* @__PURE__ */ M($, {
479
475
  index: 1,
480
476
  className: "h-full",
481
- children: /* @__PURE__ */ j(t, {
477
+ children: /* @__PURE__ */ M(t, {
482
478
  className: "h-full",
483
- icon: /* @__PURE__ */ j(te, { className: "h-5 w-5" }),
484
- value: i(P.data ? R.length : void 0),
485
- label: "Achieved",
479
+ icon: /* @__PURE__ */ M(A, { className: "h-5 w-5" }),
480
+ value: i(I.data ? B.length : void 0),
481
+ label: n("mybodyshield.pages.goals.achieved", "Achieved"),
486
482
  accent: "success"
487
483
  })
488
484
  }),
489
- /* @__PURE__ */ j($, {
485
+ /* @__PURE__ */ M($, {
490
486
  index: 2,
491
487
  className: "h-full",
492
- children: /* @__PURE__ */ j(t, {
488
+ children: /* @__PURE__ */ M(t, {
493
489
  className: "h-full",
494
- icon: /* @__PURE__ */ j(A, { className: "h-5 w-5" }),
495
- value: D.data ? a(z) : "—",
496
- label: "Avg progress (active)",
497
- footer: /* @__PURE__ */ j(p, {
498
- value: z,
490
+ icon: /* @__PURE__ */ M(ne, { className: "h-5 w-5" }),
491
+ value: F.data ? a(V) : "—",
492
+ label: n("mybodyshield.pages.goals.avgProgress", "Avg progress (active)"),
493
+ footer: /* @__PURE__ */ M(v, {
494
+ value: V,
499
495
  height: 4,
500
496
  barClassName: "bg-action-primary-bg"
501
497
  })
@@ -503,63 +499,63 @@ function le() {
503
499
  })
504
500
  ]
505
501
  }),
506
- /* @__PURE__ */ j("div", {
502
+ /* @__PURE__ */ M("div", {
507
503
  className: "mt-6",
508
- children: /* @__PURE__ */ j(d, {
509
- options: re,
510
- value: n,
511
- onChange: B
504
+ children: /* @__PURE__ */ M(_, {
505
+ options: G,
506
+ value: r,
507
+ onChange: H
512
508
  })
513
509
  }),
514
- x && /* @__PURE__ */ j("p", {
510
+ S && /* @__PURE__ */ M("p", {
515
511
  className: "mt-4 rounded-lg bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
516
- children: x
512
+ children: S
517
513
  }),
518
- /* @__PURE__ */ j("div", {
514
+ /* @__PURE__ */ M("div", {
519
515
  className: "mt-4",
520
- children: H ? /* @__PURE__ */ j(u, { label: "Loading your goals…" }) : E.isError ? /* @__PURE__ */ j(l, {
521
- message: "We couldn't load your goals.",
522
- onRetry: () => void E.refetch()
523
- }) : I.length === 0 ? /* @__PURE__ */ j(c, {
516
+ children: W ? /* @__PURE__ */ M(g, { label: n("mybodyshield.pages.goals.loading", "Loading your goals…") }) : D.isError ? /* @__PURE__ */ M(h, {
517
+ message: n("mybodyshield.pages.goals.error", "We couldn't load your goals."),
518
+ onRetry: () => void D.refetch()
519
+ }) : R.length === 0 ? /* @__PURE__ */ M(c, {
524
520
  illustration: "empty-data",
525
- icon: /* @__PURE__ */ j(k, { className: "h-10 w-10" }),
526
- title: n === "ALL" ? "No goals yet" : "No goals match this filter",
527
- description: n === "ALL" ? "Set a goal to give your training and nutrition a clear target to work toward." : "Try a different status filter, or create a new goal.",
528
- action: /* @__PURE__ */ M(N, {
529
- onClick: () => s(!0),
530
- children: [/* @__PURE__ */ j(O, { className: "mr-2 h-4 w-4" }), "New goal"]
521
+ icon: /* @__PURE__ */ M(k, { className: "h-10 w-10" }),
522
+ title: r === "ALL" ? n("mybodyshield.pages.goals.emptyTitle", "No goals yet") : n("mybodyshield.pages.goals.emptyFilteredTitle", "No goals match this filter"),
523
+ description: r === "ALL" ? n("mybodyshield.pages.goals.emptyDescription", "Set a goal to give your training and nutrition a clear target to work toward.") : n("mybodyshield.pages.goals.emptyFilteredDescription", "Try a different status filter, or create a new goal."),
524
+ action: /* @__PURE__ */ N(P, {
525
+ onClick: () => u(!0),
526
+ children: [/* @__PURE__ */ M(O, { className: "mr-2 h-4 w-4" }), n("mybodyshield.pages.goals.newGoal", "New goal")]
531
527
  })
532
- }) : /* @__PURE__ */ M(ne, { children: [/* @__PURE__ */ j("div", {
528
+ }) : /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M("div", {
533
529
  className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",
534
- children: I.map((e, t) => /* @__PURE__ */ j(ce, {
530
+ children: R.map((e, t) => /* @__PURE__ */ M(le, {
535
531
  goal: e,
536
532
  index: t,
537
- onUpdateProgress: _,
538
- onAchieve: (e) => void V(e),
539
- isAchieving: y === e.id
533
+ onUpdateProgress: y,
534
+ onAchieve: (e) => void U(e),
535
+ isAchieving: b === e.id
540
536
  }, e.id))
541
- }), /* @__PURE__ */ j(f, {
542
- page: C.page,
537
+ }), /* @__PURE__ */ M(ee, {
538
+ page: E.page,
543
539
  pageSize: Y,
544
- itemCount: I.length,
545
- hasMore: E.data?.pageInfo?.hasMore ?? !1,
546
- onPageChange: (e) => C.onPageChange(e)
540
+ itemCount: R.length,
541
+ hasMore: D.data?.pageInfo?.hasMore ?? !1,
542
+ onPageChange: (e) => E.onPageChange(e)
547
543
  })] })
548
544
  }),
549
- /* @__PURE__ */ j(ae, {
550
- open: o,
551
- onOpenChange: s
545
+ /* @__PURE__ */ M(oe, {
546
+ open: s,
547
+ onOpenChange: u
552
548
  }),
553
- /* @__PURE__ */ j(oe, {
554
- goal: h,
549
+ /* @__PURE__ */ M(se, {
550
+ goal: f,
555
551
  onOpenChange: (e) => {
556
- e || _(null);
552
+ e || y(null);
557
553
  }
558
554
  })
559
555
  ]
560
556
  });
561
557
  }
562
558
  //#endregion
563
- export { le as GoalsPage };
559
+ export { ue as GoalsPage };
564
560
 
565
561
  //# sourceMappingURL=GoalsPage.js.map