@burdenoff/microfe-healthybowl 2026.629.2 → 2026.629.4
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/components/assistant/AIAssistantPanel.js +6 -6
- package/dist/components/assistant/AssistantApiCallsConsentDialog.js +4 -4
- package/dist/components/assistant/AssistantChatArea.js +45 -45
- package/dist/components/assistant/AssistantMessageItem.js +5 -5
- package/dist/healthybowl/components/GetHelpButton.js +20 -0
- package/dist/healthybowl/components/GetHelpButton.js.map +1 -0
- package/dist/healthybowl/components/PageLayout.js +31 -30
- package/dist/healthybowl/components/PageLayout.js.map +1 -1
- package/dist/healthybowl/pages/crops/CropsPage.js +119 -118
- package/dist/healthybowl/pages/crops/CropsPage.js.map +1 -1
- package/dist/index.js +5 -5
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useAssistantStore as e } from "../../store/assistantStore.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { useTr as t } from "../../shared/hooks/useTr.js";
|
|
3
|
+
import { useAssistantKeyboardShortcuts as n } from "../../hooks/useAssistantKeyboardShortcuts.js";
|
|
4
|
+
import { useAssistantHeartbeat as r } from "../../hooks/useAssistantHeartbeat.js";
|
|
5
5
|
import { AssistantChatArea as i } from "./AssistantChatArea.js";
|
|
6
6
|
import { AssistantConversationList as a } from "./AssistantConversationList.js";
|
|
7
7
|
import { AssistantExportMenu as o } from "./AssistantExportMenu.js";
|
|
@@ -10,10 +10,10 @@ import { Eraser as c, MessageSquare as l, X as u } from "lucide-react";
|
|
|
10
10
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
11
11
|
//#region src/components/assistant/AIAssistantPanel.tsx
|
|
12
12
|
var p = ({ onClose: p, visible: m }) => {
|
|
13
|
-
let h =
|
|
14
|
-
|
|
13
|
+
let h = t(), g = s(null), { conversations: _, activeConversationId: v, conversationListOpen: y, toggleConversationList: b, clearConversation: x } = e(), S = _.find((e) => e.id === v);
|
|
14
|
+
r(S?.backendSessionId ?? null, S?.mode ?? null, m ?? !0);
|
|
15
15
|
let C = (S?.messages.length ?? 0) > 0;
|
|
16
|
-
return
|
|
16
|
+
return n({
|
|
17
17
|
panelRef: g,
|
|
18
18
|
onClose: p
|
|
19
19
|
}), /* @__PURE__ */ f("div", {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useTr as e } from "../../shared/hooks/useTr.js";
|
|
2
|
+
import { Modal as t } from "../../healthybowl/components/Modal.js";
|
|
3
3
|
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
4
|
import { Button as a } from "@burdenoff/fe-libs/ui";
|
|
5
5
|
//#region src/components/assistant/AssistantApiCallsConsentDialog.tsx
|
|
6
6
|
var o = ({ open: o, onConfirm: s, onCancel: c }) => {
|
|
7
|
-
let l =
|
|
8
|
-
return /* @__PURE__ */ r(
|
|
7
|
+
let l = e();
|
|
8
|
+
return /* @__PURE__ */ r(t, {
|
|
9
9
|
open: o,
|
|
10
10
|
onClose: c,
|
|
11
11
|
size: "sm",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useAssistantStore as e } from "../../store/assistantStore.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useTr as t } from "../../shared/hooks/useTr.js";
|
|
3
|
+
import { checkAssistantAiCredits as n, createAssistantSandbox as r, createAssistantSession as i, extendAssistantSandboxTTL as a, findExistingSandbox as o, getAssistantArtifacts as s, getAssistantMessages as c, getAssistantSession as l, reportAssistantAiTokenUsage as u, sendAssistantPromptAsync as d, waitForAssistantServiceReady as f, waitForSandboxReady as p } from "../../services/assistantApi.js";
|
|
4
4
|
import { AssistantChatInput as m } from "./AssistantChatInput.js";
|
|
5
5
|
import { AssistantMessageList as h } from "./AssistantMessageList.js";
|
|
6
6
|
import { ASSISTANT_MODES as g } from "../../types/assistant.js";
|
|
@@ -95,7 +95,7 @@ function ye(e) {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
var O = () => {
|
|
98
|
-
let w =
|
|
98
|
+
let w = t(), T = ue("workspace"), { getAccessToken: E, getWorkspaceToken: D, userId: O } = de(), { conversations: k, activeConversationId: A, mode: j, processingByConversationId: M, setMode: N, setConversationMode: P, setActiveConversation: F, createConversation: I, addMessage: L, updateMessage: R, patchMessage: z, setConversationProcessing: B, clearConversationProcessing: be, setBackendSessionId: V, clearBackendSessionId: H, setSandbox: U, clearSandbox: W, acknowledgeApiCalls: xe } = e(), Se = k.find((e) => e.id === A)?.messages ?? [], G = A ? M[A] : void 0, Ce = G?.messageId ?? null, we = G?.status === "provisioning" || G?.status === "connecting" || G?.status === "streaming", { canUseApiCalls: K, loading: Te } = te(he()), Ee = se(() => g.filter((e) => !e.requiresAdmin || K), [K]), [q, J] = le(null);
|
|
99
99
|
b(() => {
|
|
100
100
|
if (Te) return;
|
|
101
101
|
let e = g.find((e) => e.id === j);
|
|
@@ -108,27 +108,27 @@ var O = () => {
|
|
|
108
108
|
]);
|
|
109
109
|
let Y = y((e, t, n, r) => {
|
|
110
110
|
B(e, n, t, null), r ? R(e, t, r) : R(e, t, ye(n));
|
|
111
|
-
}, [B, R]), X = y(async (t,
|
|
112
|
-
let u = e.getState().sandboxesByMode[
|
|
111
|
+
}, [B, R]), X = y(async (t, n, a, s, c) => {
|
|
112
|
+
let u = e.getState().sandboxesByMode[a]?.sandboxId ?? null;
|
|
113
113
|
if (!u) {
|
|
114
|
-
Y(t,
|
|
115
|
-
let e = await
|
|
116
|
-
if (e) u = e, U(
|
|
114
|
+
Y(t, n, "provisioning", "Looking for existing environment...");
|
|
115
|
+
let e = await o(T, s, a, c);
|
|
116
|
+
if (e) u = e, U(a, u, "provisioning"), Y(t, n, "provisioning", "Reusing assistant environment..."), await p(T, u, s, c, 3e5, (e) => Y(t, n, "provisioning", e)), await f(T, u, s, c, 9e4, (e) => Y(t, n, "connecting", e)), U(a, u, "running");
|
|
117
117
|
else {
|
|
118
|
-
if (
|
|
119
|
-
Y(t,
|
|
118
|
+
if (a === "api-calls" && !E()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
|
|
119
|
+
Y(t, n, "provisioning", "Starting assistant environment..."), U(a, null, "provisioning"), u = await r(T, a, s, c), U(a, u, "provisioning"), await p(T, u, s, c, 3e5, (e) => Y(t, n, "provisioning", e)), await f(T, u, s, c, 9e4, (e) => Y(t, n, "connecting", e)), U(a, u, "running");
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
let
|
|
123
|
-
if (
|
|
124
|
-
let e = await
|
|
125
|
-
if (e.mode !==
|
|
122
|
+
let d = e.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null;
|
|
123
|
+
if (d) try {
|
|
124
|
+
let e = await l(T, u, s, d, c);
|
|
125
|
+
if (e.mode !== a) throw Error(`Session mode mismatch: expected ${a}, received ${e.mode}`);
|
|
126
126
|
} catch {
|
|
127
|
-
H(t),
|
|
127
|
+
H(t), d = null;
|
|
128
128
|
}
|
|
129
|
-
return
|
|
129
|
+
return d || (Y(t, n, "connecting", "Preparing session..."), d = (await i(T, u, s, a, c)).sessionId, V(t, d)), {
|
|
130
130
|
sandboxId: u,
|
|
131
|
-
sessionId:
|
|
131
|
+
sessionId: d
|
|
132
132
|
};
|
|
133
133
|
}, [
|
|
134
134
|
T,
|
|
@@ -137,14 +137,14 @@ var O = () => {
|
|
|
137
137
|
V,
|
|
138
138
|
U,
|
|
139
139
|
Y
|
|
140
|
-
]), Z = y(async (
|
|
140
|
+
]), Z = y(async (t) => {
|
|
141
141
|
if (A) {
|
|
142
142
|
let e = M[A]?.status;
|
|
143
143
|
if (e === "provisioning" || e === "connecting" || e === "streaming") return;
|
|
144
144
|
}
|
|
145
|
-
let r = e.getState().mode,
|
|
146
|
-
if (
|
|
147
|
-
let
|
|
145
|
+
let r = e.getState().mode, i = A, o = i ? e.getState().conversations.find((e) => e.id === i) : void 0;
|
|
146
|
+
if (i ? o && o.mode !== r && (o.messages.length > 0 || o.backendSessionId) ? i = I(void 0, r) : o && o.mode !== r && P(i, r) : i = I(void 0, r), !i) return;
|
|
147
|
+
let l = me(), f = {
|
|
148
148
|
accessToken: E(),
|
|
149
149
|
workspaceToken: D(),
|
|
150
150
|
userId: O,
|
|
@@ -152,71 +152,71 @@ var O = () => {
|
|
|
152
152
|
}, p = {
|
|
153
153
|
id: C(),
|
|
154
154
|
role: "user",
|
|
155
|
-
content:
|
|
155
|
+
content: t,
|
|
156
156
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
157
157
|
};
|
|
158
|
-
L(
|
|
158
|
+
L(i, p);
|
|
159
159
|
let m = C();
|
|
160
|
-
L(
|
|
160
|
+
L(i, {
|
|
161
161
|
id: m,
|
|
162
162
|
role: "assistant",
|
|
163
163
|
content: "",
|
|
164
164
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
165
165
|
});
|
|
166
|
-
let h = (e, t, n,
|
|
167
|
-
z(
|
|
166
|
+
let h = (e, t, n, a) => {
|
|
167
|
+
z(i, m, {
|
|
168
168
|
content: _e(e),
|
|
169
|
-
metadata: t?.length || n ||
|
|
169
|
+
metadata: t?.length || n || a ? {
|
|
170
170
|
artifacts: t,
|
|
171
171
|
mode: r,
|
|
172
172
|
sessionId: n,
|
|
173
|
-
sandboxId:
|
|
173
|
+
sandboxId: a
|
|
174
174
|
} : void 0
|
|
175
175
|
});
|
|
176
176
|
}, g = async (e = 1) => {
|
|
177
177
|
try {
|
|
178
|
-
await
|
|
178
|
+
await n(T, l, f);
|
|
179
179
|
} catch (e) {
|
|
180
180
|
if (re(e)) {
|
|
181
|
-
ie("ai-credits"), h("You've run out of AI credits for this billing cycle. Upgrade your plan to keep chatting."), B(
|
|
181
|
+
ie("ai-credits"), h("You've run out of AI credits for this billing cycle. Upgrade your plan to keep chatting."), B(i, "error", m, null);
|
|
182
182
|
return;
|
|
183
183
|
}
|
|
184
184
|
console.warn("[assistant] AI-credit pre-flight check failed with a non-quota error; proceeding — gateway @usage(checkQuota) still enforces the real budget downstream", e);
|
|
185
185
|
}
|
|
186
186
|
try {
|
|
187
|
-
let { sandboxId: e, sessionId:
|
|
188
|
-
Y(
|
|
189
|
-
let
|
|
190
|
-
await
|
|
191
|
-
let p = ve([],
|
|
192
|
-
for (; Date.now() < g && (p = ve(await
|
|
187
|
+
let { sandboxId: e, sessionId: n } = await X(i, m, r, l, f);
|
|
188
|
+
Y(i, m, "streaming", "Thinking...");
|
|
189
|
+
let o = Date.now();
|
|
190
|
+
await d(T, e, l, n, oe(r, t), r, ne(), f);
|
|
191
|
+
let p = ve([], o), g = Date.now() + (fe[r] ?? pe), _ = Date.now();
|
|
192
|
+
for (; Date.now() < g && (p = ve(await c(T, e, l, n, f, 50), o), z(i, m, { content: _e(p.content) }), !p.done);) Date.now() - _ > 3e4 && (await a(T, e, l, 600, f).catch(() => void 0), _ = Date.now()), await new Promise((e) => setTimeout(e, 1500));
|
|
193
193
|
if (!p.done && r !== "vibe-plugins") throw Error("Assistant response timed out while streaming progress");
|
|
194
|
-
let v = r === "vibe-plugins" ? await
|
|
194
|
+
let v = r === "vibe-plugins" ? await s(T, e, l, n, f).catch(() => []) : void 0;
|
|
195
195
|
if (p.done || (p = {
|
|
196
196
|
...p,
|
|
197
197
|
content: `${p.content}\n\n_Still building in the background — any artifacts below will finish shortly. Re-open this conversation to pick up the completed plugin._`
|
|
198
|
-
}), h(p.content, v,
|
|
199
|
-
z(
|
|
198
|
+
}), h(p.content, v, n, e), p.tokens) {
|
|
199
|
+
z(i, m, { tokens: p.tokens });
|
|
200
200
|
try {
|
|
201
|
-
await
|
|
201
|
+
await u(T, l, n, p.tokens, f), ae();
|
|
202
202
|
} catch {}
|
|
203
203
|
}
|
|
204
|
-
B(
|
|
204
|
+
B(i, "complete", m, null);
|
|
205
205
|
} catch (t) {
|
|
206
|
-
if (e === 1 && ge(t)) return H(
|
|
206
|
+
if (e === 1 && ge(t)) return H(i), W(r), g(2);
|
|
207
207
|
throw t;
|
|
208
208
|
}
|
|
209
209
|
};
|
|
210
210
|
try {
|
|
211
|
-
if (!
|
|
211
|
+
if (!l) throw Error("Assistant backend is unavailable without an active workspace context.");
|
|
212
212
|
await g();
|
|
213
213
|
} catch (e) {
|
|
214
214
|
if (re(e)) {
|
|
215
|
-
ie("sandbox"), h("You've reached your sandbox limit on the current plan. Upgrade to start the AI assistant."), B(
|
|
215
|
+
ie("sandbox"), h("You've reached your sandbox limit on the current plan. Upgrade to start the AI assistant."), B(i, "error", m, null);
|
|
216
216
|
return;
|
|
217
217
|
}
|
|
218
218
|
let t = e instanceof Error ? e.message : "Something went wrong";
|
|
219
|
-
B(
|
|
219
|
+
B(i, "error", m, t), R(i, m, `Sorry, an error occurred: ${t}. Please try again.`);
|
|
220
220
|
}
|
|
221
221
|
}, [
|
|
222
222
|
A,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useTr as e } from "../../shared/hooks/useTr.js";
|
|
2
|
+
import { downloadAssistantArtifact as t } from "../../services/assistantApi.js";
|
|
3
3
|
import { AssistantMarkdownRenderer as n } from "./AssistantMarkdownRenderer.js";
|
|
4
4
|
import { useMemo as r, useState as i } from "react";
|
|
5
5
|
import { Bot as a, User as o } from "lucide-react";
|
|
@@ -24,13 +24,13 @@ function h(e, t, n) {
|
|
|
24
24
|
s.href = o, s.download = t, document.body.appendChild(s), s.click(), document.body.removeChild(s), URL.revokeObjectURL(o);
|
|
25
25
|
}
|
|
26
26
|
var g = ({ message: m, isStreaming: g }) => {
|
|
27
|
-
let _ =
|
|
27
|
+
let _ = e(), v = u("workspace"), { getAccessToken: y, getWorkspaceToken: b } = d(), [x, S] = i(null), C = m.role === "user", w = r(() => f(m), [m]), T = r(() => p(w), [w]), E = async (e) => {
|
|
28
28
|
if (!w?.sandboxId || !w.sessionId) return;
|
|
29
29
|
let n = new URLSearchParams(window.location.search).get("workspace") ?? "";
|
|
30
30
|
if (n) {
|
|
31
|
-
S(
|
|
31
|
+
S(e.path);
|
|
32
32
|
try {
|
|
33
|
-
let r = await
|
|
33
|
+
let r = await t(v, w.sandboxId, n, w.sessionId, e.path, {
|
|
34
34
|
accessToken: y(),
|
|
35
35
|
workspaceToken: b()
|
|
36
36
|
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useOpenAssistantHelp as e } from "../../hooks/useOpenAssistantHelp.js";
|
|
2
|
+
import { useTr as t } from "../../shared/hooks/useTr.js";
|
|
3
|
+
import { HelpCircle as n } from "lucide-react";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
//#region src/healthybowl/components/GetHelpButton.tsx
|
|
6
|
+
function a({ prompt: a, label: o, variant: s = "ghost", className: c = "" }) {
|
|
7
|
+
let l = t(), u = o ?? l("healthybowl.shared.getHelpButton.label", "Get Help"), d = e();
|
|
8
|
+
return /* @__PURE__ */ i("button", {
|
|
9
|
+
type: "button",
|
|
10
|
+
onClick: () => d(a),
|
|
11
|
+
className: `${s === "ghost" ? "inline-flex items-center gap-1.5 px-3 py-1.5 text-sm border border-border-default text-text-secondary hover:text-text-primary hover:bg-bg-sunken rounded-md transition-colors" : "inline-flex items-center gap-1.5 text-sm text-action-primary-bg hover:underline"} ${c}`.trim(),
|
|
12
|
+
title: l("healthybowl.shared.getHelpButton.tooltip", "Ask the assistant about this page"),
|
|
13
|
+
"data-testid": "get-help-button",
|
|
14
|
+
children: [/* @__PURE__ */ r(n, { className: "size-4" }), u]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { a as GetHelpButton };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=GetHelpButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetHelpButton.js","names":[],"sources":["../../../src/healthybowl/components/GetHelpButton.tsx"],"sourcesContent":["import { HelpCircle } from 'lucide-react';\nimport { useOpenAssistantHelp } from '@/hooks/useOpenAssistantHelp';\nimport { useTr } from '../../shared/hooks/useTr';\n\ninterface GetHelpButtonProps {\n /** The prompt auto-sent to the assistant (general mode) when clicked. */\n prompt: string;\n /** Optional label override. Defaults to \"Get Help\". */\n label?: string;\n /** `ghost` (default) is a subtle outlined button; `link` is text-only. */\n variant?: 'ghost' | 'link';\n /** Additional CSS class names. */\n className?: string;\n}\n\n/**\n * Shared \"Get Help\" button — a contextual help affordance that opens the AI\n * assistant and auto-asks about the current screen, so a user can get help\n * without leaving the page or typing. Rendered by `PageLayout` on every page\n * (prompt derived from the page title), and usable standalone next to \"Add X\"\n * empty states. Mirrors the VibeControls pattern; HB semantic tokens only.\n *\n * Clicking it: switches the assistant to `general` mode, opens the shell panel\n * (`hb:toggle-ai-assistant` { open: true }), and queues `prompt` — the\n * AssistantChatArea auto-sends it. See `useOpenAssistantHelp`.\n */\nexport function GetHelpButton({ prompt, label, variant = 'ghost', className = '' }: GetHelpButtonProps) {\n const tr = useTr();\n const resolvedLabel = label ?? tr('healthybowl.shared.getHelpButton.label', 'Get Help');\n const openHelp = useOpenAssistantHelp();\n\n const baseClass =\n variant === 'ghost'\n ? 'inline-flex items-center gap-1.5 px-3 py-1.5 text-sm border border-border-default text-text-secondary hover:text-text-primary hover:bg-bg-sunken rounded-md transition-colors'\n : 'inline-flex items-center gap-1.5 text-sm text-action-primary-bg hover:underline';\n\n return (\n <button\n type=\"button\"\n onClick={() => openHelp(prompt)}\n className={`${baseClass} ${className}`.trim()}\n title={tr('healthybowl.shared.getHelpButton.tooltip', 'Ask the assistant about this page')}\n data-testid=\"get-help-button\"\n >\n <HelpCircle className=\"size-4\" />\n {resolvedLabel}\n </button>\n );\n}\n"],"mappings":";;;;;AA0BA,SAAgB,EAAc,EAAE,WAAQ,UAAO,aAAU,SAAS,eAAY,MAA0B;CACtG,IAAM,IAAK,GAAO,EACZ,IAAgB,KAAS,EAAG,0CAA0C,WAAW,EACjF,IAAW,GAAsB;AAOvC,QACE,kBAAC,UAAD;EACE,MAAK;EACL,eAAe,EAAS,EAAO;EAC/B,WAAW,GARb,MAAY,UACR,kLACA,kFAMsB,GAAG,IAAY,MAAM;EAC7C,OAAO,EAAG,4CAA4C,oCAAoC;EAC1F,eAAY;YALd,CAOE,kBAAC,GAAD,EAAY,WAAU,UAAW,CAAA,EAChC,EACM"}
|
|
@@ -1,46 +1,47 @@
|
|
|
1
1
|
import { cn as e } from "../utils/helpers.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { GetHelpButton as t } from "./GetHelpButton.js";
|
|
3
|
+
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
+
import { AuroraBackground as a, GradientText as o, NextSteps as s, PageContainer as c, PagePurpose as l } from "@burdenoff/fe-libs/ui";
|
|
5
|
+
import { PageHeader as u } from "@burdenoff/fe-libs/chrome";
|
|
5
6
|
//#region src/healthybowl/components/PageLayout.tsx
|
|
6
|
-
var
|
|
7
|
-
if (!
|
|
8
|
-
let
|
|
9
|
-
return
|
|
10
|
-
e.slice(0,
|
|
11
|
-
/* @__PURE__ */
|
|
12
|
-
e.slice(
|
|
7
|
+
var d = (e, t) => {
|
|
8
|
+
if (!t) return e;
|
|
9
|
+
let a = e.indexOf(t);
|
|
10
|
+
return a === -1 ? e : /* @__PURE__ */ i(n, { children: [
|
|
11
|
+
e.slice(0, a),
|
|
12
|
+
/* @__PURE__ */ r(o, { children: t }),
|
|
13
|
+
e.slice(a + t.length)
|
|
13
14
|
] });
|
|
14
|
-
},
|
|
15
|
-
let
|
|
16
|
-
title:
|
|
17
|
-
description:
|
|
18
|
-
actions:
|
|
15
|
+
}, f = ({ title: o, description: f, actions: p, children: m, hero: h = !1, titleAccent: g, purpose: _, purposeIcon: v, nextSteps: y, nextStepsKey: b, nextStepsTitle: x, helpPrompt: S, hideHelp: C = !1, className: w }) => {
|
|
16
|
+
let T = C ? null : /* @__PURE__ */ r(t, { prompt: S ?? `What is the ${o} page for, and how do I use it?` }), E = T || p ? /* @__PURE__ */ i(n, { children: [T, p] }) : void 0, D = /* @__PURE__ */ r(u, {
|
|
17
|
+
title: d(o, g),
|
|
18
|
+
description: f,
|
|
19
|
+
actions: E
|
|
19
20
|
});
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
-
className: e("space-y-6",
|
|
21
|
+
return /* @__PURE__ */ i(c, {
|
|
22
|
+
className: e("space-y-6", w),
|
|
22
23
|
children: [
|
|
23
|
-
|
|
24
|
+
h ? /* @__PURE__ */ i("div", {
|
|
24
25
|
className: "relative overflow-hidden rounded-2xl border border-border-seam bg-hero-mesh px-6 py-5 shadow-pop",
|
|
25
|
-
children: [/* @__PURE__ */
|
|
26
|
+
children: [/* @__PURE__ */ r(a, { intensity: "subtle" }), /* @__PURE__ */ r("div", {
|
|
26
27
|
className: "relative z-10",
|
|
27
|
-
children:
|
|
28
|
+
children: D
|
|
28
29
|
})]
|
|
29
|
-
}) :
|
|
30
|
-
|
|
31
|
-
icon:
|
|
32
|
-
children:
|
|
30
|
+
}) : D,
|
|
31
|
+
_ && /* @__PURE__ */ r(l, {
|
|
32
|
+
icon: v,
|
|
33
|
+
children: _
|
|
33
34
|
}),
|
|
34
|
-
|
|
35
|
-
steps:
|
|
36
|
-
storageKey:
|
|
37
|
-
title:
|
|
35
|
+
y && y.length > 0 && b && /* @__PURE__ */ r(s, {
|
|
36
|
+
steps: y,
|
|
37
|
+
storageKey: b,
|
|
38
|
+
title: x
|
|
38
39
|
}),
|
|
39
|
-
|
|
40
|
+
m
|
|
40
41
|
]
|
|
41
42
|
});
|
|
42
43
|
};
|
|
43
44
|
//#endregion
|
|
44
|
-
export {
|
|
45
|
+
export { f as PageLayout };
|
|
45
46
|
|
|
46
47
|
//# sourceMappingURL=PageLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageLayout.js","names":[],"sources":["../../../src/healthybowl/components/PageLayout.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport { PageContainer, AuroraBackground, GradientText, PagePurpose, NextSteps } from '@burdenoff/fe-libs/ui';\nimport type { NextStep } from '@burdenoff/fe-libs/ui';\nimport { PageHeader } from '@burdenoff/fe-libs/chrome';\nimport { cn } from '../utils/helpers';\n\ninterface PageLayoutProps {\n title: string;\n description?: string;\n actions?: ReactNode;\n children: ReactNode;\n /**\n * Boff UI 2.0 hero header — wraps the page header in a glass card with a subtle\n * living AuroraBackground backdrop. Use on the MFE's PRIMARY page only (one\n * aurora per MFE). The backdrop sits behind the content (-z-10), never shifts\n * layout, and goes static under reduced-motion.\n */\n hero?: boolean;\n /**\n * Key noun of the title to render with GradientText (the one hero heading per\n * page). Must be a substring of `title`; the surrounding text stays plain.\n */\n titleAccent?: string;\n /**\n * Boff UI 2.0 page \"story\" — a concise, plain-language explanation of WHAT this\n * page is for and the use-case, rendered as a `PagePurpose` directly under the\n * header so every page is self-explanatory for a new user. Renders before any\n * loading/empty/content branch in `children`, so it is always visible.\n */\n purpose?: ReactNode;\n /** Optional icon for the page purpose. */\n purposeIcon?: ReactNode;\n /**\n * Boff UI 2.0 next-step guidance for COMPLEX pages (detail/dashboard/multi-tab):\n * a dismissable, reopenable `NextSteps` card recommending 2-4 concrete actions\n * wired to real handlers/links so new users aren't overwhelmed. Skip on trivial\n * single-action pages. Requires `nextStepsKey` to persist the dismissed state.\n */\n nextSteps?: NextStep[];\n /** localStorage key suffix for the NextSteps dismissed state (e.g. \"healthybowl-crops\"). */\n nextStepsKey?: string;\n /** Optional title for the NextSteps card. */\n nextStepsTitle?: string;\n className?: string;\n}\n\n/** Renders the title, highlighting `accent` (if present) with GradientText. */\nconst renderTitle = (title: string, accent?: string): ReactNode => {\n if (!accent) return title;\n const idx = title.indexOf(accent);\n if (idx === -1) return title;\n return (\n <>\n {title.slice(0, idx)}\n <GradientText>{accent}</GradientText>\n {title.slice(idx + accent.length)}\n </>\n );\n};\n\n/**\n * Standard page scaffold. Wraps the Boff `PageContainer` (background + padding)\n * and `PageHeader` (title/description/actions) so every page is theme-compliant.\n * With `hero`, the header is wrapped in a glassy mesh card with a living aurora\n * backdrop (Boff UI 2.0) for the MFE's primary page; `titleAccent` clips the key\n * noun into a brand gradient. `PageContainer` supplies the default page padding;\n * we re-add the inter-section vertical gap so header→content spacing is preserved.\n */\nexport const PageLayout: FC<PageLayoutProps> = ({\n title,\n description,\n actions,\n children,\n hero = false,\n titleAccent,\n purpose,\n purposeIcon,\n nextSteps,\n nextStepsKey,\n nextStepsTitle,\n className,\n}) => {\n const header = <PageHeader title={renderTitle(title, titleAccent)} description={description} actions={
|
|
1
|
+
{"version":3,"file":"PageLayout.js","names":[],"sources":["../../../src/healthybowl/components/PageLayout.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport { PageContainer, AuroraBackground, GradientText, PagePurpose, NextSteps } from '@burdenoff/fe-libs/ui';\nimport type { NextStep } from '@burdenoff/fe-libs/ui';\nimport { PageHeader } from '@burdenoff/fe-libs/chrome';\nimport { cn } from '../utils/helpers';\nimport { GetHelpButton } from './GetHelpButton';\n\ninterface PageLayoutProps {\n title: string;\n description?: string;\n actions?: ReactNode;\n children: ReactNode;\n /**\n * Contextual prompt for the always-present \"Get Help\" button in the header —\n * clicking it opens the AI assistant and asks about THIS page. Defaults to a\n * title-based question. Set `hideHelp` to drop the button where it doesn't fit.\n */\n helpPrompt?: string;\n /** Hide the header \"Get Help\" button (shown by default on every page). */\n hideHelp?: boolean;\n /**\n * Boff UI 2.0 hero header — wraps the page header in a glass card with a subtle\n * living AuroraBackground backdrop. Use on the MFE's PRIMARY page only (one\n * aurora per MFE). The backdrop sits behind the content (-z-10), never shifts\n * layout, and goes static under reduced-motion.\n */\n hero?: boolean;\n /**\n * Key noun of the title to render with GradientText (the one hero heading per\n * page). Must be a substring of `title`; the surrounding text stays plain.\n */\n titleAccent?: string;\n /**\n * Boff UI 2.0 page \"story\" — a concise, plain-language explanation of WHAT this\n * page is for and the use-case, rendered as a `PagePurpose` directly under the\n * header so every page is self-explanatory for a new user. Renders before any\n * loading/empty/content branch in `children`, so it is always visible.\n */\n purpose?: ReactNode;\n /** Optional icon for the page purpose. */\n purposeIcon?: ReactNode;\n /**\n * Boff UI 2.0 next-step guidance for COMPLEX pages (detail/dashboard/multi-tab):\n * a dismissable, reopenable `NextSteps` card recommending 2-4 concrete actions\n * wired to real handlers/links so new users aren't overwhelmed. Skip on trivial\n * single-action pages. Requires `nextStepsKey` to persist the dismissed state.\n */\n nextSteps?: NextStep[];\n /** localStorage key suffix for the NextSteps dismissed state (e.g. \"healthybowl-crops\"). */\n nextStepsKey?: string;\n /** Optional title for the NextSteps card. */\n nextStepsTitle?: string;\n className?: string;\n}\n\n/** Renders the title, highlighting `accent` (if present) with GradientText. */\nconst renderTitle = (title: string, accent?: string): ReactNode => {\n if (!accent) return title;\n const idx = title.indexOf(accent);\n if (idx === -1) return title;\n return (\n <>\n {title.slice(0, idx)}\n <GradientText>{accent}</GradientText>\n {title.slice(idx + accent.length)}\n </>\n );\n};\n\n/**\n * Standard page scaffold. Wraps the Boff `PageContainer` (background + padding)\n * and `PageHeader` (title/description/actions) so every page is theme-compliant.\n * With `hero`, the header is wrapped in a glassy mesh card with a living aurora\n * backdrop (Boff UI 2.0) for the MFE's primary page; `titleAccent` clips the key\n * noun into a brand gradient. `PageContainer` supplies the default page padding;\n * we re-add the inter-section vertical gap so header→content spacing is preserved.\n */\nexport const PageLayout: FC<PageLayoutProps> = ({\n title,\n description,\n actions,\n children,\n hero = false,\n titleAccent,\n purpose,\n purposeIcon,\n nextSteps,\n nextStepsKey,\n nextStepsTitle,\n helpPrompt,\n hideHelp = false,\n className,\n}) => {\n // Always-present contextual help button (general-mode assistant, asks about\n // this page). Rendered before any page-specific actions; opt out via hideHelp.\n const helpButton = hideHelp ? null : (\n <GetHelpButton prompt={helpPrompt ?? `What is the ${title} page for, and how do I use it?`} />\n );\n const headerActions =\n helpButton || actions ? (\n <>\n {helpButton}\n {actions}\n </>\n ) : undefined;\n const header = (\n <PageHeader title={renderTitle(title, titleAccent)} description={description} actions={headerActions} />\n );\n\n return (\n <PageContainer className={cn('space-y-6', className)}>\n {hero ? (\n <div className=\"relative overflow-hidden rounded-2xl border border-border-seam bg-hero-mesh px-6 py-5 shadow-pop\">\n <AuroraBackground intensity=\"subtle\" />\n <div className=\"relative z-10\">{header}</div>\n </div>\n ) : (\n header\n )}\n {purpose && <PagePurpose icon={purposeIcon}>{purpose}</PagePurpose>}\n {nextSteps && nextSteps.length > 0 && nextStepsKey && (\n <NextSteps steps={nextSteps} storageKey={nextStepsKey} title={nextStepsTitle} />\n )}\n {children}\n </PageContainer>\n );\n};\n"],"mappings":";;;;;;AAwDA,IAAM,KAAe,GAAe,MAA+B;AACjE,KAAI,CAAC,EAAQ,QAAO;CACpB,IAAM,IAAM,EAAM,QAAQ,EAAO;AAEjC,QADI,MAAQ,KAAW,IAErB,kBAAA,GAAA,EAAA,UAAA;EACG,EAAM,MAAM,GAAG,EAAI;EACpB,kBAAC,GAAD,EAAA,UAAe,GAAsB,CAAA;EACpC,EAAM,MAAM,IAAM,EAAO,OAAO;EAChC,EAAA,CAAA;GAYM,KAAmC,EAC9C,UACA,gBACA,YACA,aACA,UAAO,IACP,gBACA,YACA,gBACA,cACA,iBACA,mBACA,eACA,cAAW,IACX,mBACI;CAGJ,IAAM,IAAa,IAAW,OAC5B,kBAAC,GAAD,EAAe,QAAQ,KAAc,eAAe,EAAM,kCAAoC,CAAA,EAE1F,IACJ,KAAc,IACZ,kBAAA,GAAA,EAAA,UAAA,CACG,GACA,EACA,EAAA,CAAA,GACD,KAAA,GACA,IACJ,kBAAC,GAAD;EAAY,OAAO,EAAY,GAAO,EAAY;EAAe;EAAa,SAAS;EAAiB,CAAA;AAG1G,QACE,kBAAC,GAAD;EAAe,WAAW,EAAG,aAAa,EAAU;YAApD;GACG,IACC,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,GAAD,EAAkB,WAAU,UAAW,CAAA,EACvC,kBAAC,OAAD;KAAK,WAAU;eAAiB;KAAa,CAAA,CACzC;QAEN;GAED,KAAW,kBAAC,GAAD;IAAa,MAAM;cAAc;IAAsB,CAAA;GAClE,KAAa,EAAU,SAAS,KAAK,KACpC,kBAAC,GAAD;IAAW,OAAO;IAAW,YAAY;IAAc,OAAO;IAAkB,CAAA;GAEjF;GACa"}
|