@burdenoff/microfe-healthybowl 2026.629.5 → 2026.629.7
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 +10 -9
- package/dist/components/assistant/AIAssistantPanel.js.map +1 -1
- package/dist/components/assistant/AssistantChatInput.js +27 -26
- package/dist/components/assistant/AssistantChatInput.js.map +1 -1
- package/dist/components/assistant/AssistantConversationList.js +24 -20
- package/dist/components/assistant/AssistantConversationList.js.map +1 -1
- package/dist/components/assistant/AssistantWelcome.js +9 -9
- package/dist/components/assistant/AssistantWelcome.js.map +1 -1
- package/package.json +1 -1
|
@@ -25,18 +25,19 @@ var p = ({ onClose: p, visible: m }) => {
|
|
|
25
25
|
tabIndex: -1,
|
|
26
26
|
children: [
|
|
27
27
|
/* @__PURE__ */ f("div", {
|
|
28
|
-
className: "flex items-center justify-between px-
|
|
28
|
+
className: "flex items-center justify-between px-4 py-3 border-b border-border-default bg-bg-elevated flex-shrink-0",
|
|
29
29
|
children: [/* @__PURE__ */ f("div", {
|
|
30
30
|
className: "flex items-center gap-2 min-w-0",
|
|
31
31
|
children: [/* @__PURE__ */ d("button", {
|
|
32
32
|
type: "button",
|
|
33
33
|
onClick: b,
|
|
34
|
-
className:
|
|
35
|
-
"aria-label": h("healthybowl.assistant.panel.toggleList", "Toggle conversation
|
|
34
|
+
className: `p-1.5 rounded-lg transition-colors ${y ? "bg-action-primary-bg/15 text-action-primary-bg" : "text-text-secondary hover:bg-bg-sunken"}`,
|
|
35
|
+
"aria-label": h("healthybowl.assistant.panel.toggleList", "Toggle conversation history"),
|
|
36
|
+
"aria-pressed": y,
|
|
36
37
|
"data-testid": "toggle-conversation-list",
|
|
37
|
-
children: /* @__PURE__ */ d(l, { className: "size-
|
|
38
|
+
children: /* @__PURE__ */ d(l, { className: "size-4" })
|
|
38
39
|
}), /* @__PURE__ */ d("span", {
|
|
39
|
-
className: "text-
|
|
40
|
+
className: "text-[13px] font-semibold text-text-primary truncate",
|
|
40
41
|
children: S?.title ?? h("healthybowl.assistant.panel.title", "AI Assistant")
|
|
41
42
|
})]
|
|
42
43
|
}), /* @__PURE__ */ f("div", {
|
|
@@ -45,17 +46,17 @@ var p = ({ onClose: p, visible: m }) => {
|
|
|
45
46
|
C && /* @__PURE__ */ d("button", {
|
|
46
47
|
type: "button",
|
|
47
48
|
onClick: () => v && x(v),
|
|
48
|
-
className: "p-1 hover:bg-bg-sunken
|
|
49
|
+
className: "p-1.5 rounded-lg text-text-secondary hover:bg-bg-sunken transition-colors",
|
|
49
50
|
"aria-label": h("healthybowl.assistant.panel.clearConversation", "Clear conversation"),
|
|
50
|
-
children: /* @__PURE__ */ d(c, { className: "size-
|
|
51
|
+
children: /* @__PURE__ */ d(c, { className: "size-4" })
|
|
51
52
|
}),
|
|
52
53
|
/* @__PURE__ */ d(o, {}),
|
|
53
54
|
/* @__PURE__ */ d("button", {
|
|
54
55
|
type: "button",
|
|
55
56
|
onClick: p,
|
|
56
|
-
className: "p-1 hover:bg-bg-sunken
|
|
57
|
+
className: "p-1.5 rounded-lg text-text-secondary hover:bg-bg-sunken transition-colors md:hidden",
|
|
57
58
|
"aria-label": h("healthybowl.assistant.panel.close", "Close assistant"),
|
|
58
|
-
children: /* @__PURE__ */ d(u, { className: "size-
|
|
59
|
+
children: /* @__PURE__ */ d(u, { className: "size-4" })
|
|
59
60
|
})
|
|
60
61
|
]
|
|
61
62
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AIAssistantPanel.js","names":[],"sources":["../../../src/components/assistant/AIAssistantPanel.tsx"],"sourcesContent":["/**\n * AI Assistant Panel — top-level component for the right-pane assistant.\n *\n * Receives PanelProps from the plugin panel system. Orchestrates the\n * conversation list, chat area, and export menu.\n *\n * Responsive behavior:\n * - Desktop (>= 768px): Renders inline within PanelContainer (right panel)\n * - Mobile (< 768px): Panel container handles sizing; panel fills available space\n */\n\nimport { useRef, type FC } from 'react';\nimport { MessageSquare, Eraser, X } from 'lucide-react';\nimport type { PanelProps } from '@burdenoff/fe-libs/shared/plugins';\nimport { useAssistantStore } from '@/store/assistantStore';\nimport { useAssistantKeyboardShortcuts } from '@/hooks/useAssistantKeyboardShortcuts';\nimport { useAssistantHeartbeat } from '@/hooks/useAssistantHeartbeat';\nimport { AssistantChatArea } from './AssistantChatArea';\nimport { AssistantConversationList } from './AssistantConversationList';\nimport { AssistantExportMenu } from './AssistantExportMenu';\nimport { useTr } from '../../shared/hooks/useTr';\n\nexport const AIAssistantPanel: FC<PanelProps> = ({ onClose, visible }) => {\n const tr = useTr();\n const panelRef = useRef<HTMLDivElement>(null);\n\n const { conversations, activeConversationId, conversationListOpen, toggleConversationList, clearConversation } =\n useAssistantStore();\n\n const activeConversation = conversations.find((c) => c.id === activeConversationId);\n const activeSessionId = activeConversation?.backendSessionId ?? null;\n\n // Keep sandbox alive while panel is open\n useAssistantHeartbeat(activeSessionId, activeConversation?.mode ?? null, visible ?? true);\n\n const hasMessages = (activeConversation?.messages.length ?? 0) > 0;\n\n useAssistantKeyboardShortcuts({\n panelRef,\n onClose,\n });\n\n return (\n <div\n ref={panelRef}\n className=\"flex flex-col h-full w-full bg-bg-surface relative\"\n role=\"complementary\"\n aria-label={tr('healthybowl.assistant.panel.ariaLabel', 'AI Assistant')}\n data-testid=\"ai-assistant-panel\"\n tabIndex={-1}\n >\n {/* Panel header */}\n <div className=\"flex items-center justify-between px-
|
|
1
|
+
{"version":3,"file":"AIAssistantPanel.js","names":[],"sources":["../../../src/components/assistant/AIAssistantPanel.tsx"],"sourcesContent":["/**\n * AI Assistant Panel — top-level component for the right-pane assistant.\n *\n * Receives PanelProps from the plugin panel system. Orchestrates the\n * conversation list, chat area, and export menu.\n *\n * Responsive behavior:\n * - Desktop (>= 768px): Renders inline within PanelContainer (right panel)\n * - Mobile (< 768px): Panel container handles sizing; panel fills available space\n */\n\nimport { useRef, type FC } from 'react';\nimport { MessageSquare, Eraser, X } from 'lucide-react';\nimport type { PanelProps } from '@burdenoff/fe-libs/shared/plugins';\nimport { useAssistantStore } from '@/store/assistantStore';\nimport { useAssistantKeyboardShortcuts } from '@/hooks/useAssistantKeyboardShortcuts';\nimport { useAssistantHeartbeat } from '@/hooks/useAssistantHeartbeat';\nimport { AssistantChatArea } from './AssistantChatArea';\nimport { AssistantConversationList } from './AssistantConversationList';\nimport { AssistantExportMenu } from './AssistantExportMenu';\nimport { useTr } from '../../shared/hooks/useTr';\n\nexport const AIAssistantPanel: FC<PanelProps> = ({ onClose, visible }) => {\n const tr = useTr();\n const panelRef = useRef<HTMLDivElement>(null);\n\n const { conversations, activeConversationId, conversationListOpen, toggleConversationList, clearConversation } =\n useAssistantStore();\n\n const activeConversation = conversations.find((c) => c.id === activeConversationId);\n const activeSessionId = activeConversation?.backendSessionId ?? null;\n\n // Keep sandbox alive while panel is open\n useAssistantHeartbeat(activeSessionId, activeConversation?.mode ?? null, visible ?? true);\n\n const hasMessages = (activeConversation?.messages.length ?? 0) > 0;\n\n useAssistantKeyboardShortcuts({\n panelRef,\n onClose,\n });\n\n return (\n <div\n ref={panelRef}\n className=\"flex flex-col h-full w-full bg-bg-surface relative\"\n role=\"complementary\"\n aria-label={tr('healthybowl.assistant.panel.ariaLabel', 'AI Assistant')}\n data-testid=\"ai-assistant-panel\"\n tabIndex={-1}\n >\n {/* Panel header */}\n <div className=\"flex items-center justify-between px-4 py-3 border-b border-border-default bg-bg-elevated flex-shrink-0\">\n <div className=\"flex items-center gap-2 min-w-0\">\n <button\n type=\"button\"\n onClick={toggleConversationList}\n className={`p-1.5 rounded-lg transition-colors ${\n conversationListOpen\n ? 'bg-action-primary-bg/15 text-action-primary-bg'\n : 'text-text-secondary hover:bg-bg-sunken'\n }`}\n aria-label={tr('healthybowl.assistant.panel.toggleList', 'Toggle conversation history')}\n aria-pressed={conversationListOpen}\n data-testid=\"toggle-conversation-list\"\n >\n <MessageSquare className=\"size-4\" />\n </button>\n <span className=\"text-[13px] font-semibold text-text-primary truncate\">\n {activeConversation?.title ?? tr('healthybowl.assistant.panel.title', 'AI Assistant')}\n </span>\n </div>\n\n <div className=\"flex items-center gap-0.5 flex-shrink-0\">\n {hasMessages && (\n <button\n type=\"button\"\n onClick={() => activeConversationId && clearConversation(activeConversationId)}\n className=\"p-1.5 rounded-lg text-text-secondary hover:bg-bg-sunken transition-colors\"\n aria-label={tr('healthybowl.assistant.panel.clearConversation', 'Clear conversation')}\n >\n <Eraser className=\"size-4\" />\n </button>\n )}\n <AssistantExportMenu />\n <button\n type=\"button\"\n onClick={onClose}\n className=\"p-1.5 rounded-lg text-text-secondary hover:bg-bg-sunken transition-colors md:hidden\"\n aria-label={tr('healthybowl.assistant.panel.close', 'Close assistant')}\n >\n <X className=\"size-4\" />\n </button>\n </div>\n </div>\n\n {/* Conversation list overlay */}\n {conversationListOpen && <AssistantConversationList />}\n\n {/* Chat area */}\n <AssistantChatArea />\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;AAsBA,IAAa,KAAoC,EAAE,YAAS,iBAAc;CACxE,IAAM,IAAK,GAAO,EACZ,IAAW,EAAuB,KAAK,EAEvC,EAAE,kBAAe,yBAAsB,yBAAsB,2BAAwB,yBACzF,GAAmB,EAEf,IAAqB,EAAc,MAAM,MAAM,EAAE,OAAO,EAAqB;AAInF,GAHwB,GAAoB,oBAAoB,MAGzB,GAAoB,QAAQ,MAAM,KAAW,GAAK;CAEzF,IAAM,KAAe,GAAoB,SAAS,UAAU,KAAK;AAOjE,QALA,EAA8B;EAC5B;EACA;EACD,CAAC,EAGA,kBAAC,OAAD;EACE,KAAK;EACL,WAAU;EACV,MAAK;EACL,cAAY,EAAG,yCAAyC,eAAe;EACvE,eAAY;EACZ,UAAU;YANZ;GASE,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,UAAD;MACE,MAAK;MACL,SAAS;MACT,WAAW,sCACT,IACI,mDACA;MAEN,cAAY,EAAG,0CAA0C,8BAA8B;MACvF,gBAAc;MACd,eAAY;gBAEZ,kBAAC,GAAD,EAAe,WAAU,UAAW,CAAA;MAC7B,CAAA,EACT,kBAAC,QAAD;MAAM,WAAU;gBACb,GAAoB,SAAS,EAAG,qCAAqC,eAAe;MAChF,CAAA,CACH;QAEN,kBAAC,OAAD;KAAK,WAAU;eAAf;MACG,KACC,kBAAC,UAAD;OACE,MAAK;OACL,eAAe,KAAwB,EAAkB,EAAqB;OAC9E,WAAU;OACV,cAAY,EAAG,iDAAiD,qBAAqB;iBAErF,kBAAC,GAAD,EAAQ,WAAU,UAAW,CAAA;OACtB,CAAA;MAEX,kBAAC,GAAD,EAAuB,CAAA;MACvB,kBAAC,UAAD;OACE,MAAK;OACL,SAAS;OACT,WAAU;OACV,cAAY,EAAG,qCAAqC,kBAAkB;iBAEtE,kBAAC,GAAD,EAAG,WAAU,UAAW,CAAA;OACjB,CAAA;MACL;OACF;;GAGL,KAAwB,kBAAC,GAAD,EAA6B,CAAA;GAGtD,kBAAC,GAAD,EAAqB,CAAA;GACjB"}
|
|
@@ -9,41 +9,42 @@ var o = ({ onSend: o, disabled: s = !1, placeholder: c = "Ask anything...", tool
|
|
|
9
9
|
if (!e) return;
|
|
10
10
|
let t = e.value.trim();
|
|
11
11
|
!t || s || (o(t), e.value = "", e.style.height = "auto");
|
|
12
|
-
}, [o, s])
|
|
12
|
+
}, [o, s]), p = t((e) => {
|
|
13
|
+
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), f());
|
|
14
|
+
}, [f]), m = t(() => {
|
|
15
|
+
let e = d.current;
|
|
16
|
+
e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, 140)}px`);
|
|
17
|
+
}, []);
|
|
13
18
|
return /* @__PURE__ */ i("div", {
|
|
14
|
-
className: "px-
|
|
19
|
+
className: "px-4 pb-4 pt-2",
|
|
15
20
|
children: /* @__PURE__ */ a("div", {
|
|
16
|
-
className: "rounded-
|
|
17
|
-
children: [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), f());
|
|
21
|
-
}, [f]),
|
|
22
|
-
onInput: t(() => {
|
|
23
|
-
let e = d.current;
|
|
24
|
-
e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, 140)}px`);
|
|
25
|
-
}, []),
|
|
26
|
-
disabled: s,
|
|
27
|
-
placeholder: c,
|
|
28
|
-
rows: 1,
|
|
29
|
-
className: "w-full resize-none bg-transparent px-3.5 pb-1 pt-3 text-xs leading-relaxed text-text-primary placeholder:text-text-muted focus:outline-none disabled:opacity-50",
|
|
30
|
-
"aria-label": u("healthybowl.assistant.chatInput.ariaLabel", "Message input"),
|
|
31
|
-
"data-testid": "assistant-input"
|
|
32
|
-
}), /* @__PURE__ */ a("div", {
|
|
33
|
-
className: "flex items-center justify-between gap-2 px-2 pb-2 pt-0.5",
|
|
34
|
-
children: [/* @__PURE__ */ i("div", {
|
|
35
|
-
className: "flex min-w-0 items-center gap-1.5",
|
|
21
|
+
className: "flex items-center gap-1 rounded-[26px] border border-border-default bg-bg-sunken py-1.5 pl-2 pr-2 shadow-sm transition-all focus-within:border-action-primary-bg focus-within:shadow-md focus-within:ring-2 focus-within:ring-action-primary-bg/15",
|
|
22
|
+
children: [
|
|
23
|
+
l ? /* @__PURE__ */ i("div", {
|
|
24
|
+
className: "flex flex-shrink-0 items-center gap-1",
|
|
36
25
|
children: l
|
|
37
|
-
})
|
|
26
|
+
}) : null,
|
|
27
|
+
/* @__PURE__ */ i("textarea", {
|
|
28
|
+
ref: d,
|
|
29
|
+
onKeyDown: p,
|
|
30
|
+
onInput: m,
|
|
31
|
+
disabled: s,
|
|
32
|
+
placeholder: c,
|
|
33
|
+
rows: 1,
|
|
34
|
+
className: "min-w-0 flex-1 resize-none bg-transparent px-2 py-1.5 text-[13px] leading-relaxed text-text-primary placeholder:text-text-muted focus:outline-none disabled:opacity-50",
|
|
35
|
+
"aria-label": u("healthybowl.assistant.chatInput.ariaLabel", "Message input"),
|
|
36
|
+
"data-testid": "assistant-input"
|
|
37
|
+
}),
|
|
38
|
+
/* @__PURE__ */ i("button", {
|
|
38
39
|
type: "button",
|
|
39
40
|
onClick: f,
|
|
40
41
|
disabled: s,
|
|
41
|
-
className: "flex size-
|
|
42
|
+
className: "flex size-9 flex-shrink-0 items-center justify-center rounded-full bg-action-primary-bg text-action-primary-text shadow-sm transition-all hover:bg-action-primary-bg-hover hover:scale-105 focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong disabled:scale-100 disabled:opacity-40",
|
|
42
43
|
"aria-label": u("healthybowl.assistant.chatInput.send", "Send message"),
|
|
43
44
|
"data-testid": "assistant-send",
|
|
44
45
|
children: /* @__PURE__ */ i(r, { className: "size-4" })
|
|
45
|
-
})
|
|
46
|
-
|
|
46
|
+
})
|
|
47
|
+
]
|
|
47
48
|
})
|
|
48
49
|
});
|
|
49
50
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantChatInput.js","names":[],"sources":["../../../src/components/assistant/AssistantChatInput.tsx"],"sourcesContent":["import { useRef, useCallback, type FC, type KeyboardEvent, type ReactNode } from 'react';\nimport { ArrowUp } from 'lucide-react';\nimport { useTr } from '../../shared/hooks/useTr';\n\ninterface Props {\n onSend: (message: string) => void;\n disabled?: boolean;\n placeholder?: string;\n /** Rendered inline on the left of the composer toolbar (e.g. the mode chip). */\n toolbarStart?: ReactNode;\n}\n\n/**\n * Composer — a single rounded \"card\" (Google-Stitch-style) holding the textarea\n * with an inline bottom toolbar: contextual controls on the left (mode chip) and\n * a circular send up-arrow on the right. The whole card lifts its border on\n * focus. Uses HB semantic tokens only.\n */\nexport const AssistantChatInput: FC<Props> = ({\n onSend,\n disabled = false,\n placeholder = 'Ask anything...',\n toolbarStart,\n}) => {\n const tr = useTr();\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n const handleSend = useCallback(() => {\n const textarea = textareaRef.current;\n if (!textarea) return;\n\n const value = textarea.value.trim();\n if (!value || disabled) return;\n\n onSend(value);\n textarea.value = '';\n textarea.style.height = 'auto';\n }, [onSend, disabled]);\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n handleSend();\n }\n },\n [handleSend]\n );\n\n const handleInput = useCallback(() => {\n const textarea = textareaRef.current;\n if (!textarea) return;\n textarea.style.height = 'auto';\n textarea.style.height = `${Math.min(textarea.scrollHeight, 140)}px`;\n }, []);\n\n return (\n <div className=\"px-
|
|
1
|
+
{"version":3,"file":"AssistantChatInput.js","names":[],"sources":["../../../src/components/assistant/AssistantChatInput.tsx"],"sourcesContent":["import { useRef, useCallback, type FC, type KeyboardEvent, type ReactNode } from 'react';\nimport { ArrowUp } from 'lucide-react';\nimport { useTr } from '../../shared/hooks/useTr';\n\ninterface Props {\n onSend: (message: string) => void;\n disabled?: boolean;\n placeholder?: string;\n /** Rendered inline on the left of the composer toolbar (e.g. the mode chip). */\n toolbarStart?: ReactNode;\n}\n\n/**\n * Composer — a single rounded \"card\" (Google-Stitch-style) holding the textarea\n * with an inline bottom toolbar: contextual controls on the left (mode chip) and\n * a circular send up-arrow on the right. The whole card lifts its border on\n * focus. Uses HB semantic tokens only.\n */\nexport const AssistantChatInput: FC<Props> = ({\n onSend,\n disabled = false,\n placeholder = 'Ask anything...',\n toolbarStart,\n}) => {\n const tr = useTr();\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n const handleSend = useCallback(() => {\n const textarea = textareaRef.current;\n if (!textarea) return;\n\n const value = textarea.value.trim();\n if (!value || disabled) return;\n\n onSend(value);\n textarea.value = '';\n textarea.style.height = 'auto';\n }, [onSend, disabled]);\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n handleSend();\n }\n },\n [handleSend]\n );\n\n const handleInput = useCallback(() => {\n const textarea = textareaRef.current;\n if (!textarea) return;\n textarea.style.height = 'auto';\n textarea.style.height = `${Math.min(textarea.scrollHeight, 140)}px`;\n }, []);\n\n return (\n <div className=\"px-4 pb-4 pt-2\">\n {/* Single-row rounded \"pill\" composer (Google-Gemini style): the mode chip\n on the left, the input in the middle, a circular send on the right. */}\n <div className=\"flex items-center gap-1 rounded-[26px] border border-border-default bg-bg-sunken py-1.5 pl-2 pr-2 shadow-sm transition-all focus-within:border-action-primary-bg focus-within:shadow-md focus-within:ring-2 focus-within:ring-action-primary-bg/15\">\n {toolbarStart ? <div className=\"flex flex-shrink-0 items-center gap-1\">{toolbarStart}</div> : null}\n <textarea\n ref={textareaRef}\n onKeyDown={handleKeyDown}\n onInput={handleInput}\n disabled={disabled}\n placeholder={placeholder}\n rows={1}\n className=\"min-w-0 flex-1 resize-none bg-transparent px-2 py-1.5 text-[13px] leading-relaxed text-text-primary placeholder:text-text-muted focus:outline-none disabled:opacity-50\"\n aria-label={tr('healthybowl.assistant.chatInput.ariaLabel', 'Message input')}\n data-testid=\"assistant-input\"\n />\n <button\n type=\"button\"\n onClick={handleSend}\n disabled={disabled}\n className=\"flex size-9 flex-shrink-0 items-center justify-center rounded-full bg-action-primary-bg text-action-primary-text shadow-sm transition-all hover:bg-action-primary-bg-hover hover:scale-105 focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong disabled:scale-100 disabled:opacity-40\"\n aria-label={tr('healthybowl.assistant.chatInput.send', 'Send message')}\n data-testid=\"assistant-send\"\n >\n <ArrowUp className=\"size-4\" />\n </button>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;AAkBA,IAAa,KAAiC,EAC5C,WACA,cAAW,IACX,iBAAc,mBACd,sBACI;CACJ,IAAM,IAAK,GAAO,EACZ,IAAc,EAA4B,KAAK,EAE/C,IAAa,QAAkB;EACnC,IAAM,IAAW,EAAY;AAC7B,MAAI,CAAC,EAAU;EAEf,IAAM,IAAQ,EAAS,MAAM,MAAM;AAC/B,GAAC,KAAS,MAEd,EAAO,EAAM,EACb,EAAS,QAAQ,IACjB,EAAS,MAAM,SAAS;IACvB,CAAC,GAAQ,EAAS,CAAC,EAEhB,IAAgB,GACnB,MAA0C;AACzC,EAAI,EAAE,QAAQ,WAAW,CAAC,EAAE,aAC1B,EAAE,gBAAgB,EAClB,GAAY;IAGhB,CAAC,EAAW,CACb,EAEK,IAAc,QAAkB;EACpC,IAAM,IAAW,EAAY;AACxB,QACL,EAAS,MAAM,SAAS,QACxB,EAAS,MAAM,SAAS,GAAG,KAAK,IAAI,EAAS,cAAc,IAAI,CAAC;IAC/D,EAAE,CAAC;AAEN,QACE,kBAAC,OAAD;EAAK,WAAU;YAGb,kBAAC,OAAD;GAAK,WAAU;aAAf;IACG,IAAe,kBAAC,OAAD;KAAK,WAAU;eAAyC;KAAmB,CAAA,GAAG;IAC9F,kBAAC,YAAD;KACE,KAAK;KACL,WAAW;KACX,SAAS;KACC;KACG;KACb,MAAM;KACN,WAAU;KACV,cAAY,EAAG,6CAA6C,gBAAgB;KAC5E,eAAY;KACZ,CAAA;IACF,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACC;KACV,WAAU;KACV,cAAY,EAAG,wCAAwC,eAAe;KACtE,eAAY;eAEZ,kBAAC,GAAD,EAAS,WAAU,UAAW,CAAA;KACvB,CAAA;IACL;;EACF,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { useAssistantStore as e } from "../../store/assistantStore.js";
|
|
|
2
2
|
import { useTr as t } from "../../shared/hooks/useTr.js";
|
|
3
3
|
import { ASSISTANT_MODES as n } from "../../types/assistant.js";
|
|
4
4
|
import { useState as r } from "react";
|
|
5
|
-
import { Check as i, MessageSquare as a,
|
|
5
|
+
import { Check as i, MessageSquare as a, PanelLeftClose as o, Pencil as s, Plus as c, Trash2 as l } from "lucide-react";
|
|
6
6
|
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/assistant/AssistantConversationList.tsx
|
|
8
8
|
var p = () => {
|
|
@@ -19,28 +19,32 @@ var p = () => {
|
|
|
19
19
|
e.stopPropagation(), b(t);
|
|
20
20
|
};
|
|
21
21
|
return /* @__PURE__ */ f("div", {
|
|
22
|
-
className: "absolute inset-0 z-10 flex flex-col bg-bg-surface",
|
|
22
|
+
className: "absolute inset-0 z-10 flex flex-col bg-bg-surface animate-in slide-in-from-left-2 fade-in duration-200",
|
|
23
23
|
"data-testid": "conversation-list",
|
|
24
24
|
children: [/* @__PURE__ */ f("div", {
|
|
25
|
-
className: "flex items-center justify-between px-
|
|
25
|
+
className: "flex items-center justify-between px-4 py-3 border-b border-border-default bg-bg-elevated",
|
|
26
26
|
children: [/* @__PURE__ */ d("span", {
|
|
27
|
-
className: "text-
|
|
28
|
-
children: p("healthybowl.assistant.conversations.title", "
|
|
27
|
+
className: "text-[13px] font-semibold text-text-primary",
|
|
28
|
+
children: p("healthybowl.assistant.conversations.title", "History")
|
|
29
29
|
}), /* @__PURE__ */ f("div", {
|
|
30
|
-
className: "flex items-center gap-
|
|
30
|
+
className: "flex items-center gap-0.5",
|
|
31
31
|
children: [/* @__PURE__ */ d("button", {
|
|
32
32
|
type: "button",
|
|
33
33
|
onClick: D,
|
|
34
|
-
className: "p-1 hover:bg-bg-
|
|
34
|
+
className: "p-1.5 rounded-lg text-text-secondary hover:bg-bg-sunken transition-colors",
|
|
35
35
|
"aria-label": p("healthybowl.assistant.conversations.new", "New conversation"),
|
|
36
36
|
"data-testid": "new-conversation",
|
|
37
|
-
children: /* @__PURE__ */ d(
|
|
38
|
-
}), /* @__PURE__ */
|
|
37
|
+
children: /* @__PURE__ */ d(c, { className: "size-4" })
|
|
38
|
+
}), /* @__PURE__ */ f("button", {
|
|
39
39
|
type: "button",
|
|
40
40
|
onClick: () => S(!1),
|
|
41
|
-
className: "
|
|
42
|
-
"aria-label": "
|
|
43
|
-
|
|
41
|
+
className: "flex items-center gap-1 px-2 py-1.5 rounded-lg text-text-secondary hover:bg-bg-sunken transition-colors",
|
|
42
|
+
"aria-label": p("healthybowl.assistant.conversations.collapse", "Collapse history"),
|
|
43
|
+
"data-testid": "collapse-conversation-list",
|
|
44
|
+
children: [/* @__PURE__ */ d(o, { className: "size-4" }), /* @__PURE__ */ d("span", {
|
|
45
|
+
className: "text-[11px] font-medium",
|
|
46
|
+
children: p("healthybowl.assistant.conversations.collapseLabel", "Collapse")
|
|
47
|
+
})]
|
|
44
48
|
})]
|
|
45
49
|
})]
|
|
46
50
|
}), /* @__PURE__ */ d("div", {
|
|
@@ -63,7 +67,7 @@ var p = () => {
|
|
|
63
67
|
}) : /* @__PURE__ */ d("div", {
|
|
64
68
|
className: "py-1",
|
|
65
69
|
children: m.map((e) => {
|
|
66
|
-
let t = e.id === h, r = e.id === C, a = n.find((t) => t.id === e.mode),
|
|
70
|
+
let t = e.id === h, r = e.id === C, a = n.find((t) => t.id === e.mode), o = e.messages[e.messages.length - 1], c = g[e.id];
|
|
67
71
|
return /* @__PURE__ */ d("div", {
|
|
68
72
|
role: "button",
|
|
69
73
|
tabIndex: 0,
|
|
@@ -75,7 +79,7 @@ var p = () => {
|
|
|
75
79
|
children: r ? /* @__PURE__ */ f("div", {
|
|
76
80
|
className: "flex items-center gap-1",
|
|
77
81
|
children: [/* @__PURE__ */ d("input", {
|
|
78
|
-
"aria-label": "
|
|
82
|
+
"aria-label": p("healthybowl.assistant.conversations.renameLabel", "Conversation title"),
|
|
79
83
|
value: T,
|
|
80
84
|
onChange: (e) => E(e.target.value),
|
|
81
85
|
onKeyDown: (e) => {
|
|
@@ -106,14 +110,14 @@ var p = () => {
|
|
|
106
110
|
},
|
|
107
111
|
className: "p-0.5 hover:bg-bg-sunken rounded",
|
|
108
112
|
"aria-label": "Rename conversation",
|
|
109
|
-
children: /* @__PURE__ */ d(
|
|
113
|
+
children: /* @__PURE__ */ d(s, { className: "size-3 text-text-muted" })
|
|
110
114
|
}), /* @__PURE__ */ d("button", {
|
|
111
115
|
type: "button",
|
|
112
116
|
onClick: (t) => j(t, e.id),
|
|
113
117
|
className: "p-0.5 hover:bg-bg-sunken rounded",
|
|
114
118
|
"aria-label": "Delete conversation",
|
|
115
119
|
"data-testid": "delete-conversation",
|
|
116
|
-
children: /* @__PURE__ */ d(
|
|
120
|
+
children: /* @__PURE__ */ d(l, { className: "size-3 text-status-error-text" })
|
|
117
121
|
})]
|
|
118
122
|
})]
|
|
119
123
|
}),
|
|
@@ -128,15 +132,15 @@ var p = () => {
|
|
|
128
132
|
className: "text-[10px] text-text-muted",
|
|
129
133
|
children: [e.messages.length, " msgs"]
|
|
130
134
|
}),
|
|
131
|
-
|
|
135
|
+
c && c.status !== "idle" && /* @__PURE__ */ d("span", {
|
|
132
136
|
className: "text-[10px] text-action-primary-bg px-1 py-0.5 bg-bg-sunken rounded",
|
|
133
|
-
children:
|
|
137
|
+
children: c.status
|
|
134
138
|
})
|
|
135
139
|
]
|
|
136
140
|
}),
|
|
137
|
-
|
|
141
|
+
o && /* @__PURE__ */ d("p", {
|
|
138
142
|
className: "text-[10px] text-text-muted truncate mt-0.5",
|
|
139
|
-
children:
|
|
143
|
+
children: o.content.slice(0, 60)
|
|
140
144
|
})
|
|
141
145
|
] })
|
|
142
146
|
}, e.id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantConversationList.js","names":[],"sources":["../../../src/components/assistant/AssistantConversationList.tsx"],"sourcesContent":["import { useState, type FC } from 'react';\nimport { Plus, Trash2, MessageSquare, X, Pencil, Check } from 'lucide-react';\nimport { useAssistantStore } from '@/store/assistantStore';\nimport { ASSISTANT_MODES } from '@/types/assistant';\nimport { useTr } from '../../shared/hooks/useTr';\n\nexport const AssistantConversationList: FC = () => {\n const tr = useTr();\n const {\n conversations,\n activeConversationId,\n processingByConversationId,\n setActiveConversation,\n setMode,\n createConversation,\n deleteConversation,\n renameConversation,\n setConversationListOpen,\n } = useAssistantStore();\n\n const [editingId, setEditingId] = useState<string | null>(null);\n const [editTitle, setEditTitle] = useState('');\n\n const handleCreate = () => {\n createConversation();\n setConversationListOpen(false);\n };\n\n const handleSelect = (id: string) => {\n const selectedConversation = conversations.find((conversation) => conversation.id === id);\n setActiveConversation(id);\n if (selectedConversation) {\n setMode(selectedConversation.mode);\n }\n setConversationListOpen(false);\n };\n\n const handleStartRename = (id: string, currentTitle: string) => {\n setEditingId(id);\n setEditTitle(currentTitle);\n };\n\n const handleConfirmRename = () => {\n if (editingId && editTitle.trim()) {\n renameConversation(editingId, editTitle.trim());\n }\n setEditingId(null);\n };\n\n const handleDelete = (e: React.MouseEvent, id: string) => {\n e.stopPropagation();\n deleteConversation(id);\n };\n\n return (\n <div className=\"absolute inset-0 z-10 flex flex-col bg-bg-surface\" data-testid=\"conversation-list\">\n {/* Header */}\n <div className=\"flex items-center justify-between px-3 py-2 border-b border-border-default\">\n <span className=\"text-xs font-semibold text-text-primary\">\n {tr('healthybowl.assistant.conversations.title', 'Conversations')}\n </span>\n <div className=\"flex items-center gap-1\">\n <button\n type=\"button\"\n onClick={handleCreate}\n className=\"p-1 hover:bg-bg-elevated rounded transition-colors\"\n aria-label={tr('healthybowl.assistant.conversations.new', 'New conversation')}\n data-testid=\"new-conversation\"\n >\n <Plus className=\"size-3.5 text-text-secondary\" />\n </button>\n <button\n type=\"button\"\n onClick={() => setConversationListOpen(false)}\n className=\"p-1 hover:bg-bg-elevated rounded transition-colors\"\n aria-label=\"Close conversation list\"\n >\n <X className=\"size-3.5 text-text-secondary\" />\n </button>\n </div>\n </div>\n\n {/* List */}\n <div className=\"flex-1 overflow-y-auto\">\n {conversations.length === 0 ? (\n <div className=\"flex flex-col items-center justify-center h-full text-center px-4\">\n <MessageSquare className=\"size-6 text-text-muted mb-2\" />\n <p className=\"text-xs text-text-muted\">\n {tr('healthybowl.assistant.conversations.empty', 'No conversations yet')}\n </p>\n <button\n type=\"button\"\n onClick={handleCreate}\n className=\"mt-2 text-xs text-action-primary-bg hover:underline\"\n >\n {tr('healthybowl.assistant.conversations.startNew', 'Start a new conversation')}\n </button>\n </div>\n ) : (\n <div className=\"py-1\">\n {conversations.map((conv) => {\n const isActive = conv.id === activeConversationId;\n const isEditing = conv.id === editingId;\n const modeConfig = ASSISTANT_MODES.find((m) => m.id === conv.mode);\n const lastMessage = conv.messages[conv.messages.length - 1];\n const processing = processingByConversationId[conv.id];\n\n return (\n <div\n role=\"button\"\n tabIndex={0}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n (() => !isEditing && handleSelect(conv.id))();\n }\n }}\n key={conv.id}\n onClick={() => !isEditing && handleSelect(conv.id)}\n className={`group px-3 py-2 cursor-pointer hover:bg-bg-elevated transition-colors ${\n isActive ? 'bg-bg-elevated border-l-2 border-action-primary-bg' : ''\n }`}\n >\n {isEditing ? (\n <div className=\"flex items-center gap-1\">\n <input\n aria-label=\"control\"\n value={editTitle}\n onChange={(e) => setEditTitle(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') handleConfirmRename();\n if (e.key === 'Escape') setEditingId(null);\n }}\n className=\"flex-1 text-xs bg-bg-sunken border border-border-default rounded px-2 py-1 text-text-primary focus:outline-none focus:border-action-primary-bg\"\n onClick={(e) => e.stopPropagation()}\n />\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation();\n handleConfirmRename();\n }}\n className=\"p-1 hover:bg-bg-sunken rounded\"\n >\n <Check className=\"size-3 text-status-success-text\" />\n </button>\n </div>\n ) : (\n <>\n <div className=\"flex items-center justify-between\">\n <span className=\"text-xs font-medium text-text-primary truncate flex-1\">{conv.title}</span>\n <div className=\"hidden group-hover:flex items-center gap-0.5 ml-1\">\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation();\n handleStartRename(conv.id, conv.title);\n }}\n className=\"p-0.5 hover:bg-bg-sunken rounded\"\n aria-label=\"Rename conversation\"\n >\n <Pencil className=\"size-3 text-text-muted\" />\n </button>\n <button\n type=\"button\"\n onClick={(e) => handleDelete(e, conv.id)}\n className=\"p-0.5 hover:bg-bg-sunken rounded\"\n aria-label=\"Delete conversation\"\n data-testid=\"delete-conversation\"\n >\n <Trash2 className=\"size-3 text-status-error-text\" />\n </button>\n </div>\n </div>\n <div className=\"flex items-center gap-1.5 mt-0.5\">\n <span className=\"text-[10px] text-text-muted px-1 py-0.5 bg-bg-sunken rounded\">\n {modeConfig?.label ?? conv.mode}\n </span>\n <span className=\"text-[10px] text-text-muted\">{conv.messages.length} msgs</span>\n {processing && processing.status !== 'idle' && (\n <span className=\"text-[10px] text-action-primary-bg px-1 py-0.5 bg-bg-sunken rounded\">\n {processing.status}\n </span>\n )}\n </div>\n {lastMessage && (\n <p className=\"text-[10px] text-text-muted truncate mt-0.5\">\n {lastMessage.content.slice(0, 60)}\n </p>\n )}\n </>\n )}\n </div>\n );\n })}\n </div>\n )}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;AAMA,IAAa,UAAsC;CACjD,IAAM,IAAK,GAAO,EACZ,EACJ,kBACA,yBACA,+BACA,0BACA,YACA,uBACA,uBACA,uBACA,+BACE,GAAmB,EAEjB,CAAC,GAAW,KAAgB,EAAwB,KAAK,EACzD,CAAC,GAAW,KAAgB,EAAS,GAAG,EAExC,UAAqB;AAEzB,EADA,GAAoB,EACpB,EAAwB,GAAM;IAG1B,KAAgB,MAAe;EACnC,IAAM,IAAuB,EAAc,MAAM,MAAiB,EAAa,OAAO,EAAG;AAKzF,EAJA,EAAsB,EAAG,EACrB,KACF,EAAQ,EAAqB,KAAK,EAEpC,EAAwB,GAAM;IAG1B,KAAqB,GAAY,MAAyB;AAE9D,EADA,EAAa,EAAG,EAChB,EAAa,EAAa;IAGtB,UAA4B;AAIhC,EAHI,KAAa,EAAU,MAAM,IAC/B,EAAmB,GAAW,EAAU,MAAM,CAAC,EAEjD,EAAa,KAAK;IAGd,KAAgB,GAAqB,MAAe;AAExD,EADA,EAAE,iBAAiB,EACnB,EAAmB,EAAG;;AAGxB,QACE,kBAAC,OAAD;EAAK,WAAU;EAAoD,eAAY;YAA/E,CA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ACC,kBAAC,KAAD;QAAG,WAAU;kBACV,EAAY,QAAQ,MAAM,GAAG,GAAG;QAC/B,CAAA;OAEL,EAAA,CAAA;MAED,EA3EC,EAAK,GA2EN;MAER;IACE,CAAA;GAEJ,CAAA,CACF"}
|
|
1
|
+
{"version":3,"file":"AssistantConversationList.js","names":[],"sources":["../../../src/components/assistant/AssistantConversationList.tsx"],"sourcesContent":["import { useState, type FC } from 'react';\nimport { Plus, Trash2, MessageSquare, PanelLeftClose, Pencil, Check } from 'lucide-react';\nimport { useAssistantStore } from '@/store/assistantStore';\nimport { ASSISTANT_MODES } from '@/types/assistant';\nimport { useTr } from '../../shared/hooks/useTr';\n\nexport const AssistantConversationList: FC = () => {\n const tr = useTr();\n const {\n conversations,\n activeConversationId,\n processingByConversationId,\n setActiveConversation,\n setMode,\n createConversation,\n deleteConversation,\n renameConversation,\n setConversationListOpen,\n } = useAssistantStore();\n\n const [editingId, setEditingId] = useState<string | null>(null);\n const [editTitle, setEditTitle] = useState('');\n\n const handleCreate = () => {\n createConversation();\n setConversationListOpen(false);\n };\n\n const handleSelect = (id: string) => {\n const selectedConversation = conversations.find((conversation) => conversation.id === id);\n setActiveConversation(id);\n if (selectedConversation) {\n setMode(selectedConversation.mode);\n }\n setConversationListOpen(false);\n };\n\n const handleStartRename = (id: string, currentTitle: string) => {\n setEditingId(id);\n setEditTitle(currentTitle);\n };\n\n const handleConfirmRename = () => {\n if (editingId && editTitle.trim()) {\n renameConversation(editingId, editTitle.trim());\n }\n setEditingId(null);\n };\n\n const handleDelete = (e: React.MouseEvent, id: string) => {\n e.stopPropagation();\n deleteConversation(id);\n };\n\n return (\n <div\n className=\"absolute inset-0 z-10 flex flex-col bg-bg-surface animate-in slide-in-from-left-2 fade-in duration-200\"\n data-testid=\"conversation-list\"\n >\n {/* Header */}\n <div className=\"flex items-center justify-between px-4 py-3 border-b border-border-default bg-bg-elevated\">\n <span className=\"text-[13px] font-semibold text-text-primary\">\n {tr('healthybowl.assistant.conversations.title', 'History')}\n </span>\n <div className=\"flex items-center gap-0.5\">\n <button\n type=\"button\"\n onClick={handleCreate}\n className=\"p-1.5 rounded-lg text-text-secondary hover:bg-bg-sunken transition-colors\"\n aria-label={tr('healthybowl.assistant.conversations.new', 'New conversation')}\n data-testid=\"new-conversation\"\n >\n <Plus className=\"size-4\" />\n </button>\n <button\n type=\"button\"\n onClick={() => setConversationListOpen(false)}\n className=\"flex items-center gap-1 px-2 py-1.5 rounded-lg text-text-secondary hover:bg-bg-sunken transition-colors\"\n aria-label={tr('healthybowl.assistant.conversations.collapse', 'Collapse history')}\n data-testid=\"collapse-conversation-list\"\n >\n <PanelLeftClose className=\"size-4\" />\n <span className=\"text-[11px] font-medium\">\n {tr('healthybowl.assistant.conversations.collapseLabel', 'Collapse')}\n </span>\n </button>\n </div>\n </div>\n\n {/* List */}\n <div className=\"flex-1 overflow-y-auto\">\n {conversations.length === 0 ? (\n <div className=\"flex flex-col items-center justify-center h-full text-center px-4\">\n <MessageSquare className=\"size-6 text-text-muted mb-2\" />\n <p className=\"text-xs text-text-muted\">\n {tr('healthybowl.assistant.conversations.empty', 'No conversations yet')}\n </p>\n <button\n type=\"button\"\n onClick={handleCreate}\n className=\"mt-2 text-xs text-action-primary-bg hover:underline\"\n >\n {tr('healthybowl.assistant.conversations.startNew', 'Start a new conversation')}\n </button>\n </div>\n ) : (\n <div className=\"py-1\">\n {conversations.map((conv) => {\n const isActive = conv.id === activeConversationId;\n const isEditing = conv.id === editingId;\n const modeConfig = ASSISTANT_MODES.find((m) => m.id === conv.mode);\n const lastMessage = conv.messages[conv.messages.length - 1];\n const processing = processingByConversationId[conv.id];\n\n return (\n <div\n role=\"button\"\n tabIndex={0}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n (() => !isEditing && handleSelect(conv.id))();\n }\n }}\n key={conv.id}\n onClick={() => !isEditing && handleSelect(conv.id)}\n className={`group px-3 py-2 cursor-pointer hover:bg-bg-elevated transition-colors ${\n isActive ? 'bg-bg-elevated border-l-2 border-action-primary-bg' : ''\n }`}\n >\n {isEditing ? (\n <div className=\"flex items-center gap-1\">\n <input\n aria-label={tr('healthybowl.assistant.conversations.renameLabel', 'Conversation title')}\n value={editTitle}\n onChange={(e) => setEditTitle(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') handleConfirmRename();\n if (e.key === 'Escape') setEditingId(null);\n }}\n className=\"flex-1 text-xs bg-bg-sunken border border-border-default rounded px-2 py-1 text-text-primary focus:outline-none focus:border-action-primary-bg\"\n onClick={(e) => e.stopPropagation()}\n />\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation();\n handleConfirmRename();\n }}\n className=\"p-1 hover:bg-bg-sunken rounded\"\n >\n <Check className=\"size-3 text-status-success-text\" />\n </button>\n </div>\n ) : (\n <>\n <div className=\"flex items-center justify-between\">\n <span className=\"text-xs font-medium text-text-primary truncate flex-1\">{conv.title}</span>\n <div className=\"hidden group-hover:flex items-center gap-0.5 ml-1\">\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation();\n handleStartRename(conv.id, conv.title);\n }}\n className=\"p-0.5 hover:bg-bg-sunken rounded\"\n aria-label=\"Rename conversation\"\n >\n <Pencil className=\"size-3 text-text-muted\" />\n </button>\n <button\n type=\"button\"\n onClick={(e) => handleDelete(e, conv.id)}\n className=\"p-0.5 hover:bg-bg-sunken rounded\"\n aria-label=\"Delete conversation\"\n data-testid=\"delete-conversation\"\n >\n <Trash2 className=\"size-3 text-status-error-text\" />\n </button>\n </div>\n </div>\n <div className=\"flex items-center gap-1.5 mt-0.5\">\n <span className=\"text-[10px] text-text-muted px-1 py-0.5 bg-bg-sunken rounded\">\n {modeConfig?.label ?? conv.mode}\n </span>\n <span className=\"text-[10px] text-text-muted\">{conv.messages.length} msgs</span>\n {processing && processing.status !== 'idle' && (\n <span className=\"text-[10px] text-action-primary-bg px-1 py-0.5 bg-bg-sunken rounded\">\n {processing.status}\n </span>\n )}\n </div>\n {lastMessage && (\n <p className=\"text-[10px] text-text-muted truncate mt-0.5\">\n {lastMessage.content.slice(0, 60)}\n </p>\n )}\n </>\n )}\n </div>\n );\n })}\n </div>\n )}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;AAMA,IAAa,UAAsC;CACjD,IAAM,IAAK,GAAO,EACZ,EACJ,kBACA,yBACA,+BACA,0BACA,YACA,uBACA,uBACA,uBACA,+BACE,GAAmB,EAEjB,CAAC,GAAW,KAAgB,EAAwB,KAAK,EACzD,CAAC,GAAW,KAAgB,EAAS,GAAG,EAExC,UAAqB;AAEzB,EADA,GAAoB,EACpB,EAAwB,GAAM;IAG1B,KAAgB,MAAe;EACnC,IAAM,IAAuB,EAAc,MAAM,MAAiB,EAAa,OAAO,EAAG;AAKzF,EAJA,EAAsB,EAAG,EACrB,KACF,EAAQ,EAAqB,KAAK,EAEpC,EAAwB,GAAM;IAG1B,KAAqB,GAAY,MAAyB;AAE9D,EADA,EAAa,EAAG,EAChB,EAAa,EAAa;IAGtB,UAA4B;AAIhC,EAHI,KAAa,EAAU,MAAM,IAC/B,EAAmB,GAAW,EAAU,MAAM,CAAC,EAEjD,EAAa,KAAK;IAGd,KAAgB,GAAqB,MAAe;AAExD,EADA,EAAE,iBAAiB,EACnB,EAAmB,EAAG;;AAGxB,QACE,kBAAC,OAAD;EACE,WAAU;EACV,eAAY;YAFd,CAKE,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,QAAD;IAAM,WAAU;cACb,EAAG,6CAA6C,UAAU;IACtD,CAAA,EACP,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,WAAU;KACV,cAAY,EAAG,2CAA2C,mBAAmB;KAC7E,eAAY;eAEZ,kBAAC,GAAD,EAAM,WAAU,UAAW,CAAA;KACpB,CAAA,EACT,kBAAC,UAAD;KACE,MAAK;KACL,eAAe,EAAwB,GAAM;KAC7C,WAAU;KACV,cAAY,EAA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: s }) => {
|
|
7
7
|
let c = e(), l = t.find((e) => e.id === o) ?? t[0];
|
|
8
8
|
return /* @__PURE__ */ a("div", {
|
|
9
|
-
className: "flex-1 overflow-y-auto px-
|
|
9
|
+
className: "flex-1 overflow-y-auto px-5 py-8",
|
|
10
10
|
children: [
|
|
11
11
|
/* @__PURE__ */ i("div", {
|
|
12
|
-
className: "flex size-
|
|
13
|
-
children: /* @__PURE__ */ i(r, { className: "size-
|
|
12
|
+
className: "flex size-12 items-center justify-center rounded-2xl bg-gradient-to-br from-action-primary-bg/25 to-action-primary-bg/5 text-action-primary-bg shadow-sm",
|
|
13
|
+
children: /* @__PURE__ */ i(r, { className: "size-6" })
|
|
14
14
|
}),
|
|
15
15
|
/* @__PURE__ */ i("h2", {
|
|
16
|
-
className: "mt-
|
|
16
|
+
className: "mt-5 text-2xl font-semibold leading-tight tracking-tight text-text-primary",
|
|
17
17
|
children: c("healthybowl.assistant.welcome.title", "How can I help?")
|
|
18
18
|
}),
|
|
19
19
|
/* @__PURE__ */ i("p", {
|
|
20
|
-
className: "mt-1 text-
|
|
20
|
+
className: "mt-1.5 text-[13px] leading-relaxed text-text-muted",
|
|
21
21
|
children: l.description
|
|
22
22
|
}),
|
|
23
23
|
/* @__PURE__ */ a("div", {
|
|
24
|
-
className: "mt-
|
|
24
|
+
className: "mt-7 space-y-2.5",
|
|
25
25
|
children: [/* @__PURE__ */ a("div", {
|
|
26
|
-
className: "flex items-center gap-1 px-0.5 text-[10px] uppercase tracking-wider text-text-muted",
|
|
26
|
+
className: "flex items-center gap-1.5 px-0.5 text-[10px] font-medium uppercase tracking-wider text-text-muted",
|
|
27
27
|
children: [/* @__PURE__ */ i(r, { className: "size-3" }), /* @__PURE__ */ i("span", { children: c("healthybowl.assistant.welcome.suggestions", "Suggestions") })]
|
|
28
28
|
}), l.suggestions.map((e) => /* @__PURE__ */ a("button", {
|
|
29
29
|
type: "button",
|
|
30
30
|
onClick: () => s(e),
|
|
31
|
-
className: "group flex w-full items-center justify-between gap-2 rounded-xl border border-border-subtle bg-bg-
|
|
31
|
+
className: "group flex w-full items-center justify-between gap-2.5 rounded-xl border border-border-subtle bg-bg-surface px-3.5 py-3 text-left text-[13px] leading-relaxed text-text-primary shadow-sm transition-all hover:border-action-primary-bg/40 hover:bg-bg-elevated hover:shadow-md",
|
|
32
32
|
"data-testid": "assistant-suggestion",
|
|
33
33
|
children: [/* @__PURE__ */ i("span", {
|
|
34
34
|
className: "min-w-0",
|
|
35
35
|
children: e
|
|
36
|
-
}), /* @__PURE__ */ i(n, { className: "size-
|
|
36
|
+
}), /* @__PURE__ */ i(n, { className: "size-4 flex-shrink-0 text-text-muted transition-all group-hover:translate-x-0.5 group-hover:-translate-y-0.5 group-hover:text-action-primary-bg" })]
|
|
37
37
|
}, e))]
|
|
38
38
|
})
|
|
39
39
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantWelcome.js","names":[],"sources":["../../../src/components/assistant/AssistantWelcome.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { Sparkles, ArrowUpRight } from 'lucide-react';\nimport type { AssistantMode } from '@/types/assistant';\nimport { ASSISTANT_MODES } from '@/types/assistant';\nimport { useTr } from '../../shared/hooks/useTr';\n\ninterface Props {\n mode: AssistantMode;\n onSuggestionClick: (suggestion: string) => void;\n}\n\n/**\n * Empty-state welcome (Google-Stitch-style): a soft gradient sparkle mark, a\n * large greeting, and rounded suggestion \"pills\" the user can tap to start.\n * HB semantic tokens only.\n */\nexport const AssistantWelcome: FC<Props> = ({ mode, onSuggestionClick }) => {\n const tr = useTr();\n // Fall back to the first mode if the active mode is no longer offered (e.g. a\n // persisted api-calls mode after the master flag was turned off) — the chat\n // area resets `mode` to general on the next tick; this avoids a render crash.\n const modeConfig = ASSISTANT_MODES.find((m) => m.id === mode) ?? ASSISTANT_MODES[0];\n\n return (\n <div className=\"flex-1 overflow-y-auto px-
|
|
1
|
+
{"version":3,"file":"AssistantWelcome.js","names":[],"sources":["../../../src/components/assistant/AssistantWelcome.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { Sparkles, ArrowUpRight } from 'lucide-react';\nimport type { AssistantMode } from '@/types/assistant';\nimport { ASSISTANT_MODES } from '@/types/assistant';\nimport { useTr } from '../../shared/hooks/useTr';\n\ninterface Props {\n mode: AssistantMode;\n onSuggestionClick: (suggestion: string) => void;\n}\n\n/**\n * Empty-state welcome (Google-Stitch-style): a soft gradient sparkle mark, a\n * large greeting, and rounded suggestion \"pills\" the user can tap to start.\n * HB semantic tokens only.\n */\nexport const AssistantWelcome: FC<Props> = ({ mode, onSuggestionClick }) => {\n const tr = useTr();\n // Fall back to the first mode if the active mode is no longer offered (e.g. a\n // persisted api-calls mode after the master flag was turned off) — the chat\n // area resets `mode` to general on the next tick; this avoids a render crash.\n const modeConfig = ASSISTANT_MODES.find((m) => m.id === mode) ?? ASSISTANT_MODES[0];\n\n return (\n <div className=\"flex-1 overflow-y-auto px-5 py-8\">\n <div className=\"flex size-12 items-center justify-center rounded-2xl bg-gradient-to-br from-action-primary-bg/25 to-action-primary-bg/5 text-action-primary-bg shadow-sm\">\n <Sparkles className=\"size-6\" />\n </div>\n <h2 className=\"mt-5 text-2xl font-semibold leading-tight tracking-tight text-text-primary\">\n {tr('healthybowl.assistant.welcome.title', 'How can I help?')}\n </h2>\n <p className=\"mt-1.5 text-[13px] leading-relaxed text-text-muted\">{modeConfig.description}</p>\n\n <div className=\"mt-7 space-y-2.5\">\n <div className=\"flex items-center gap-1.5 px-0.5 text-[10px] font-medium uppercase tracking-wider text-text-muted\">\n <Sparkles className=\"size-3\" />\n <span>{tr('healthybowl.assistant.welcome.suggestions', 'Suggestions')}</span>\n </div>\n {modeConfig.suggestions.map((suggestion) => (\n <button\n type=\"button\"\n key={suggestion}\n onClick={() => onSuggestionClick(suggestion)}\n className=\"group flex w-full items-center justify-between gap-2.5 rounded-xl border border-border-subtle bg-bg-surface px-3.5 py-3 text-left text-[13px] leading-relaxed text-text-primary shadow-sm transition-all hover:border-action-primary-bg/40 hover:bg-bg-elevated hover:shadow-md\"\n data-testid=\"assistant-suggestion\"\n >\n <span className=\"min-w-0\">{suggestion}</span>\n <ArrowUpRight className=\"size-4 flex-shrink-0 text-text-muted transition-all group-hover:translate-x-0.5 group-hover:-translate-y-0.5 group-hover:text-action-primary-bg\" />\n </button>\n ))}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;AAgBA,IAAa,KAA+B,EAAE,SAAM,2BAAwB;CAC1E,IAAM,IAAK,GAAO,EAIZ,IAAa,EAAgB,MAAM,MAAM,EAAE,OAAO,EAAK,IAAI,EAAgB;AAEjF,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf;GACE,kBAAC,OAAD;IAAK,WAAU;cACb,kBAAC,GAAD,EAAU,WAAU,UAAW,CAAA;IAC3B,CAAA;GACN,kBAAC,MAAD;IAAI,WAAU;cACX,EAAG,uCAAuC,kBAAkB;IAC1D,CAAA;GACL,kBAAC,KAAD;IAAG,WAAU;cAAsD,EAAW;IAAgB,CAAA;GAE9F,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,GAAD,EAAU,WAAU,UAAW,CAAA,EAC/B,kBAAC,QAAD,EAAA,UAAO,EAAG,6CAA6C,cAAc,EAAQ,CAAA,CACzE;QACL,EAAW,YAAY,KAAK,MAC3B,kBAAC,UAAD;KACE,MAAK;KAEL,eAAe,EAAkB,EAAW;KAC5C,WAAU;KACV,eAAY;eALd,CAOE,kBAAC,QAAD;MAAM,WAAU;gBAAW;MAAkB,CAAA,EAC7C,kBAAC,GAAD,EAAc,WAAU,mJAAoJ,CAAA,CACrK;OAPF,EAOE,CACT,CACE;;GACF"}
|
package/package.json
CHANGED