From fd39e8df418bcbd96eda1334025f57d6b19617e8 Mon Sep 17 00:00:00 2001 From: Douglas Lai <115660088+Douglasymlai@users.noreply.github.com> Date: Fri, 23 Oct 2026 01:43:59 +0100 Subject: [PATCH] feat: show approvals and questions above the message box (#2095) --- .../ChatBox/BottomBox/ApprovalModeSelect.tsx | 29 +- .../ChatBox/BottomBox/BoxHeader.tsx | 9 +- .../ChatBox/BottomBox/ControlInput.tsx | 82 ++++-- .../ChatBox/BottomBox/HumanDecisionCard.tsx | 108 ++++++++ src/components/ChatBox/BottomBox/InputBox.tsx | 35 ++- .../ChatBox/BottomBox/QueuedBox.css | 2 +- .../ChatBox/BottomBox/RichChatInput.tsx | 4 +- src/components/ChatBox/BottomBox/types.ts | 1 + .../BottomBox/useEventNativeHumanControl.ts | 2 +- src/components/ChatBox/index.tsx | 54 +++- .../Workspace/ProjectModeToggle.tsx | 27 +- src/components/ui/textarea.tsx | 17 +- src/i18n/locales/ar/chat.json | 1 + src/i18n/locales/de/chat.json | 1 + src/i18n/locales/en-us/chat.json | 1 + src/i18n/locales/es/chat.json | 1 + src/i18n/locales/fr/chat.json | 1 + src/i18n/locales/it/chat.json | 1 + src/i18n/locales/ja/chat.json | 1 + src/i18n/locales/ko/chat.json | 1 + src/i18n/locales/ru/chat.json | 1 + src/i18n/locales/zh-Hans/chat.json | 1 + src/i18n/locales/zh-Hant/chat.json | 1 + .../ChatBox.spaceModelSelection.test.tsx | 26 +- test/unit/components/ChatBox.test.tsx | 89 +++++++ .../ChatBox/BottomBox/BottomBox.test.tsx | 24 +- .../ChatBox/BottomBox/ControlInput.test.tsx | 54 ++++ .../BottomBox/HumanDecisionCard.test.tsx | 249 ++++++++++++++++++ test/unit/components/ui/textarea.test.tsx | 66 +++++ 29 files changed, 785 insertions(+), 104 deletions(-) create mode 100644 src/components/ChatBox/BottomBox/HumanDecisionCard.tsx create mode 100644 test/unit/components/ChatBox/BottomBox/HumanDecisionCard.test.tsx create mode 100644 test/unit/components/ui/textarea.test.tsx diff --git a/src/components/ChatBox/BottomBox/ApprovalModeSelect.tsx b/src/components/ChatBox/BottomBox/ApprovalModeSelect.tsx index 344db29f1..c885d294a 100644 --- a/src/components/ChatBox/BottomBox/ApprovalModeSelect.tsx +++ b/src/components/ChatBox/BottomBox/ApprovalModeSelect.tsx @@ -27,6 +27,7 @@ import { DropdownMenuItem, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; +import { DsIcon } from '@/components/ui/ds-icon'; import { generateUniqueId } from '@/lib'; import { cn } from '@/lib/utils'; import { @@ -228,10 +229,7 @@ export function ApprovalModeSelect({ )} > - + {!compact && ( {current.label} @@ -262,20 +260,17 @@ export function ApprovalModeSelect({ )} > - + {!compact && ( {current.label} )} - @@ -296,10 +291,7 @@ export function ApprovalModeSelect({ className="flex items-center justify-between gap-2" > - + {option.label} @@ -310,7 +302,10 @@ export function ApprovalModeSelect({ {value === option.value && ( - + )} ); diff --git a/src/components/ChatBox/BottomBox/BoxHeader.tsx b/src/components/ChatBox/BottomBox/BoxHeader.tsx index b229aaa86..9294720ec 100644 --- a/src/components/ChatBox/BottomBox/BoxHeader.tsx +++ b/src/components/ChatBox/BottomBox/BoxHeader.tsx @@ -14,6 +14,7 @@ import { MarkDown } from '@/components/ChatBox/MessageItem/MarkDown'; import { Button } from '@/components/ui/button'; +import { DsIcon } from '@/components/ui/ds-icon'; import { cn } from '@/lib/utils'; import { ChevronLeft, @@ -80,14 +81,14 @@ export function BoxHeaderDisplay({ )} {title && ( + {title} {showQuestionIcon ? ( - ) : null} - {title} )} {description && descriptionAsMarkdown ? ( diff --git a/src/components/ChatBox/BottomBox/ControlInput.tsx b/src/components/ChatBox/BottomBox/ControlInput.tsx index 2d04ca153..99bb3d19a 100644 --- a/src/components/ChatBox/BottomBox/ControlInput.tsx +++ b/src/components/ChatBox/BottomBox/ControlInput.tsx @@ -39,6 +39,8 @@ import type { interface InputVariantRouterProps { variant: BottomBoxVariant; inputProps: InputboxProps; + borderlessApproval?: boolean; + borderlessQuestion?: boolean; connectorPanelOpen?: boolean; onToggleConnectorPanel?: () => void; skillPanelOpen?: boolean; @@ -103,24 +105,41 @@ function ConfirmationInput({ ); } -function ApprovalInput({ variant }: { variant: BottomBoxApprovalVariant }) { +function ApprovalInput({ + variant, + borderless, +}: { + variant: BottomBoxApprovalVariant; + borderless?: boolean; +}) { const { t } = useTranslation(); return (
-
- + {variant.error ? ( +

+ {variant.error} +

+ ) : null} +
+
- {variant.options.map((option) => { + {variant.options.map((option, index) => { return ( ); })} - +
); @@ -296,20 +322,30 @@ function SelectionInput({ variant }: { variant: BottomBoxSelectionVariant }) { ); } -function FeedbackInput({ variant }: { variant: BottomBoxFeedbackVariant }) { +function FeedbackInput({ + variant, + borderless, +}: { + variant: BottomBoxFeedbackVariant; + borderless?: boolean; +}) { const { t } = useTranslation(); const enterLabel = getEnterKeyLabel(useDesktopShortcutPlatform()); + const isQuestion = variant.presentation === 'question'; + return ( -
+