@burdenoff/microfe-mybodyshield 2026.731.1 → 2026.731.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mybodyshield/hooks/useMyBodyShieldApi.d.ts +28 -1
- package/dist/mybodyshield/hooks/useMyBodyShieldApi.d.ts.map +1 -1
- package/dist/mybodyshield/hooks/useMyBodyShieldApi.js +79 -40
- package/dist/mybodyshield/hooks/useMyBodyShieldApi.js.map +1 -1
- package/dist/mybodyshield/lib/offlineSessionQueue.d.ts +76 -0
- package/dist/mybodyshield/lib/offlineSessionQueue.d.ts.map +1 -0
- package/dist/mybodyshield/lib/offlineSessionQueue.js +77 -0
- package/dist/mybodyshield/lib/offlineSessionQueue.js.map +1 -0
- package/dist/mybodyshield/lib/useOfflineSessionSync.d.ts +30 -0
- package/dist/mybodyshield/lib/useOfflineSessionSync.d.ts.map +1 -0
- package/dist/mybodyshield/lib/useOfflineSessionSync.js +80 -0
- package/dist/mybodyshield/lib/useOfflineSessionSync.js.map +1 -0
- package/dist/mybodyshield/pages/DashboardPage.d.ts.map +1 -1
- package/dist/mybodyshield/pages/DashboardPage.js +247 -170
- package/dist/mybodyshield/pages/DashboardPage.js.map +1 -1
- package/dist/mybodyshield/pages/nutrition/NutritionPage.d.ts.map +1 -1
- package/dist/mybodyshield/pages/nutrition/NutritionPage.js +540 -441
- package/dist/mybodyshield/pages/nutrition/NutritionPage.js.map +1 -1
- package/dist/mybodyshield/pages/train/SessionDetailPage.d.ts.map +1 -1
- package/dist/mybodyshield/pages/train/SessionDetailPage.js +242 -173
- package/dist/mybodyshield/pages/train/SessionDetailPage.js.map +1 -1
- package/dist/mybodyshield/types/index.d.ts +46 -0
- package/dist/mybodyshield/types/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,68 +1,68 @@
|
|
|
1
1
|
import { PageLayout as e } from "../../components/PageLayout.js";
|
|
2
2
|
import { formatDate as t, formatEnumLabel as n, formatGrams as r, formatKcal as ee, formatNumber as i, formatRelativeTime as a } from "../../utils/formatters.js";
|
|
3
|
-
import { StatusBadge as
|
|
4
|
-
import { EmptyState as
|
|
5
|
-
import { ErrorView as
|
|
6
|
-
import { DataTable as
|
|
7
|
-
import { FilterTabs as
|
|
8
|
-
import { Tabs as
|
|
9
|
-
import { Pagination as
|
|
10
|
-
import { useMybActivateNutritionPlan as
|
|
11
|
-
import { useOffsetPager as
|
|
3
|
+
import { StatusBadge as te } from "../../components/StatusBadge.js";
|
|
4
|
+
import { EmptyState as o } from "../../components/EmptyState.js";
|
|
5
|
+
import { ErrorView as s, LoadingView as c, Section as ne } from "../../components/StateViews.js";
|
|
6
|
+
import { DataTable as re } from "../../components/DataTable.js";
|
|
7
|
+
import { FilterTabs as l } from "../../components/FilterTabs.js";
|
|
8
|
+
import { Tabs as ie } from "../../components/Tabs.js";
|
|
9
|
+
import { Pagination as ae } from "../../components/Pagination.js";
|
|
10
|
+
import { useMybActivateNutritionPlan as oe, useMybActiveNutritionPlan as se, useMybCreateNutritionPlan as ce, useMybDailyMacros as le, useMybDeleteMeal as ue, useMybFoodByBarcode as de, useMybLogMeal as fe, useMybMeals as pe, useMybSearchFoods as me, useMybUpdateNutritionPlan as he } from "../../hooks/useMyBodyShieldApi.js";
|
|
11
|
+
import { useOffsetPager as ge } from "../../hooks/usePager.js";
|
|
12
12
|
import "../../hooks/index.js";
|
|
13
13
|
import "../../components/index.js";
|
|
14
|
-
import { motion as
|
|
15
|
-
import { useReducedMotion as
|
|
16
|
-
import { IconChip as
|
|
17
|
-
import { useMemo as
|
|
18
|
-
import { Beef as
|
|
19
|
-
import { Fragment as
|
|
20
|
-
import { Button as
|
|
14
|
+
import { motion as u } from "../../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js";
|
|
15
|
+
import { useReducedMotion as _e } from "../../../node_modules/framer-motion/dist/es/utils/reduced-motion/use-reduced-motion.js";
|
|
16
|
+
import { IconChip as ve, MACRO_HUE as d, MacroBar as ye, Meter as be, ProgressRing as xe } from "../_shared/visuals.js";
|
|
17
|
+
import { useMemo as Se, useState as f } from "react";
|
|
18
|
+
import { Beef as Ce, Calendar as we, CheckCircle2 as Te, ClipboardList as Ee, Droplet as De, Flame as Oe, Pencil as ke, Plus as p, Salad as Ae, Star as m, Trash2 as je, UtensilsCrossed as Me, Wheat as Ne } from "lucide-react";
|
|
19
|
+
import { Fragment as Pe, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
20
|
+
import { Button as _, GlassCard as v, Input as y, Label as b, ResponsiveDialog as Fe, ResponsiveDialogContent as Ie, ResponsiveDialogDescription as Le, ResponsiveDialogFooter as Re, ResponsiveDialogHeader as ze, ResponsiveDialogTitle as Be, Select as Ve, SelectContent as He, SelectItem as Ue, SelectTrigger as We, SelectValue as Ge, Switch as Ke, Textarea as qe } from "@burdenoff/fe-libs/ui";
|
|
21
21
|
//#region src/mybodyshield/pages/nutrition/NutritionPage.tsx
|
|
22
|
-
var
|
|
22
|
+
var x = 25, Je = [
|
|
23
23
|
"BREAKFAST",
|
|
24
24
|
"LUNCH",
|
|
25
25
|
"DINNER",
|
|
26
26
|
"SNACK"
|
|
27
|
-
],
|
|
27
|
+
], Ye = [
|
|
28
28
|
"WEIGHT_LOSS",
|
|
29
29
|
"MUSCLE_GAIN",
|
|
30
30
|
"STRENGTH",
|
|
31
31
|
"ENDURANCE",
|
|
32
32
|
"MOBILITY",
|
|
33
33
|
"GENERAL_FITNESS"
|
|
34
|
-
],
|
|
34
|
+
], Xe = [
|
|
35
35
|
{
|
|
36
36
|
value: "today",
|
|
37
37
|
label: "Today",
|
|
38
|
-
icon: /* @__PURE__ */
|
|
38
|
+
icon: /* @__PURE__ */ h(Oe, { className: "h-4 w-4" })
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
value: "plan",
|
|
42
42
|
label: "Plan",
|
|
43
|
-
icon: /* @__PURE__ */
|
|
43
|
+
icon: /* @__PURE__ */ h(Ee, { className: "h-4 w-4" })
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
value: "meals",
|
|
47
47
|
label: "Meals",
|
|
48
|
-
icon: /* @__PURE__ */
|
|
48
|
+
icon: /* @__PURE__ */ h(Me, { className: "h-4 w-4" })
|
|
49
49
|
}
|
|
50
|
-
],
|
|
50
|
+
], Ze = [{
|
|
51
51
|
value: "ALL",
|
|
52
52
|
label: "All"
|
|
53
|
-
}, ...
|
|
53
|
+
}, ...Je.map((e) => ({
|
|
54
54
|
value: e,
|
|
55
55
|
label: n(e)
|
|
56
|
-
}))],
|
|
56
|
+
}))], S = (e) => {
|
|
57
57
|
let t = e.trim();
|
|
58
58
|
if (!t) return;
|
|
59
59
|
let n = Number(t);
|
|
60
60
|
return Number.isFinite(n) ? n : void 0;
|
|
61
|
-
},
|
|
61
|
+
}, C = (e) => e ? String(e) : "", Qe = (e) => {
|
|
62
62
|
if (!e) return "";
|
|
63
63
|
let t = new Date(e);
|
|
64
64
|
return Number.isNaN(t.getTime()) ? "" : t.toISOString().slice(0, 10);
|
|
65
|
-
},
|
|
65
|
+
}, $e = (e) => e ? new Date(e).toISOString() : void 0, w = {
|
|
66
66
|
name: "",
|
|
67
67
|
mealType: "BREAKFAST",
|
|
68
68
|
calories: "",
|
|
@@ -70,8 +70,9 @@ var C = 25, We = [
|
|
|
70
70
|
carbsG: "",
|
|
71
71
|
fatG: "",
|
|
72
72
|
servings: "",
|
|
73
|
-
isFavorite: !1
|
|
74
|
-
|
|
73
|
+
isFavorite: !1,
|
|
74
|
+
barcode: null
|
|
75
|
+
}, et = {
|
|
75
76
|
name: "",
|
|
76
77
|
goalType: "GENERAL_FITNESS",
|
|
77
78
|
calorieTarget: "",
|
|
@@ -82,119 +83,146 @@ var C = 25, We = [
|
|
|
82
83
|
endDate: "",
|
|
83
84
|
notes: ""
|
|
84
85
|
};
|
|
85
|
-
function
|
|
86
|
-
let [
|
|
87
|
-
mealType:
|
|
86
|
+
function T() {
|
|
87
|
+
let [T, tt] = f("today"), E = _e(), D = le(), O = se(), k = pe({}), [A, nt] = f("ALL"), j = ge(x), M = pe({
|
|
88
|
+
mealType: A === "ALL" ? void 0 : A,
|
|
88
89
|
pagination: {
|
|
89
|
-
limit:
|
|
90
|
-
offset:
|
|
90
|
+
limit: x,
|
|
91
|
+
offset: j.offset
|
|
91
92
|
}
|
|
92
|
-
}),
|
|
93
|
-
|
|
93
|
+
}), N = fe(), rt = ue(), it = ce(), at = he(), P = oe(), [ot, F] = f(null), [st, ct] = f(null), [lt, I] = f(null), [ut, L] = f(!1), [R, z] = f(w), [dt, B] = f(null), [V, ft] = f(""), H = me(V), [pt, mt] = f(""), [ht, U] = f(null), gt = de(), _t = (e) => {
|
|
94
|
+
z({
|
|
95
|
+
...R,
|
|
96
|
+
name: e.name,
|
|
97
|
+
calories: C(e.calories),
|
|
98
|
+
proteinG: C(e.proteinG),
|
|
99
|
+
carbsG: C(e.carbsG),
|
|
100
|
+
fatG: C(e.fatG),
|
|
101
|
+
servings: R.servings || "1",
|
|
102
|
+
barcode: e.barcode ?? null
|
|
103
|
+
}), ft("");
|
|
104
|
+
}, vt = async () => {
|
|
105
|
+
let e = pt.trim();
|
|
106
|
+
if (e) {
|
|
107
|
+
U(null);
|
|
108
|
+
try {
|
|
109
|
+
let t = await gt.mutateAsync(e);
|
|
110
|
+
if (!t) {
|
|
111
|
+
U(`No product found for barcode ${e}.`);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
_t(t), mt("");
|
|
115
|
+
} catch (e) {
|
|
116
|
+
U(e instanceof Error ? e.message : "Barcode lookup failed.");
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}, [yt, W] = f(!1), [G, bt] = f("create"), [K, q] = f(et), [xt, J] = f(null), St = O.data ?? null, Y = lt ?? St, X = Se(() => {
|
|
120
|
+
let e = k.data?.items ?? [], t = (/* @__PURE__ */ new Date()).toDateString();
|
|
94
121
|
return e.filter((e) => {
|
|
95
122
|
let n = new Date(e.loggedAt);
|
|
96
123
|
return !Number.isNaN(n.getTime()) && n.toDateString() === t;
|
|
97
124
|
}).sort((e, t) => new Date(t.loggedAt).getTime() - new Date(e.loggedAt).getTime());
|
|
98
|
-
}, [
|
|
99
|
-
|
|
125
|
+
}, [k.data]), Ct = M.data?.items ?? [], wt = (e) => {
|
|
126
|
+
nt(e), j.reset();
|
|
100
127
|
}, Z = () => {
|
|
101
|
-
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
name:
|
|
107
|
-
goalType:
|
|
108
|
-
calorieTarget:
|
|
109
|
-
proteinTarget:
|
|
110
|
-
carbsTarget:
|
|
111
|
-
fatTarget:
|
|
112
|
-
startDate:
|
|
113
|
-
endDate:
|
|
114
|
-
notes:
|
|
115
|
-
}),
|
|
116
|
-
},
|
|
117
|
-
if (!
|
|
118
|
-
|
|
128
|
+
z(w), B(null), ft(""), mt(""), U(null), L(!0);
|
|
129
|
+
}, Tt = () => {
|
|
130
|
+
bt("create"), q(et), J(null), W(!0);
|
|
131
|
+
}, Et = () => {
|
|
132
|
+
Y && (bt("edit"), q({
|
|
133
|
+
name: Y.name,
|
|
134
|
+
goalType: Y.goalType,
|
|
135
|
+
calorieTarget: C(Y.calorieTarget),
|
|
136
|
+
proteinTarget: C(Y.proteinTarget),
|
|
137
|
+
carbsTarget: C(Y.carbsTarget),
|
|
138
|
+
fatTarget: C(Y.fatTarget),
|
|
139
|
+
startDate: Qe(Y.startDate),
|
|
140
|
+
endDate: Qe(Y.endDate),
|
|
141
|
+
notes: Y.notes ?? ""
|
|
142
|
+
}), J(null), W(!0));
|
|
143
|
+
}, Dt = async () => {
|
|
144
|
+
if (!R.name.trim()) {
|
|
145
|
+
B("Meal name is required.");
|
|
119
146
|
return;
|
|
120
147
|
}
|
|
121
|
-
|
|
148
|
+
B(null);
|
|
122
149
|
try {
|
|
123
|
-
await
|
|
124
|
-
name:
|
|
125
|
-
mealType:
|
|
126
|
-
calories:
|
|
127
|
-
proteinG:
|
|
128
|
-
carbsG:
|
|
129
|
-
fatG:
|
|
130
|
-
servings:
|
|
131
|
-
isFavorite:
|
|
132
|
-
planId:
|
|
133
|
-
loggedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
134
|
-
|
|
150
|
+
await N.mutateAsync({
|
|
151
|
+
name: R.name.trim(),
|
|
152
|
+
mealType: R.mealType,
|
|
153
|
+
calories: S(R.calories),
|
|
154
|
+
proteinG: S(R.proteinG),
|
|
155
|
+
carbsG: S(R.carbsG),
|
|
156
|
+
fatG: S(R.fatG),
|
|
157
|
+
servings: S(R.servings),
|
|
158
|
+
isFavorite: R.isFavorite,
|
|
159
|
+
planId: Y?.id ?? void 0,
|
|
160
|
+
loggedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
161
|
+
barcode: R.barcode ?? void 0
|
|
162
|
+
}), L(!1), z(w);
|
|
135
163
|
} catch (e) {
|
|
136
|
-
|
|
164
|
+
B(e instanceof Error ? e.message : "Failed to log meal.");
|
|
137
165
|
}
|
|
138
|
-
},
|
|
139
|
-
if (!
|
|
140
|
-
|
|
166
|
+
}, Ot = async () => {
|
|
167
|
+
if (!K.name.trim()) {
|
|
168
|
+
J("Plan name is required.");
|
|
141
169
|
return;
|
|
142
170
|
}
|
|
143
|
-
|
|
171
|
+
J(null);
|
|
144
172
|
let e = {
|
|
145
|
-
goalType:
|
|
146
|
-
calorieTarget:
|
|
147
|
-
proteinTarget:
|
|
148
|
-
carbsTarget:
|
|
149
|
-
fatTarget:
|
|
150
|
-
startDate:
|
|
151
|
-
endDate:
|
|
152
|
-
notes:
|
|
173
|
+
goalType: K.goalType,
|
|
174
|
+
calorieTarget: S(K.calorieTarget),
|
|
175
|
+
proteinTarget: S(K.proteinTarget),
|
|
176
|
+
carbsTarget: S(K.carbsTarget),
|
|
177
|
+
fatTarget: S(K.fatTarget),
|
|
178
|
+
startDate: $e(K.startDate),
|
|
179
|
+
endDate: $e(K.endDate),
|
|
180
|
+
notes: K.notes.trim() || void 0
|
|
153
181
|
};
|
|
154
182
|
try {
|
|
155
|
-
if (
|
|
156
|
-
let t = await
|
|
157
|
-
id:
|
|
183
|
+
if (G === "edit" && Y) {
|
|
184
|
+
let t = await at.mutateAsync({
|
|
185
|
+
id: Y.id,
|
|
158
186
|
input: {
|
|
159
|
-
name:
|
|
187
|
+
name: K.name.trim(),
|
|
160
188
|
...e
|
|
161
189
|
}
|
|
162
190
|
});
|
|
163
|
-
|
|
164
|
-
} else
|
|
165
|
-
name:
|
|
191
|
+
I((e) => e && e.id === t.id ? t : e);
|
|
192
|
+
} else I(await it.mutateAsync({
|
|
193
|
+
name: K.name.trim(),
|
|
166
194
|
...e
|
|
167
|
-
})),
|
|
168
|
-
|
|
195
|
+
})), tt("plan");
|
|
196
|
+
W(!1);
|
|
169
197
|
} catch (e) {
|
|
170
|
-
|
|
198
|
+
J(e instanceof Error ? e.message : "Failed to save plan.");
|
|
171
199
|
}
|
|
172
|
-
},
|
|
173
|
-
|
|
200
|
+
}, kt = async (e) => {
|
|
201
|
+
F(null);
|
|
174
202
|
try {
|
|
175
|
-
await
|
|
203
|
+
await P.mutateAsync(e), I(null);
|
|
176
204
|
} catch (e) {
|
|
177
|
-
|
|
205
|
+
F(e instanceof Error ? e.message : "Failed to activate plan.");
|
|
178
206
|
}
|
|
179
|
-
},
|
|
207
|
+
}, At = async (e) => {
|
|
180
208
|
if (window.confirm("Delete this meal log? This cannot be undone.")) {
|
|
181
|
-
|
|
209
|
+
ct(e), F(null);
|
|
182
210
|
try {
|
|
183
|
-
await
|
|
211
|
+
await rt.mutateAsync(e);
|
|
184
212
|
} catch (e) {
|
|
185
|
-
|
|
213
|
+
F(e instanceof Error ? e.message : "Failed to delete meal.");
|
|
186
214
|
} finally {
|
|
187
|
-
|
|
215
|
+
ct(null);
|
|
188
216
|
}
|
|
189
217
|
}
|
|
190
|
-
},
|
|
218
|
+
}, jt = G === "edit" ? at.isPending : it.isPending, Q = {
|
|
191
219
|
hidden: {},
|
|
192
220
|
show: { transition: {
|
|
193
|
-
staggerChildren:
|
|
194
|
-
delayChildren:
|
|
221
|
+
staggerChildren: E ? 0 : .06,
|
|
222
|
+
delayChildren: E ? 0 : .03
|
|
195
223
|
} }
|
|
196
224
|
}, $ = {
|
|
197
|
-
hidden:
|
|
225
|
+
hidden: E ? { opacity: 0 } : {
|
|
198
226
|
opacity: 0,
|
|
199
227
|
y: 14
|
|
200
228
|
},
|
|
@@ -202,23 +230,23 @@ function D() {
|
|
|
202
230
|
opacity: 1,
|
|
203
231
|
y: 0,
|
|
204
232
|
transition: {
|
|
205
|
-
duration:
|
|
233
|
+
duration: E ? .2 : .45,
|
|
206
234
|
ease: "easeOut"
|
|
207
235
|
}
|
|
208
236
|
}
|
|
209
|
-
},
|
|
237
|
+
}, Mt = [
|
|
210
238
|
{
|
|
211
239
|
key: "favorite",
|
|
212
|
-
header: /* @__PURE__ */
|
|
240
|
+
header: /* @__PURE__ */ h(m, {
|
|
213
241
|
className: "h-3.5 w-3.5 text-action-primary-bg",
|
|
214
242
|
"aria-hidden": "true"
|
|
215
243
|
}),
|
|
216
244
|
align: "center",
|
|
217
245
|
sortValue: (e) => +!!e.isFavorite,
|
|
218
|
-
render: (e) => /* @__PURE__ */
|
|
246
|
+
render: (e) => /* @__PURE__ */ g("span", {
|
|
219
247
|
className: "inline-flex",
|
|
220
248
|
title: e.isFavorite ? "Favorite meal" : "Not a favorite",
|
|
221
|
-
children: [/* @__PURE__ */
|
|
249
|
+
children: [/* @__PURE__ */ h(m, { className: `h-4 w-4 transition-colors ${e.isFavorite ? "fill-current text-action-primary-bg" : "text-text-tertiary"}` }), /* @__PURE__ */ h("span", {
|
|
222
250
|
className: "sr-only",
|
|
223
251
|
children: e.isFavorite ? "Favorite" : "Not favorite"
|
|
224
252
|
})]
|
|
@@ -227,7 +255,7 @@ function D() {
|
|
|
227
255
|
{
|
|
228
256
|
key: "name",
|
|
229
257
|
header: "Meal",
|
|
230
|
-
render: (e) => /* @__PURE__ */
|
|
258
|
+
render: (e) => /* @__PURE__ */ h("span", {
|
|
231
259
|
className: "font-medium text-text-primary",
|
|
232
260
|
children: e.name
|
|
233
261
|
})
|
|
@@ -235,14 +263,14 @@ function D() {
|
|
|
235
263
|
{
|
|
236
264
|
key: "mealType",
|
|
237
265
|
header: "Type",
|
|
238
|
-
render: (e) => /* @__PURE__ */
|
|
266
|
+
render: (e) => /* @__PURE__ */ h(te, { status: e.mealType })
|
|
239
267
|
},
|
|
240
268
|
{
|
|
241
269
|
key: "calories",
|
|
242
270
|
header: "Calories",
|
|
243
271
|
align: "right",
|
|
244
272
|
sortValue: (e) => e.calories,
|
|
245
|
-
render: (e) => /* @__PURE__ */
|
|
273
|
+
render: (e) => /* @__PURE__ */ h("span", {
|
|
246
274
|
className: "font-semibold tabular-nums text-text-primary",
|
|
247
275
|
children: ee(e.calories)
|
|
248
276
|
})
|
|
@@ -253,7 +281,7 @@ function D() {
|
|
|
253
281
|
align: "right",
|
|
254
282
|
hideOnMobile: !0,
|
|
255
283
|
sortValue: (e) => e.proteinG,
|
|
256
|
-
render: (e) => /* @__PURE__ */
|
|
284
|
+
render: (e) => /* @__PURE__ */ h("span", {
|
|
257
285
|
className: "tabular-nums text-text-secondary",
|
|
258
286
|
children: r(e.proteinG)
|
|
259
287
|
})
|
|
@@ -264,7 +292,7 @@ function D() {
|
|
|
264
292
|
align: "right",
|
|
265
293
|
hideOnMobile: !0,
|
|
266
294
|
sortValue: (e) => e.carbsG,
|
|
267
|
-
render: (e) => /* @__PURE__ */
|
|
295
|
+
render: (e) => /* @__PURE__ */ h("span", {
|
|
268
296
|
className: "tabular-nums text-text-secondary",
|
|
269
297
|
children: r(e.carbsG)
|
|
270
298
|
})
|
|
@@ -275,7 +303,7 @@ function D() {
|
|
|
275
303
|
align: "right",
|
|
276
304
|
hideOnMobile: !0,
|
|
277
305
|
sortValue: (e) => e.fatG,
|
|
278
|
-
render: (e) => /* @__PURE__ */
|
|
306
|
+
render: (e) => /* @__PURE__ */ h("span", {
|
|
279
307
|
className: "tabular-nums text-text-secondary",
|
|
280
308
|
children: r(e.fatG)
|
|
281
309
|
})
|
|
@@ -285,7 +313,7 @@ function D() {
|
|
|
285
313
|
header: "Servings",
|
|
286
314
|
align: "right",
|
|
287
315
|
sortValue: (e) => e.servings,
|
|
288
|
-
render: (e) => /* @__PURE__ */
|
|
316
|
+
render: (e) => /* @__PURE__ */ h("span", {
|
|
289
317
|
className: "tabular-nums",
|
|
290
318
|
children: i(e.servings)
|
|
291
319
|
})
|
|
@@ -295,7 +323,7 @@ function D() {
|
|
|
295
323
|
header: "Logged",
|
|
296
324
|
hideOnMobile: !0,
|
|
297
325
|
sortValue: (e) => new Date(e.loggedAt).getTime(),
|
|
298
|
-
render: (e) => /* @__PURE__ */
|
|
326
|
+
render: (e) => /* @__PURE__ */ h("span", {
|
|
299
327
|
className: "text-text-secondary",
|
|
300
328
|
children: a(e.loggedAt)
|
|
301
329
|
})
|
|
@@ -304,121 +332,121 @@ function D() {
|
|
|
304
332
|
key: "actions",
|
|
305
333
|
header: "",
|
|
306
334
|
align: "right",
|
|
307
|
-
render: (e) => /* @__PURE__ */ _
|
|
335
|
+
render: (e) => /* @__PURE__ */ h(_, {
|
|
308
336
|
variant: "ghost",
|
|
309
337
|
size: "icon-sm",
|
|
310
|
-
onClick: () =>
|
|
311
|
-
disabled:
|
|
338
|
+
onClick: () => At(e.id),
|
|
339
|
+
disabled: st === e.id,
|
|
312
340
|
"aria-label": "Delete meal",
|
|
313
|
-
children: /* @__PURE__ */
|
|
341
|
+
children: /* @__PURE__ */ h(je, { className: "h-4 w-4 text-status-error-text" })
|
|
314
342
|
})
|
|
315
343
|
}
|
|
316
344
|
];
|
|
317
|
-
return /* @__PURE__ */
|
|
345
|
+
return /* @__PURE__ */ g(e, {
|
|
318
346
|
title: "Nutrition",
|
|
319
347
|
description: "Plans, meal logging and daily macro targets.",
|
|
320
|
-
actions:
|
|
348
|
+
actions: T === "plan" ? /* @__PURE__ */ g("div", {
|
|
321
349
|
className: "flex flex-wrap items-center gap-2",
|
|
322
|
-
children: [
|
|
350
|
+
children: [Y && /* @__PURE__ */ g(_, {
|
|
323
351
|
variant: "outline",
|
|
324
|
-
onClick:
|
|
325
|
-
children: [/* @__PURE__ */
|
|
326
|
-
}), /* @__PURE__ */
|
|
327
|
-
onClick:
|
|
328
|
-
children: [/* @__PURE__ */
|
|
352
|
+
onClick: Et,
|
|
353
|
+
children: [/* @__PURE__ */ h(ke, { className: "mr-1.5 h-4 w-4" }), " Edit targets"]
|
|
354
|
+
}), /* @__PURE__ */ g(_, {
|
|
355
|
+
onClick: Tt,
|
|
356
|
+
children: [/* @__PURE__ */ h(p, { className: "mr-1.5 h-4 w-4" }), " Create plan"]
|
|
329
357
|
})]
|
|
330
|
-
}) : /* @__PURE__ */
|
|
358
|
+
}) : /* @__PURE__ */ g(_, {
|
|
331
359
|
onClick: Z,
|
|
332
|
-
children: [/* @__PURE__ */
|
|
360
|
+
children: [/* @__PURE__ */ h(p, { className: "mr-1.5 h-4 w-4" }), " Log meal"]
|
|
333
361
|
}),
|
|
334
362
|
children: [
|
|
335
|
-
/* @__PURE__ */
|
|
336
|
-
items:
|
|
337
|
-
value:
|
|
338
|
-
onChange:
|
|
363
|
+
/* @__PURE__ */ h(ie, {
|
|
364
|
+
items: Xe,
|
|
365
|
+
value: T,
|
|
366
|
+
onChange: tt,
|
|
339
367
|
className: "mb-6"
|
|
340
368
|
}),
|
|
341
|
-
|
|
369
|
+
ot && /* @__PURE__ */ h("div", {
|
|
342
370
|
className: "mb-4 rounded-lg border border-status-error-text/40 bg-status-error-bg-subtle px-4 py-2 text-sm text-status-error-text",
|
|
343
|
-
children:
|
|
371
|
+
children: ot
|
|
344
372
|
}),
|
|
345
|
-
|
|
346
|
-
if (
|
|
347
|
-
if (
|
|
373
|
+
T === "today" && (() => {
|
|
374
|
+
if (D.isLoading) return /* @__PURE__ */ h(c, { label: "Loading today's nutrition…" });
|
|
375
|
+
if (D.isError) return /* @__PURE__ */ h(s, {
|
|
348
376
|
message: "We couldn't load your daily macros.",
|
|
349
|
-
onRetry: () =>
|
|
377
|
+
onRetry: () => D.refetch()
|
|
350
378
|
});
|
|
351
|
-
let e =
|
|
352
|
-
if (!e) return /* @__PURE__ */
|
|
353
|
-
let t = e.calorieTarget > 0, n = e.calories > 0 ||
|
|
354
|
-
if (!t && !n) return /* @__PURE__ */
|
|
379
|
+
let e = D.data;
|
|
380
|
+
if (!e) return /* @__PURE__ */ h(c, { label: "Loading today's nutrition…" });
|
|
381
|
+
let t = e.calorieTarget > 0, n = e.calories > 0 || X.length > 0;
|
|
382
|
+
if (!t && !n) return /* @__PURE__ */ h(o, {
|
|
355
383
|
illustration: "empty-data",
|
|
356
|
-
icon: /* @__PURE__ */
|
|
384
|
+
icon: /* @__PURE__ */ h(Ae, { className: "h-10 w-10" }),
|
|
357
385
|
title: "No nutrition tracked yet",
|
|
358
386
|
description: "Activate a nutrition plan or log your first meal to start tracking daily macros.",
|
|
359
|
-
action: /* @__PURE__ */
|
|
387
|
+
action: /* @__PURE__ */ g(_, {
|
|
360
388
|
onClick: Z,
|
|
361
|
-
children: [/* @__PURE__ */
|
|
389
|
+
children: [/* @__PURE__ */ h(p, { className: "mr-1.5 h-4 w-4" }), " Log meal"]
|
|
362
390
|
})
|
|
363
391
|
});
|
|
364
|
-
let a = e.calorieTarget ? e.calories / e.calorieTarget * 100 : 0,
|
|
392
|
+
let a = e.calorieTarget ? e.calories / e.calorieTarget * 100 : 0, re = Math.round(Math.max(0, Math.min(100, a))), l = [
|
|
365
393
|
{
|
|
366
394
|
label: "Protein",
|
|
367
395
|
value: e.proteinG,
|
|
368
396
|
target: e.proteinTarget,
|
|
369
|
-
color:
|
|
397
|
+
color: d.protein
|
|
370
398
|
},
|
|
371
399
|
{
|
|
372
400
|
label: "Carbs",
|
|
373
401
|
value: e.carbsG,
|
|
374
402
|
target: e.carbsTarget,
|
|
375
|
-
color:
|
|
403
|
+
color: d.carbs
|
|
376
404
|
},
|
|
377
405
|
{
|
|
378
406
|
label: "Fat",
|
|
379
407
|
value: e.fatG,
|
|
380
408
|
target: e.fatTarget,
|
|
381
|
-
color:
|
|
409
|
+
color: d.fat
|
|
382
410
|
}
|
|
383
411
|
];
|
|
384
|
-
return /* @__PURE__ */
|
|
412
|
+
return /* @__PURE__ */ g(u.div, {
|
|
385
413
|
initial: "hidden",
|
|
386
414
|
animate: "show",
|
|
387
415
|
variants: Q,
|
|
388
416
|
className: "space-y-6",
|
|
389
417
|
children: [
|
|
390
|
-
/* @__PURE__ */
|
|
418
|
+
/* @__PURE__ */ h(u.div, {
|
|
391
419
|
variants: $,
|
|
392
|
-
children: /* @__PURE__ */ v
|
|
420
|
+
children: /* @__PURE__ */ g(v, {
|
|
393
421
|
treatment: "glass",
|
|
394
422
|
glow: !0,
|
|
395
423
|
className: "p-6 sm:p-7",
|
|
396
|
-
children: [/* @__PURE__ */
|
|
424
|
+
children: [/* @__PURE__ */ g("div", {
|
|
397
425
|
className: "mb-5",
|
|
398
|
-
children: [/* @__PURE__ */
|
|
426
|
+
children: [/* @__PURE__ */ h("h2", {
|
|
399
427
|
className: "text-base font-semibold text-text-primary",
|
|
400
428
|
children: "Today's macros"
|
|
401
|
-
}), /* @__PURE__ */
|
|
429
|
+
}), /* @__PURE__ */ h("p", {
|
|
402
430
|
className: "mt-0.5 text-sm text-text-secondary",
|
|
403
431
|
children: "Calories & macros logged against your active plan."
|
|
404
432
|
})]
|
|
405
|
-
}), /* @__PURE__ */
|
|
433
|
+
}), /* @__PURE__ */ g("div", {
|
|
406
434
|
className: "flex flex-col items-center gap-6 sm:flex-row sm:items-center sm:gap-8",
|
|
407
|
-
children: [/* @__PURE__ */
|
|
435
|
+
children: [/* @__PURE__ */ g("div", {
|
|
408
436
|
className: "relative flex shrink-0 items-center justify-center",
|
|
409
|
-
children: [/* @__PURE__ */
|
|
437
|
+
children: [/* @__PURE__ */ h("div", {
|
|
410
438
|
"aria-hidden": "true",
|
|
411
439
|
className: "pointer-events-none absolute inset-3 rounded-full blur-2xl",
|
|
412
440
|
style: { background: "radial-gradient(circle, color-mix(in srgb, var(--color-action-primary-bg) 30%, transparent), transparent 68%)" }
|
|
413
|
-
}), /* @__PURE__ */
|
|
441
|
+
}), /* @__PURE__ */ g(xe, {
|
|
414
442
|
value: a,
|
|
415
443
|
size: 168,
|
|
416
444
|
stroke: 14,
|
|
417
445
|
className: "relative",
|
|
418
|
-
children: [/* @__PURE__ */
|
|
446
|
+
children: [/* @__PURE__ */ h("span", {
|
|
419
447
|
className: "text-3xl font-bold tabular-nums text-text-primary",
|
|
420
448
|
children: i(e.calories)
|
|
421
|
-
}), /* @__PURE__ */
|
|
449
|
+
}), /* @__PURE__ */ g("span", {
|
|
422
450
|
className: "mt-0.5 text-xs text-text-tertiary",
|
|
423
451
|
children: [
|
|
424
452
|
"/ ",
|
|
@@ -427,43 +455,43 @@ function D() {
|
|
|
427
455
|
]
|
|
428
456
|
})]
|
|
429
457
|
})]
|
|
430
|
-
}), /* @__PURE__ */
|
|
458
|
+
}), /* @__PURE__ */ g("div", {
|
|
431
459
|
className: "flex w-full flex-1 flex-col gap-4",
|
|
432
|
-
children: [/* @__PURE__ */
|
|
460
|
+
children: [/* @__PURE__ */ h(ye, {
|
|
433
461
|
proteinG: e.proteinG,
|
|
434
462
|
carbsG: e.carbsG,
|
|
435
463
|
fatG: e.fatG,
|
|
436
464
|
height: 12
|
|
437
|
-
}), /* @__PURE__ */
|
|
465
|
+
}), /* @__PURE__ */ g("div", {
|
|
438
466
|
className: "flex flex-col gap-4 sm:flex-row sm:items-stretch",
|
|
439
|
-
children: [/* @__PURE__ */
|
|
467
|
+
children: [/* @__PURE__ */ h("div", {
|
|
440
468
|
className: "flex-1 space-y-2.5",
|
|
441
|
-
children:
|
|
469
|
+
children: l.map((e) => /* @__PURE__ */ g("div", {
|
|
442
470
|
className: "flex items-center justify-between gap-3",
|
|
443
|
-
children: [/* @__PURE__ */
|
|
471
|
+
children: [/* @__PURE__ */ g("span", {
|
|
444
472
|
className: "inline-flex items-center gap-2 text-sm text-text-secondary",
|
|
445
|
-
children: [/* @__PURE__ */
|
|
473
|
+
children: [/* @__PURE__ */ h("span", {
|
|
446
474
|
className: "h-2.5 w-2.5 rounded-full",
|
|
447
475
|
style: { backgroundColor: e.color }
|
|
448
476
|
}), e.label]
|
|
449
|
-
}), /* @__PURE__ */
|
|
477
|
+
}), /* @__PURE__ */ h("span", {
|
|
450
478
|
className: "text-sm font-semibold tabular-nums text-text-primary",
|
|
451
479
|
children: r(e.value)
|
|
452
480
|
})]
|
|
453
481
|
}, e.label))
|
|
454
|
-
}), /* @__PURE__ */
|
|
482
|
+
}), /* @__PURE__ */ g("div", {
|
|
455
483
|
className: "flex flex-col justify-center rounded-2xl px-4 py-3 sm:min-w-[9rem]",
|
|
456
484
|
style: { backgroundColor: "color-mix(in srgb, var(--color-action-primary-bg) 12%, transparent)" },
|
|
457
485
|
children: [
|
|
458
|
-
/* @__PURE__ */
|
|
486
|
+
/* @__PURE__ */ h("span", {
|
|
459
487
|
className: "text-xs font-medium text-text-tertiary",
|
|
460
488
|
children: "Calorie ring"
|
|
461
489
|
}),
|
|
462
|
-
/* @__PURE__ */
|
|
490
|
+
/* @__PURE__ */ g("span", {
|
|
463
491
|
className: "text-2xl font-bold tabular-nums text-action-primary-bg",
|
|
464
|
-
children: [
|
|
492
|
+
children: [re, "%"]
|
|
465
493
|
}),
|
|
466
|
-
/* @__PURE__ */
|
|
494
|
+
/* @__PURE__ */ h("span", {
|
|
467
495
|
className: "text-xs text-text-secondary",
|
|
468
496
|
children: "of daily target"
|
|
469
497
|
})
|
|
@@ -474,26 +502,26 @@ function D() {
|
|
|
474
502
|
})]
|
|
475
503
|
})
|
|
476
504
|
}),
|
|
477
|
-
/* @__PURE__ */
|
|
505
|
+
/* @__PURE__ */ h(u.div, {
|
|
478
506
|
variants: Q,
|
|
479
507
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-3 sm:gap-4",
|
|
480
|
-
children:
|
|
508
|
+
children: l.map((e) => /* @__PURE__ */ h(u.div, {
|
|
481
509
|
variants: $,
|
|
482
|
-
children: /* @__PURE__ */ v
|
|
510
|
+
children: /* @__PURE__ */ g(v, {
|
|
483
511
|
treatment: "metric",
|
|
484
512
|
className: "p-4",
|
|
485
|
-
children: [/* @__PURE__ */
|
|
513
|
+
children: [/* @__PURE__ */ g("div", {
|
|
486
514
|
className: "flex flex-wrap items-center justify-between gap-2",
|
|
487
|
-
children: [/* @__PURE__ */
|
|
515
|
+
children: [/* @__PURE__ */ g("span", {
|
|
488
516
|
className: "inline-flex items-center gap-2 text-sm font-medium text-text-primary",
|
|
489
|
-
children: [/* @__PURE__ */
|
|
517
|
+
children: [/* @__PURE__ */ h("span", {
|
|
490
518
|
className: "h-2.5 w-2.5 rounded-full",
|
|
491
519
|
style: { backgroundColor: e.color }
|
|
492
520
|
}), e.label]
|
|
493
|
-
}), /* @__PURE__ */
|
|
521
|
+
}), /* @__PURE__ */ g("span", {
|
|
494
522
|
className: "text-sm tabular-nums text-text-secondary",
|
|
495
523
|
children: [
|
|
496
|
-
/* @__PURE__ */
|
|
524
|
+
/* @__PURE__ */ h("span", {
|
|
497
525
|
className: "font-semibold text-text-primary",
|
|
498
526
|
children: i(e.value)
|
|
499
527
|
}),
|
|
@@ -503,7 +531,7 @@ function D() {
|
|
|
503
531
|
" g"
|
|
504
532
|
]
|
|
505
533
|
})]
|
|
506
|
-
}), /* @__PURE__ */
|
|
534
|
+
}), /* @__PURE__ */ h(be, {
|
|
507
535
|
value: e.target ? e.value / e.target * 100 : 0,
|
|
508
536
|
color: e.color,
|
|
509
537
|
height: 8,
|
|
@@ -512,42 +540,42 @@ function D() {
|
|
|
512
540
|
})
|
|
513
541
|
}, e.label))
|
|
514
542
|
}),
|
|
515
|
-
/* @__PURE__ */
|
|
543
|
+
/* @__PURE__ */ h(u.div, {
|
|
516
544
|
variants: $,
|
|
517
|
-
children: /* @__PURE__ */
|
|
545
|
+
children: /* @__PURE__ */ h(ne, {
|
|
518
546
|
title: "Today's meals",
|
|
519
547
|
description: "Everything you've logged today.",
|
|
520
|
-
children:
|
|
548
|
+
children: k.isLoading ? /* @__PURE__ */ h(c, { label: "Loading meals…" }) : k.isError ? /* @__PURE__ */ h(s, {
|
|
521
549
|
message: "We couldn't load today's meals.",
|
|
522
|
-
onRetry: () =>
|
|
523
|
-
}) :
|
|
550
|
+
onRetry: () => k.refetch()
|
|
551
|
+
}) : X.length === 0 ? /* @__PURE__ */ h(o, {
|
|
524
552
|
illustration: "empty-data",
|
|
525
|
-
icon: /* @__PURE__ */
|
|
553
|
+
icon: /* @__PURE__ */ h(Ae, { className: "h-10 w-10" }),
|
|
526
554
|
title: "No meals logged today",
|
|
527
555
|
description: "Use “Log meal” to record what you've eaten and keep your macros current.",
|
|
528
|
-
action: /* @__PURE__ */
|
|
556
|
+
action: /* @__PURE__ */ g(_, {
|
|
529
557
|
onClick: Z,
|
|
530
|
-
children: [/* @__PURE__ */
|
|
558
|
+
children: [/* @__PURE__ */ h(p, { className: "mr-1.5 h-4 w-4" }), " Log meal"]
|
|
531
559
|
})
|
|
532
|
-
}) : /* @__PURE__ */
|
|
560
|
+
}) : /* @__PURE__ */ h(v, {
|
|
533
561
|
treatment: "plain",
|
|
534
562
|
className: "divide-y divide-border-seam/60 px-2 sm:px-3",
|
|
535
|
-
children:
|
|
563
|
+
children: X.map((e) => /* @__PURE__ */ g("div", {
|
|
536
564
|
className: "flex items-center gap-3 rounded-xl px-2 py-3 transition-colors hover:bg-bg-sunken/40",
|
|
537
565
|
children: [
|
|
538
|
-
/* @__PURE__ */
|
|
539
|
-
/* @__PURE__ */
|
|
566
|
+
/* @__PURE__ */ h(te, { status: e.mealType }),
|
|
567
|
+
/* @__PURE__ */ g("div", {
|
|
540
568
|
className: "min-w-0 flex-1",
|
|
541
|
-
children: [/* @__PURE__ */
|
|
569
|
+
children: [/* @__PURE__ */ g("div", {
|
|
542
570
|
className: "flex items-center gap-1.5",
|
|
543
|
-
children: [/* @__PURE__ */
|
|
571
|
+
children: [/* @__PURE__ */ h("p", {
|
|
544
572
|
className: "truncate text-sm font-medium text-text-primary",
|
|
545
573
|
children: e.name
|
|
546
|
-
}), e.isFavorite && /* @__PURE__ */
|
|
574
|
+
}), e.isFavorite && /* @__PURE__ */ h(m, {
|
|
547
575
|
className: "h-3.5 w-3.5 shrink-0 fill-current text-action-primary-bg",
|
|
548
576
|
"aria-label": "Favorite meal"
|
|
549
577
|
})]
|
|
550
|
-
}), /* @__PURE__ */
|
|
578
|
+
}), /* @__PURE__ */ g("p", {
|
|
551
579
|
className: "text-xs text-text-tertiary",
|
|
552
580
|
children: [
|
|
553
581
|
r(e.proteinG),
|
|
@@ -563,18 +591,18 @@ function D() {
|
|
|
563
591
|
]
|
|
564
592
|
})]
|
|
565
593
|
}),
|
|
566
|
-
/* @__PURE__ */
|
|
594
|
+
/* @__PURE__ */ h("span", {
|
|
567
595
|
className: "shrink-0 text-sm font-semibold tabular-nums text-text-primary",
|
|
568
596
|
children: ee(e.calories)
|
|
569
597
|
}),
|
|
570
|
-
/* @__PURE__ */ _
|
|
598
|
+
/* @__PURE__ */ h(_, {
|
|
571
599
|
variant: "ghost",
|
|
572
600
|
size: "icon-sm",
|
|
573
|
-
onClick: () =>
|
|
574
|
-
disabled:
|
|
601
|
+
onClick: () => At(e.id),
|
|
602
|
+
disabled: st === e.id,
|
|
575
603
|
"aria-label": "Delete meal",
|
|
576
604
|
className: "shrink-0",
|
|
577
|
-
children: /* @__PURE__ */
|
|
605
|
+
children: /* @__PURE__ */ h(je, { className: "h-4 w-4 text-status-error-text" })
|
|
578
606
|
})
|
|
579
607
|
]
|
|
580
608
|
}, e.id))
|
|
@@ -584,154 +612,154 @@ function D() {
|
|
|
584
612
|
]
|
|
585
613
|
});
|
|
586
614
|
})(),
|
|
587
|
-
|
|
588
|
-
if (
|
|
589
|
-
if (
|
|
615
|
+
T === "plan" && (() => {
|
|
616
|
+
if (O.isLoading) return /* @__PURE__ */ h(c, { label: "Loading your nutrition plan…" });
|
|
617
|
+
if (O.isError) return /* @__PURE__ */ h(s, {
|
|
590
618
|
message: "We couldn't load your active nutrition plan.",
|
|
591
|
-
onRetry: () =>
|
|
619
|
+
onRetry: () => O.refetch()
|
|
592
620
|
});
|
|
593
|
-
if (!
|
|
621
|
+
if (!Y) return /* @__PURE__ */ h(o, {
|
|
594
622
|
illustration: "empty-data",
|
|
595
|
-
icon: /* @__PURE__ */
|
|
623
|
+
icon: /* @__PURE__ */ h(Ee, { className: "h-10 w-10" }),
|
|
596
624
|
title: "No active nutrition plan",
|
|
597
625
|
description: "Create a nutrition plan to set your daily calorie and macro targets.",
|
|
598
|
-
action: /* @__PURE__ */
|
|
599
|
-
onClick:
|
|
600
|
-
children: [/* @__PURE__ */
|
|
626
|
+
action: /* @__PURE__ */ g(_, {
|
|
627
|
+
onClick: Tt,
|
|
628
|
+
children: [/* @__PURE__ */ h(p, { className: "mr-1.5 h-4 w-4" }), " Create plan"]
|
|
601
629
|
})
|
|
602
630
|
});
|
|
603
631
|
let e = [
|
|
604
632
|
{
|
|
605
|
-
icon: /* @__PURE__ */
|
|
633
|
+
icon: /* @__PURE__ */ h(Oe, { className: "h-5 w-5" }),
|
|
606
634
|
label: "Calorie target",
|
|
607
|
-
value:
|
|
635
|
+
value: Y.calorieTarget ? `${i(Y.calorieTarget)} kcal` : "—",
|
|
608
636
|
tint: "var(--color-action-primary-bg)"
|
|
609
637
|
},
|
|
610
638
|
{
|
|
611
|
-
icon: /* @__PURE__ */
|
|
639
|
+
icon: /* @__PURE__ */ h(Ce, { className: "h-5 w-5" }),
|
|
612
640
|
label: "Protein target",
|
|
613
|
-
value:
|
|
614
|
-
tint:
|
|
641
|
+
value: Y.proteinTarget ? r(Y.proteinTarget) : "—",
|
|
642
|
+
tint: d.protein
|
|
615
643
|
},
|
|
616
644
|
{
|
|
617
|
-
icon: /* @__PURE__ */
|
|
645
|
+
icon: /* @__PURE__ */ h(Ne, { className: "h-5 w-5" }),
|
|
618
646
|
label: "Carbs target",
|
|
619
|
-
value:
|
|
620
|
-
tint:
|
|
647
|
+
value: Y.carbsTarget ? r(Y.carbsTarget) : "—",
|
|
648
|
+
tint: d.carbs
|
|
621
649
|
},
|
|
622
650
|
{
|
|
623
|
-
icon: /* @__PURE__ */
|
|
651
|
+
icon: /* @__PURE__ */ h(De, { className: "h-5 w-5" }),
|
|
624
652
|
label: "Fat target",
|
|
625
|
-
value:
|
|
626
|
-
tint:
|
|
653
|
+
value: Y.fatTarget ? r(Y.fatTarget) : "—",
|
|
654
|
+
tint: d.fat
|
|
627
655
|
}
|
|
628
656
|
];
|
|
629
|
-
return /* @__PURE__ */
|
|
657
|
+
return /* @__PURE__ */ g(u.div, {
|
|
630
658
|
initial: "hidden",
|
|
631
659
|
animate: "show",
|
|
632
660
|
variants: Q,
|
|
633
661
|
className: "space-y-6",
|
|
634
662
|
children: [
|
|
635
|
-
!
|
|
663
|
+
!Y.isActive && /* @__PURE__ */ g(u.div, {
|
|
636
664
|
variants: $,
|
|
637
665
|
className: "flex flex-wrap items-center justify-between gap-3 rounded-2xl border p-4",
|
|
638
666
|
style: {
|
|
639
667
|
borderColor: "color-mix(in srgb, var(--color-action-primary-bg) 32%, transparent)",
|
|
640
668
|
backgroundColor: "color-mix(in srgb, var(--color-action-primary-bg) 8%, transparent)"
|
|
641
669
|
},
|
|
642
|
-
children: [/* @__PURE__ */
|
|
670
|
+
children: [/* @__PURE__ */ g("div", {
|
|
643
671
|
className: "flex min-w-0 items-center gap-3",
|
|
644
|
-
children: [/* @__PURE__ */
|
|
672
|
+
children: [/* @__PURE__ */ h(ve, { icon: /* @__PURE__ */ h(Te, { className: "h-5 w-5" }) }), /* @__PURE__ */ g("div", {
|
|
645
673
|
className: "min-w-0",
|
|
646
|
-
children: [/* @__PURE__ */
|
|
674
|
+
children: [/* @__PURE__ */ h("p", {
|
|
647
675
|
className: "text-sm font-medium text-text-primary",
|
|
648
676
|
children: "This plan isn't active yet"
|
|
649
|
-
}), /* @__PURE__ */
|
|
677
|
+
}), /* @__PURE__ */ h("p", {
|
|
650
678
|
className: "text-xs text-text-secondary",
|
|
651
679
|
children: "Activate it to track today's macros against these targets."
|
|
652
680
|
})]
|
|
653
681
|
})]
|
|
654
|
-
}), /* @__PURE__ */
|
|
655
|
-
onClick: () =>
|
|
656
|
-
disabled:
|
|
657
|
-
children: [/* @__PURE__ */
|
|
682
|
+
}), /* @__PURE__ */ g(_, {
|
|
683
|
+
onClick: () => kt(Y.id),
|
|
684
|
+
disabled: P.isPending,
|
|
685
|
+
children: [/* @__PURE__ */ h(Te, { className: "mr-1.5 h-4 w-4" }), P.isPending ? "Activating…" : "Activate this plan"]
|
|
658
686
|
})]
|
|
659
687
|
}),
|
|
660
|
-
/* @__PURE__ */
|
|
688
|
+
/* @__PURE__ */ h(u.div, {
|
|
661
689
|
variants: $,
|
|
662
|
-
children: /* @__PURE__ */ v
|
|
690
|
+
children: /* @__PURE__ */ g(v, {
|
|
663
691
|
treatment: "glass",
|
|
664
692
|
glow: !0,
|
|
665
693
|
className: "relative overflow-hidden p-6 sm:p-7",
|
|
666
694
|
children: [
|
|
667
|
-
/* @__PURE__ */
|
|
695
|
+
/* @__PURE__ */ h("div", {
|
|
668
696
|
"aria-hidden": "true",
|
|
669
697
|
className: "pointer-events-none absolute inset-0",
|
|
670
698
|
style: { background: "radial-gradient(120% 120% at 0% 0%, color-mix(in srgb, var(--color-action-primary-bg) 13%, transparent), transparent 55%)" }
|
|
671
699
|
}),
|
|
672
|
-
/* @__PURE__ */
|
|
700
|
+
/* @__PURE__ */ g("div", {
|
|
673
701
|
className: "relative flex flex-wrap items-start justify-between gap-4",
|
|
674
|
-
children: [/* @__PURE__ */
|
|
702
|
+
children: [/* @__PURE__ */ g("div", {
|
|
675
703
|
className: "min-w-0",
|
|
676
704
|
children: [
|
|
677
|
-
/* @__PURE__ */
|
|
705
|
+
/* @__PURE__ */ h("p", {
|
|
678
706
|
className: "text-xs font-semibold uppercase tracking-wide text-action-primary-bg",
|
|
679
|
-
children:
|
|
707
|
+
children: Y.isActive ? "Active plan" : "Nutrition plan"
|
|
680
708
|
}),
|
|
681
|
-
/* @__PURE__ */
|
|
709
|
+
/* @__PURE__ */ g("div", {
|
|
682
710
|
className: "mt-1.5 flex flex-wrap items-baseline gap-x-2 gap-y-1",
|
|
683
711
|
children: [
|
|
684
|
-
/* @__PURE__ */
|
|
712
|
+
/* @__PURE__ */ h("h2", {
|
|
685
713
|
className: "text-2xl font-bold text-text-primary",
|
|
686
|
-
children:
|
|
714
|
+
children: Y.name
|
|
687
715
|
}),
|
|
688
|
-
|
|
716
|
+
Y.calorieTarget > 0 && /* @__PURE__ */ g("span", {
|
|
689
717
|
className: "text-lg font-semibold tabular-nums text-text-tertiary",
|
|
690
|
-
children: [i(
|
|
718
|
+
children: [i(Y.calorieTarget), " kcal"]
|
|
691
719
|
}),
|
|
692
|
-
|
|
720
|
+
Y.isActive ? /* @__PURE__ */ g("span", {
|
|
693
721
|
className: "inline-flex items-center gap-1 rounded-full bg-status-success-bg-subtle px-2.5 py-0.5 text-xs font-medium text-status-success-text",
|
|
694
|
-
children: [/* @__PURE__ */
|
|
695
|
-
}) : /* @__PURE__ */
|
|
722
|
+
children: [/* @__PURE__ */ h(Te, { className: "h-3.5 w-3.5" }), " Active"]
|
|
723
|
+
}) : /* @__PURE__ */ h("span", {
|
|
696
724
|
className: "inline-flex items-center gap-1 rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary",
|
|
697
725
|
children: "Inactive"
|
|
698
726
|
})
|
|
699
727
|
]
|
|
700
728
|
}),
|
|
701
|
-
(
|
|
729
|
+
(Y.startDate || Y.endDate) && /* @__PURE__ */ g("p", {
|
|
702
730
|
className: "mt-2 inline-flex items-center gap-1.5 text-sm text-text-secondary",
|
|
703
731
|
children: [
|
|
704
|
-
/* @__PURE__ */
|
|
705
|
-
t(
|
|
732
|
+
/* @__PURE__ */ h(we, { className: "h-4 w-4 text-text-tertiary" }),
|
|
733
|
+
t(Y.startDate),
|
|
706
734
|
" – ",
|
|
707
|
-
t(
|
|
735
|
+
t(Y.endDate)
|
|
708
736
|
]
|
|
709
737
|
})
|
|
710
738
|
]
|
|
711
|
-
}), /* @__PURE__ */
|
|
739
|
+
}), /* @__PURE__ */ g("div", {
|
|
712
740
|
className: "flex shrink-0 items-center gap-2",
|
|
713
|
-
children: [/* @__PURE__ */
|
|
741
|
+
children: [/* @__PURE__ */ h("span", {
|
|
714
742
|
className: "text-sm text-text-tertiary",
|
|
715
743
|
children: "Goal"
|
|
716
|
-
}), /* @__PURE__ */
|
|
744
|
+
}), /* @__PURE__ */ h(te, { status: Y.goalType })]
|
|
717
745
|
})]
|
|
718
746
|
}),
|
|
719
|
-
/* @__PURE__ */
|
|
747
|
+
/* @__PURE__ */ h(u.div, {
|
|
720
748
|
variants: Q,
|
|
721
749
|
className: "relative mt-6 grid grid-cols-2 gap-3 sm:gap-4 lg:grid-cols-4",
|
|
722
|
-
children: e.map((e) => /* @__PURE__ */
|
|
750
|
+
children: e.map((e) => /* @__PURE__ */ g(u.div, {
|
|
723
751
|
variants: $,
|
|
724
752
|
className: "rounded-2xl border border-border-seam bg-bg-sunken/40 p-4 transition-shadow duration-200 hover:shadow-elevation-2",
|
|
725
753
|
children: [
|
|
726
|
-
/* @__PURE__ */
|
|
754
|
+
/* @__PURE__ */ h(ve, {
|
|
727
755
|
icon: e.icon,
|
|
728
756
|
tint: e.tint
|
|
729
757
|
}),
|
|
730
|
-
/* @__PURE__ */
|
|
758
|
+
/* @__PURE__ */ h("p", {
|
|
731
759
|
className: "mt-3 text-xs text-text-tertiary",
|
|
732
760
|
children: e.label
|
|
733
761
|
}),
|
|
734
|
-
/* @__PURE__ */
|
|
762
|
+
/* @__PURE__ */ h("p", {
|
|
735
763
|
className: "mt-1 text-xl font-bold tabular-nums text-text-primary",
|
|
736
764
|
children: e.value
|
|
737
765
|
})
|
|
@@ -741,16 +769,16 @@ function D() {
|
|
|
741
769
|
]
|
|
742
770
|
})
|
|
743
771
|
}),
|
|
744
|
-
|
|
772
|
+
Y.notes && /* @__PURE__ */ h(u.div, {
|
|
745
773
|
variants: $,
|
|
746
|
-
children: /* @__PURE__ */
|
|
774
|
+
children: /* @__PURE__ */ h(ne, {
|
|
747
775
|
title: "Notes",
|
|
748
|
-
children: /* @__PURE__ */
|
|
776
|
+
children: /* @__PURE__ */ h(v, {
|
|
749
777
|
treatment: "plain",
|
|
750
778
|
className: "p-4",
|
|
751
|
-
children: /* @__PURE__ */
|
|
779
|
+
children: /* @__PURE__ */ h("p", {
|
|
752
780
|
className: "whitespace-pre-wrap text-sm text-text-secondary",
|
|
753
|
-
children:
|
|
781
|
+
children: Y.notes
|
|
754
782
|
})
|
|
755
783
|
})
|
|
756
784
|
})
|
|
@@ -758,190 +786,261 @@ function D() {
|
|
|
758
786
|
]
|
|
759
787
|
});
|
|
760
788
|
})(),
|
|
761
|
-
|
|
789
|
+
T === "meals" && (M.isLoading ? /* @__PURE__ */ h(c, { label: "Loading meal log…" }) : M.isError ? /* @__PURE__ */ h(s, {
|
|
762
790
|
message: "We couldn't load your meal log.",
|
|
763
|
-
onRetry: () =>
|
|
764
|
-
}) : /* @__PURE__ */
|
|
791
|
+
onRetry: () => M.refetch()
|
|
792
|
+
}) : /* @__PURE__ */ g(u.div, {
|
|
765
793
|
initial: "hidden",
|
|
766
794
|
animate: "show",
|
|
767
795
|
variants: Q,
|
|
768
796
|
className: "space-y-4",
|
|
769
|
-
children: [/* @__PURE__ */
|
|
797
|
+
children: [/* @__PURE__ */ h(u.div, {
|
|
770
798
|
variants: $,
|
|
771
|
-
children: /* @__PURE__ */
|
|
772
|
-
options:
|
|
773
|
-
value:
|
|
774
|
-
onChange:
|
|
799
|
+
children: /* @__PURE__ */ h(l, {
|
|
800
|
+
options: Ze,
|
|
801
|
+
value: A,
|
|
802
|
+
onChange: wt
|
|
775
803
|
})
|
|
776
|
-
}),
|
|
804
|
+
}), Ct.length === 0 ? /* @__PURE__ */ h(u.div, {
|
|
777
805
|
variants: $,
|
|
778
|
-
children: /* @__PURE__ */
|
|
806
|
+
children: /* @__PURE__ */ h(o, {
|
|
779
807
|
illustration: "empty-data",
|
|
780
|
-
icon: /* @__PURE__ */
|
|
781
|
-
title:
|
|
782
|
-
description:
|
|
783
|
-
action: /* @__PURE__ */
|
|
808
|
+
icon: /* @__PURE__ */ h(Me, { className: "h-10 w-10" }),
|
|
809
|
+
title: A === "ALL" ? "No meals logged yet" : "No meals for this filter",
|
|
810
|
+
description: A === "ALL" ? "Log meals from the Today tab to build up your nutrition history." : "Try a different meal type, or log a meal to get started.",
|
|
811
|
+
action: /* @__PURE__ */ g(_, {
|
|
784
812
|
onClick: Z,
|
|
785
|
-
children: [/* @__PURE__ */
|
|
813
|
+
children: [/* @__PURE__ */ h(p, { className: "mr-1.5 h-4 w-4" }), " Log meal"]
|
|
786
814
|
})
|
|
787
815
|
})
|
|
788
|
-
}) : /* @__PURE__ */
|
|
816
|
+
}) : /* @__PURE__ */ g(Pe, { children: [/* @__PURE__ */ h(u.div, {
|
|
789
817
|
variants: $,
|
|
790
|
-
children: /* @__PURE__ */
|
|
791
|
-
columns:
|
|
792
|
-
rows:
|
|
818
|
+
children: /* @__PURE__ */ h(re, {
|
|
819
|
+
columns: Mt,
|
|
820
|
+
rows: Ct,
|
|
793
821
|
rowKey: (e) => e.id,
|
|
794
822
|
defaultSort: {
|
|
795
823
|
key: "loggedAt",
|
|
796
824
|
dir: "desc"
|
|
797
825
|
}
|
|
798
826
|
})
|
|
799
|
-
}), /* @__PURE__ */
|
|
827
|
+
}), /* @__PURE__ */ h(u.div, {
|
|
800
828
|
variants: $,
|
|
801
|
-
children: /* @__PURE__ */
|
|
802
|
-
page:
|
|
803
|
-
pageSize:
|
|
804
|
-
itemCount:
|
|
805
|
-
hasMore:
|
|
806
|
-
onPageChange: (e) =>
|
|
829
|
+
children: /* @__PURE__ */ h(ae, {
|
|
830
|
+
page: j.page,
|
|
831
|
+
pageSize: x,
|
|
832
|
+
itemCount: Ct.length,
|
|
833
|
+
hasMore: M.data?.pageInfo?.hasMore ?? !1,
|
|
834
|
+
onPageChange: (e) => j.onPageChange(e)
|
|
807
835
|
})
|
|
808
836
|
})] })]
|
|
809
837
|
})),
|
|
810
|
-
/* @__PURE__ */
|
|
811
|
-
open:
|
|
812
|
-
onOpenChange:
|
|
813
|
-
children: /* @__PURE__ */
|
|
838
|
+
/* @__PURE__ */ h(Fe, {
|
|
839
|
+
open: ut,
|
|
840
|
+
onOpenChange: L,
|
|
841
|
+
children: /* @__PURE__ */ g(Ie, {
|
|
814
842
|
className: "sm:max-w-lg",
|
|
815
843
|
children: [
|
|
816
|
-
/* @__PURE__ */
|
|
817
|
-
/* @__PURE__ */
|
|
844
|
+
/* @__PURE__ */ g(ze, { children: [/* @__PURE__ */ h(Be, { children: "Log a meal" }), /* @__PURE__ */ h(Le, { children: "Record what you ate to update today's macros." })] }),
|
|
845
|
+
/* @__PURE__ */ g("div", {
|
|
818
846
|
className: "space-y-4 py-2",
|
|
819
847
|
children: [
|
|
820
|
-
|
|
848
|
+
dt && /* @__PURE__ */ h("div", {
|
|
821
849
|
className: "rounded-lg border border-status-error-text/40 bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
|
|
822
|
-
children:
|
|
850
|
+
children: dt
|
|
851
|
+
}),
|
|
852
|
+
/* @__PURE__ */ g("div", {
|
|
853
|
+
className: "space-y-2 rounded-xl border border-seam bg-surface p-3",
|
|
854
|
+
children: [
|
|
855
|
+
/* @__PURE__ */ h(b, {
|
|
856
|
+
htmlFor: "meal-food-search",
|
|
857
|
+
children: "Quick-log from food database"
|
|
858
|
+
}),
|
|
859
|
+
/* @__PURE__ */ h(y, {
|
|
860
|
+
id: "meal-food-search",
|
|
861
|
+
value: V,
|
|
862
|
+
onChange: (e) => ft(e.target.value),
|
|
863
|
+
placeholder: "Search foods (e.g. grilled chicken)"
|
|
864
|
+
}),
|
|
865
|
+
H.isFetching && /* @__PURE__ */ h("p", {
|
|
866
|
+
className: "text-xs text-text-tertiary",
|
|
867
|
+
children: "Searching…"
|
|
868
|
+
}),
|
|
869
|
+
!H.isFetching && V.trim().length >= 2 && (H.data?.length ?? 0) === 0 && /* @__PURE__ */ h("p", {
|
|
870
|
+
className: "text-xs text-text-tertiary",
|
|
871
|
+
children: "No matches found."
|
|
872
|
+
}),
|
|
873
|
+
(H.data?.length ?? 0) > 0 && /* @__PURE__ */ h("ul", {
|
|
874
|
+
className: "max-h-40 space-y-1 overflow-y-auto",
|
|
875
|
+
children: H.data.map((e, t) => /* @__PURE__ */ h("li", { children: /* @__PURE__ */ g("button", {
|
|
876
|
+
type: "button",
|
|
877
|
+
onClick: () => _t(e),
|
|
878
|
+
className: "flex w-full items-center justify-between rounded-lg px-2 py-1.5 text-left text-sm hover:bg-surface-hover",
|
|
879
|
+
children: [/* @__PURE__ */ g("span", {
|
|
880
|
+
className: "truncate",
|
|
881
|
+
children: [e.name, e.brand ? /* @__PURE__ */ g("span", {
|
|
882
|
+
className: "text-text-tertiary",
|
|
883
|
+
children: [" · ", e.brand]
|
|
884
|
+
}) : null]
|
|
885
|
+
}), /* @__PURE__ */ g("span", {
|
|
886
|
+
className: "ml-2 shrink-0 text-xs text-text-tertiary",
|
|
887
|
+
children: [
|
|
888
|
+
e.calories,
|
|
889
|
+
" kcal / ",
|
|
890
|
+
e.servingG,
|
|
891
|
+
"g"
|
|
892
|
+
]
|
|
893
|
+
})]
|
|
894
|
+
}) }, `${e.barcode ?? e.name}-${t}`))
|
|
895
|
+
}),
|
|
896
|
+
/* @__PURE__ */ g("div", {
|
|
897
|
+
className: "flex items-end gap-2 pt-1",
|
|
898
|
+
children: [/* @__PURE__ */ g("div", {
|
|
899
|
+
className: "flex-1 space-y-1.5",
|
|
900
|
+
children: [/* @__PURE__ */ h(b, {
|
|
901
|
+
htmlFor: "meal-barcode",
|
|
902
|
+
children: "Or scan/enter a barcode"
|
|
903
|
+
}), /* @__PURE__ */ h(y, {
|
|
904
|
+
id: "meal-barcode",
|
|
905
|
+
value: pt,
|
|
906
|
+
onChange: (e) => mt(e.target.value),
|
|
907
|
+
placeholder: "e.g. 3017620422003"
|
|
908
|
+
})]
|
|
909
|
+
}), /* @__PURE__ */ h(_, {
|
|
910
|
+
type: "button",
|
|
911
|
+
variant: "outline",
|
|
912
|
+
onClick: vt,
|
|
913
|
+
disabled: gt.isPending || !pt.trim(),
|
|
914
|
+
children: gt.isPending ? "Looking up…" : "Look up"
|
|
915
|
+
})]
|
|
916
|
+
}),
|
|
917
|
+
ht && /* @__PURE__ */ h("p", {
|
|
918
|
+
className: "text-xs text-status-error-text",
|
|
919
|
+
children: ht
|
|
920
|
+
})
|
|
921
|
+
]
|
|
823
922
|
}),
|
|
824
|
-
/* @__PURE__ */
|
|
923
|
+
/* @__PURE__ */ g("div", {
|
|
825
924
|
className: "space-y-1.5",
|
|
826
|
-
children: [/* @__PURE__ */
|
|
925
|
+
children: [/* @__PURE__ */ h(b, {
|
|
827
926
|
htmlFor: "meal-name",
|
|
828
927
|
children: "Name"
|
|
829
|
-
}), /* @__PURE__ */
|
|
928
|
+
}), /* @__PURE__ */ h(y, {
|
|
830
929
|
id: "meal-name",
|
|
831
|
-
value:
|
|
832
|
-
onChange: (e) =>
|
|
833
|
-
...
|
|
930
|
+
value: R.name,
|
|
931
|
+
onChange: (e) => z({
|
|
932
|
+
...R,
|
|
834
933
|
name: e.target.value
|
|
835
934
|
}),
|
|
836
935
|
placeholder: "Grilled chicken salad"
|
|
837
936
|
})]
|
|
838
937
|
}),
|
|
839
|
-
/* @__PURE__ */
|
|
938
|
+
/* @__PURE__ */ g("div", {
|
|
840
939
|
className: "grid grid-cols-2 gap-3",
|
|
841
|
-
children: [/* @__PURE__ */
|
|
940
|
+
children: [/* @__PURE__ */ g("div", {
|
|
842
941
|
className: "space-y-1.5",
|
|
843
|
-
children: [/* @__PURE__ */
|
|
942
|
+
children: [/* @__PURE__ */ h(b, {
|
|
844
943
|
htmlFor: "meal-type",
|
|
845
944
|
children: "Meal type"
|
|
846
|
-
}), /* @__PURE__ */
|
|
847
|
-
value:
|
|
848
|
-
onValueChange: (e) =>
|
|
849
|
-
...
|
|
945
|
+
}), /* @__PURE__ */ g(Ve, {
|
|
946
|
+
value: R.mealType,
|
|
947
|
+
onValueChange: (e) => z({
|
|
948
|
+
...R,
|
|
850
949
|
mealType: e
|
|
851
950
|
}),
|
|
852
|
-
children: [/* @__PURE__ */
|
|
951
|
+
children: [/* @__PURE__ */ h(We, {
|
|
853
952
|
id: "meal-type",
|
|
854
|
-
children: /* @__PURE__ */
|
|
855
|
-
}), /* @__PURE__ */
|
|
953
|
+
children: /* @__PURE__ */ h(Ge, {})
|
|
954
|
+
}), /* @__PURE__ */ h(He, { children: Je.map((e) => /* @__PURE__ */ h(Ue, {
|
|
856
955
|
value: e,
|
|
857
956
|
children: n(e)
|
|
858
957
|
}, e)) })]
|
|
859
958
|
})]
|
|
860
|
-
}), /* @__PURE__ */
|
|
959
|
+
}), /* @__PURE__ */ g("div", {
|
|
861
960
|
className: "space-y-1.5",
|
|
862
|
-
children: [/* @__PURE__ */
|
|
961
|
+
children: [/* @__PURE__ */ h(b, {
|
|
863
962
|
htmlFor: "meal-servings",
|
|
864
963
|
children: "Servings"
|
|
865
|
-
}), /* @__PURE__ */
|
|
964
|
+
}), /* @__PURE__ */ h(y, {
|
|
866
965
|
id: "meal-servings",
|
|
867
966
|
type: "number",
|
|
868
967
|
min: 0,
|
|
869
968
|
step: "0.5",
|
|
870
|
-
value:
|
|
871
|
-
onChange: (e) =>
|
|
872
|
-
...
|
|
969
|
+
value: R.servings,
|
|
970
|
+
onChange: (e) => z({
|
|
971
|
+
...R,
|
|
873
972
|
servings: e.target.value
|
|
874
973
|
}),
|
|
875
974
|
placeholder: "1"
|
|
876
975
|
})]
|
|
877
976
|
})]
|
|
878
977
|
}),
|
|
879
|
-
/* @__PURE__ */
|
|
978
|
+
/* @__PURE__ */ g("div", {
|
|
880
979
|
className: "grid grid-cols-2 gap-3",
|
|
881
980
|
children: [
|
|
882
|
-
/* @__PURE__ */
|
|
981
|
+
/* @__PURE__ */ g("div", {
|
|
883
982
|
className: "space-y-1.5",
|
|
884
|
-
children: [/* @__PURE__ */
|
|
983
|
+
children: [/* @__PURE__ */ h(b, {
|
|
885
984
|
htmlFor: "meal-calories",
|
|
886
985
|
children: "Calories (kcal)"
|
|
887
|
-
}), /* @__PURE__ */
|
|
986
|
+
}), /* @__PURE__ */ h(y, {
|
|
888
987
|
id: "meal-calories",
|
|
889
988
|
type: "number",
|
|
890
989
|
min: 0,
|
|
891
|
-
value:
|
|
892
|
-
onChange: (e) =>
|
|
893
|
-
...
|
|
990
|
+
value: R.calories,
|
|
991
|
+
onChange: (e) => z({
|
|
992
|
+
...R,
|
|
894
993
|
calories: e.target.value
|
|
895
994
|
}),
|
|
896
995
|
placeholder: "0"
|
|
897
996
|
})]
|
|
898
997
|
}),
|
|
899
|
-
/* @__PURE__ */
|
|
998
|
+
/* @__PURE__ */ g("div", {
|
|
900
999
|
className: "space-y-1.5",
|
|
901
|
-
children: [/* @__PURE__ */
|
|
1000
|
+
children: [/* @__PURE__ */ h(b, {
|
|
902
1001
|
htmlFor: "meal-protein",
|
|
903
1002
|
children: "Protein (g)"
|
|
904
|
-
}), /* @__PURE__ */
|
|
1003
|
+
}), /* @__PURE__ */ h(y, {
|
|
905
1004
|
id: "meal-protein",
|
|
906
1005
|
type: "number",
|
|
907
1006
|
min: 0,
|
|
908
|
-
value:
|
|
909
|
-
onChange: (e) =>
|
|
910
|
-
...
|
|
1007
|
+
value: R.proteinG,
|
|
1008
|
+
onChange: (e) => z({
|
|
1009
|
+
...R,
|
|
911
1010
|
proteinG: e.target.value
|
|
912
1011
|
}),
|
|
913
1012
|
placeholder: "0"
|
|
914
1013
|
})]
|
|
915
1014
|
}),
|
|
916
|
-
/* @__PURE__ */
|
|
1015
|
+
/* @__PURE__ */ g("div", {
|
|
917
1016
|
className: "space-y-1.5",
|
|
918
|
-
children: [/* @__PURE__ */
|
|
1017
|
+
children: [/* @__PURE__ */ h(b, {
|
|
919
1018
|
htmlFor: "meal-carbs",
|
|
920
1019
|
children: "Carbs (g)"
|
|
921
|
-
}), /* @__PURE__ */
|
|
1020
|
+
}), /* @__PURE__ */ h(y, {
|
|
922
1021
|
id: "meal-carbs",
|
|
923
1022
|
type: "number",
|
|
924
1023
|
min: 0,
|
|
925
|
-
value:
|
|
926
|
-
onChange: (e) =>
|
|
927
|
-
...
|
|
1024
|
+
value: R.carbsG,
|
|
1025
|
+
onChange: (e) => z({
|
|
1026
|
+
...R,
|
|
928
1027
|
carbsG: e.target.value
|
|
929
1028
|
}),
|
|
930
1029
|
placeholder: "0"
|
|
931
1030
|
})]
|
|
932
1031
|
}),
|
|
933
|
-
/* @__PURE__ */
|
|
1032
|
+
/* @__PURE__ */ g("div", {
|
|
934
1033
|
className: "space-y-1.5",
|
|
935
|
-
children: [/* @__PURE__ */
|
|
1034
|
+
children: [/* @__PURE__ */ h(b, {
|
|
936
1035
|
htmlFor: "meal-fat",
|
|
937
1036
|
children: "Fat (g)"
|
|
938
|
-
}), /* @__PURE__ */
|
|
1037
|
+
}), /* @__PURE__ */ h(y, {
|
|
939
1038
|
id: "meal-fat",
|
|
940
1039
|
type: "number",
|
|
941
1040
|
min: 0,
|
|
942
|
-
value:
|
|
943
|
-
onChange: (e) =>
|
|
944
|
-
...
|
|
1041
|
+
value: R.fatG,
|
|
1042
|
+
onChange: (e) => z({
|
|
1043
|
+
...R,
|
|
945
1044
|
fatG: e.target.value
|
|
946
1045
|
}),
|
|
947
1046
|
placeholder: "0"
|
|
@@ -949,157 +1048,157 @@ function D() {
|
|
|
949
1048
|
})
|
|
950
1049
|
]
|
|
951
1050
|
}),
|
|
952
|
-
/* @__PURE__ */
|
|
1051
|
+
/* @__PURE__ */ g("div", {
|
|
953
1052
|
className: "flex items-center justify-between gap-4 rounded-xl bg-bg-sunken/60 p-3",
|
|
954
|
-
children: [/* @__PURE__ */
|
|
1053
|
+
children: [/* @__PURE__ */ g("div", {
|
|
955
1054
|
className: "min-w-0",
|
|
956
|
-
children: [/* @__PURE__ */
|
|
1055
|
+
children: [/* @__PURE__ */ h(b, {
|
|
957
1056
|
htmlFor: "meal-favorite",
|
|
958
1057
|
className: "cursor-pointer",
|
|
959
1058
|
children: "Favorite"
|
|
960
|
-
}), /* @__PURE__ */
|
|
1059
|
+
}), /* @__PURE__ */ h("p", {
|
|
961
1060
|
className: "text-xs text-text-tertiary",
|
|
962
1061
|
children: "Save for quick re-log"
|
|
963
1062
|
})]
|
|
964
|
-
}), /* @__PURE__ */
|
|
1063
|
+
}), /* @__PURE__ */ h(Ke, {
|
|
965
1064
|
id: "meal-favorite",
|
|
966
|
-
checked:
|
|
967
|
-
onCheckedChange: (e) =>
|
|
968
|
-
...
|
|
1065
|
+
checked: R.isFavorite,
|
|
1066
|
+
onCheckedChange: (e) => z({
|
|
1067
|
+
...R,
|
|
969
1068
|
isFavorite: e
|
|
970
1069
|
})
|
|
971
1070
|
})]
|
|
972
1071
|
})
|
|
973
1072
|
]
|
|
974
1073
|
}),
|
|
975
|
-
/* @__PURE__ */
|
|
1074
|
+
/* @__PURE__ */ g(Re, { children: [/* @__PURE__ */ h(_, {
|
|
976
1075
|
variant: "outline",
|
|
977
|
-
onClick: () =>
|
|
978
|
-
disabled:
|
|
1076
|
+
onClick: () => L(!1),
|
|
1077
|
+
disabled: N.isPending,
|
|
979
1078
|
children: "Cancel"
|
|
980
|
-
}), /* @__PURE__ */ _
|
|
981
|
-
onClick:
|
|
982
|
-
disabled:
|
|
983
|
-
children:
|
|
1079
|
+
}), /* @__PURE__ */ h(_, {
|
|
1080
|
+
onClick: Dt,
|
|
1081
|
+
disabled: N.isPending,
|
|
1082
|
+
children: N.isPending ? "Logging…" : "Log meal"
|
|
984
1083
|
})] })
|
|
985
1084
|
]
|
|
986
1085
|
})
|
|
987
1086
|
}),
|
|
988
|
-
/* @__PURE__ */
|
|
989
|
-
open:
|
|
990
|
-
onOpenChange:
|
|
991
|
-
children: /* @__PURE__ */
|
|
1087
|
+
/* @__PURE__ */ h(Fe, {
|
|
1088
|
+
open: yt,
|
|
1089
|
+
onOpenChange: W,
|
|
1090
|
+
children: /* @__PURE__ */ g(Ie, {
|
|
992
1091
|
className: "sm:max-w-lg",
|
|
993
1092
|
children: [
|
|
994
|
-
/* @__PURE__ */
|
|
995
|
-
/* @__PURE__ */
|
|
1093
|
+
/* @__PURE__ */ g(ze, { children: [/* @__PURE__ */ h(Be, { children: G === "edit" ? "Edit nutrition targets" : "Create nutrition plan" }), /* @__PURE__ */ h(Le, { children: G === "edit" ? "Update your calorie and macro targets for this plan." : "Set your daily calorie and macro targets." })] }),
|
|
1094
|
+
/* @__PURE__ */ g("div", {
|
|
996
1095
|
className: "space-y-4 py-2",
|
|
997
1096
|
children: [
|
|
998
|
-
|
|
1097
|
+
xt && /* @__PURE__ */ h("div", {
|
|
999
1098
|
className: "rounded-lg border border-status-error-text/40 bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
|
|
1000
|
-
children:
|
|
1099
|
+
children: xt
|
|
1001
1100
|
}),
|
|
1002
|
-
/* @__PURE__ */
|
|
1101
|
+
/* @__PURE__ */ g("div", {
|
|
1003
1102
|
className: "space-y-1.5",
|
|
1004
|
-
children: [/* @__PURE__ */
|
|
1103
|
+
children: [/* @__PURE__ */ h(b, {
|
|
1005
1104
|
htmlFor: "plan-name",
|
|
1006
1105
|
children: "Name"
|
|
1007
|
-
}), /* @__PURE__ */
|
|
1106
|
+
}), /* @__PURE__ */ h(y, {
|
|
1008
1107
|
id: "plan-name",
|
|
1009
|
-
value:
|
|
1010
|
-
onChange: (e) =>
|
|
1011
|
-
...
|
|
1108
|
+
value: K.name,
|
|
1109
|
+
onChange: (e) => q({
|
|
1110
|
+
...K,
|
|
1012
1111
|
name: e.target.value
|
|
1013
1112
|
}),
|
|
1014
1113
|
placeholder: "Lean bulk — Q3"
|
|
1015
1114
|
})]
|
|
1016
1115
|
}),
|
|
1017
|
-
/* @__PURE__ */
|
|
1116
|
+
/* @__PURE__ */ g("div", {
|
|
1018
1117
|
className: "space-y-1.5",
|
|
1019
|
-
children: [/* @__PURE__ */
|
|
1118
|
+
children: [/* @__PURE__ */ h(b, {
|
|
1020
1119
|
htmlFor: "plan-goal",
|
|
1021
1120
|
children: "Goal type"
|
|
1022
|
-
}), /* @__PURE__ */
|
|
1023
|
-
value:
|
|
1024
|
-
onValueChange: (e) =>
|
|
1025
|
-
...
|
|
1121
|
+
}), /* @__PURE__ */ g(Ve, {
|
|
1122
|
+
value: K.goalType,
|
|
1123
|
+
onValueChange: (e) => q({
|
|
1124
|
+
...K,
|
|
1026
1125
|
goalType: e
|
|
1027
1126
|
}),
|
|
1028
|
-
children: [/* @__PURE__ */
|
|
1127
|
+
children: [/* @__PURE__ */ h(We, {
|
|
1029
1128
|
id: "plan-goal",
|
|
1030
|
-
children: /* @__PURE__ */
|
|
1031
|
-
}), /* @__PURE__ */
|
|
1129
|
+
children: /* @__PURE__ */ h(Ge, {})
|
|
1130
|
+
}), /* @__PURE__ */ h(He, { children: Ye.map((e) => /* @__PURE__ */ h(Ue, {
|
|
1032
1131
|
value: e,
|
|
1033
1132
|
children: n(e)
|
|
1034
1133
|
}, e)) })]
|
|
1035
1134
|
})]
|
|
1036
1135
|
}),
|
|
1037
|
-
/* @__PURE__ */
|
|
1136
|
+
/* @__PURE__ */ g("div", {
|
|
1038
1137
|
className: "grid grid-cols-2 gap-3",
|
|
1039
1138
|
children: [
|
|
1040
|
-
/* @__PURE__ */
|
|
1139
|
+
/* @__PURE__ */ g("div", {
|
|
1041
1140
|
className: "space-y-1.5",
|
|
1042
|
-
children: [/* @__PURE__ */
|
|
1141
|
+
children: [/* @__PURE__ */ h(b, {
|
|
1043
1142
|
htmlFor: "plan-calories",
|
|
1044
1143
|
children: "Calorie target (kcal)"
|
|
1045
|
-
}), /* @__PURE__ */
|
|
1144
|
+
}), /* @__PURE__ */ h(y, {
|
|
1046
1145
|
id: "plan-calories",
|
|
1047
1146
|
type: "number",
|
|
1048
1147
|
min: 0,
|
|
1049
|
-
value:
|
|
1050
|
-
onChange: (e) =>
|
|
1051
|
-
...
|
|
1148
|
+
value: K.calorieTarget,
|
|
1149
|
+
onChange: (e) => q({
|
|
1150
|
+
...K,
|
|
1052
1151
|
calorieTarget: e.target.value
|
|
1053
1152
|
}),
|
|
1054
1153
|
placeholder: "2400"
|
|
1055
1154
|
})]
|
|
1056
1155
|
}),
|
|
1057
|
-
/* @__PURE__ */
|
|
1156
|
+
/* @__PURE__ */ g("div", {
|
|
1058
1157
|
className: "space-y-1.5",
|
|
1059
|
-
children: [/* @__PURE__ */
|
|
1158
|
+
children: [/* @__PURE__ */ h(b, {
|
|
1060
1159
|
htmlFor: "plan-protein",
|
|
1061
1160
|
children: "Protein target (g)"
|
|
1062
|
-
}), /* @__PURE__ */
|
|
1161
|
+
}), /* @__PURE__ */ h(y, {
|
|
1063
1162
|
id: "plan-protein",
|
|
1064
1163
|
type: "number",
|
|
1065
1164
|
min: 0,
|
|
1066
|
-
value:
|
|
1067
|
-
onChange: (e) =>
|
|
1068
|
-
...
|
|
1165
|
+
value: K.proteinTarget,
|
|
1166
|
+
onChange: (e) => q({
|
|
1167
|
+
...K,
|
|
1069
1168
|
proteinTarget: e.target.value
|
|
1070
1169
|
}),
|
|
1071
1170
|
placeholder: "180"
|
|
1072
1171
|
})]
|
|
1073
1172
|
}),
|
|
1074
|
-
/* @__PURE__ */
|
|
1173
|
+
/* @__PURE__ */ g("div", {
|
|
1075
1174
|
className: "space-y-1.5",
|
|
1076
|
-
children: [/* @__PURE__ */
|
|
1175
|
+
children: [/* @__PURE__ */ h(b, {
|
|
1077
1176
|
htmlFor: "plan-carbs",
|
|
1078
1177
|
children: "Carbs target (g)"
|
|
1079
|
-
}), /* @__PURE__ */
|
|
1178
|
+
}), /* @__PURE__ */ h(y, {
|
|
1080
1179
|
id: "plan-carbs",
|
|
1081
1180
|
type: "number",
|
|
1082
1181
|
min: 0,
|
|
1083
|
-
value:
|
|
1084
|
-
onChange: (e) =>
|
|
1085
|
-
...
|
|
1182
|
+
value: K.carbsTarget,
|
|
1183
|
+
onChange: (e) => q({
|
|
1184
|
+
...K,
|
|
1086
1185
|
carbsTarget: e.target.value
|
|
1087
1186
|
}),
|
|
1088
1187
|
placeholder: "250"
|
|
1089
1188
|
})]
|
|
1090
1189
|
}),
|
|
1091
|
-
/* @__PURE__ */
|
|
1190
|
+
/* @__PURE__ */ g("div", {
|
|
1092
1191
|
className: "space-y-1.5",
|
|
1093
|
-
children: [/* @__PURE__ */
|
|
1192
|
+
children: [/* @__PURE__ */ h(b, {
|
|
1094
1193
|
htmlFor: "plan-fat",
|
|
1095
1194
|
children: "Fat target (g)"
|
|
1096
|
-
}), /* @__PURE__ */
|
|
1195
|
+
}), /* @__PURE__ */ h(y, {
|
|
1097
1196
|
id: "plan-fat",
|
|
1098
1197
|
type: "number",
|
|
1099
1198
|
min: 0,
|
|
1100
|
-
value:
|
|
1101
|
-
onChange: (e) =>
|
|
1102
|
-
...
|
|
1199
|
+
value: K.fatTarget,
|
|
1200
|
+
onChange: (e) => q({
|
|
1201
|
+
...K,
|
|
1103
1202
|
fatTarget: e.target.value
|
|
1104
1203
|
}),
|
|
1105
1204
|
placeholder: "70"
|
|
@@ -1107,48 +1206,48 @@ function D() {
|
|
|
1107
1206
|
})
|
|
1108
1207
|
]
|
|
1109
1208
|
}),
|
|
1110
|
-
/* @__PURE__ */
|
|
1209
|
+
/* @__PURE__ */ g("div", {
|
|
1111
1210
|
className: "grid grid-cols-2 gap-3",
|
|
1112
|
-
children: [/* @__PURE__ */
|
|
1211
|
+
children: [/* @__PURE__ */ g("div", {
|
|
1113
1212
|
className: "space-y-1.5",
|
|
1114
|
-
children: [/* @__PURE__ */
|
|
1213
|
+
children: [/* @__PURE__ */ h(b, {
|
|
1115
1214
|
htmlFor: "plan-start",
|
|
1116
1215
|
children: "Start date"
|
|
1117
|
-
}), /* @__PURE__ */
|
|
1216
|
+
}), /* @__PURE__ */ h(y, {
|
|
1118
1217
|
id: "plan-start",
|
|
1119
1218
|
type: "date",
|
|
1120
|
-
value:
|
|
1121
|
-
onChange: (e) =>
|
|
1122
|
-
...
|
|
1219
|
+
value: K.startDate,
|
|
1220
|
+
onChange: (e) => q({
|
|
1221
|
+
...K,
|
|
1123
1222
|
startDate: e.target.value
|
|
1124
1223
|
})
|
|
1125
1224
|
})]
|
|
1126
|
-
}), /* @__PURE__ */
|
|
1225
|
+
}), /* @__PURE__ */ g("div", {
|
|
1127
1226
|
className: "space-y-1.5",
|
|
1128
|
-
children: [/* @__PURE__ */
|
|
1227
|
+
children: [/* @__PURE__ */ h(b, {
|
|
1129
1228
|
htmlFor: "plan-end",
|
|
1130
1229
|
children: "End date"
|
|
1131
|
-
}), /* @__PURE__ */
|
|
1230
|
+
}), /* @__PURE__ */ h(y, {
|
|
1132
1231
|
id: "plan-end",
|
|
1133
1232
|
type: "date",
|
|
1134
|
-
value:
|
|
1135
|
-
onChange: (e) =>
|
|
1136
|
-
...
|
|
1233
|
+
value: K.endDate,
|
|
1234
|
+
onChange: (e) => q({
|
|
1235
|
+
...K,
|
|
1137
1236
|
endDate: e.target.value
|
|
1138
1237
|
})
|
|
1139
1238
|
})]
|
|
1140
1239
|
})]
|
|
1141
1240
|
}),
|
|
1142
|
-
/* @__PURE__ */
|
|
1241
|
+
/* @__PURE__ */ g("div", {
|
|
1143
1242
|
className: "space-y-1.5",
|
|
1144
|
-
children: [/* @__PURE__ */
|
|
1243
|
+
children: [/* @__PURE__ */ h(b, {
|
|
1145
1244
|
htmlFor: "plan-notes",
|
|
1146
1245
|
children: "Notes"
|
|
1147
|
-
}), /* @__PURE__ */
|
|
1246
|
+
}), /* @__PURE__ */ h(qe, {
|
|
1148
1247
|
id: "plan-notes",
|
|
1149
|
-
value:
|
|
1150
|
-
onChange: (e) =>
|
|
1151
|
-
...
|
|
1248
|
+
value: K.notes,
|
|
1249
|
+
onChange: (e) => q({
|
|
1250
|
+
...K,
|
|
1152
1251
|
notes: e.target.value
|
|
1153
1252
|
}),
|
|
1154
1253
|
placeholder: "Coaching notes, refeed schedule, supplements…",
|
|
@@ -1157,15 +1256,15 @@ function D() {
|
|
|
1157
1256
|
})
|
|
1158
1257
|
]
|
|
1159
1258
|
}),
|
|
1160
|
-
/* @__PURE__ */
|
|
1259
|
+
/* @__PURE__ */ g(Re, { children: [/* @__PURE__ */ h(_, {
|
|
1161
1260
|
variant: "outline",
|
|
1162
|
-
onClick: () =>
|
|
1163
|
-
disabled:
|
|
1261
|
+
onClick: () => W(!1),
|
|
1262
|
+
disabled: jt,
|
|
1164
1263
|
children: "Cancel"
|
|
1165
|
-
}), /* @__PURE__ */ _
|
|
1166
|
-
onClick:
|
|
1167
|
-
disabled:
|
|
1168
|
-
children:
|
|
1264
|
+
}), /* @__PURE__ */ h(_, {
|
|
1265
|
+
onClick: Ot,
|
|
1266
|
+
disabled: jt,
|
|
1267
|
+
children: jt ? "Saving…" : G === "edit" ? "Save targets" : "Create plan"
|
|
1169
1268
|
})] })
|
|
1170
1269
|
]
|
|
1171
1270
|
})
|
|
@@ -1174,6 +1273,6 @@ function D() {
|
|
|
1174
1273
|
});
|
|
1175
1274
|
}
|
|
1176
1275
|
//#endregion
|
|
1177
|
-
export {
|
|
1276
|
+
export { T as NutritionPage };
|
|
1178
1277
|
|
|
1179
1278
|
//# sourceMappingURL=NutritionPage.js.map
|