Skip to content

Commit 1cba17d

Browse files
committed
feat(cli): Add copy button to user messages in MessageBlock
1 parent dd8582e commit 1cba17d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cli/src/components/message-block.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import React, {
99

1010
import { AgentBranchItem } from './agent-branch-item'
1111
import { Button } from './button'
12+
import { CopyIconButton } from './copy-icon-button'
1213
import { ImageCard } from './image-card'
1314
import { MessageFooter } from './message-footer'
1415
import { ValidationErrorPopover } from './validation-error-popover'
@@ -188,7 +189,7 @@ export const MessageBlock: React.FC<MessageBlockProps> = ({
188189
width: '100%',
189190
}}
190191
>
191-
{/* User message timestamp with error indicator button (non-bash commands) */}
192+
{/* User message timestamp with copy button and error indicator (non-bash commands) */}
192193
{isUser && !bashCwd && (
193194
<box style={{ flexDirection: 'row', alignItems: 'center', gap: 1 }}>
194195
<text
@@ -201,6 +202,8 @@ export const MessageBlock: React.FC<MessageBlockProps> = ({
201202
{`[${timestamp}]`}
202203
</text>
203204

205+
<CopyIconButton textToCopy={content} />
206+
204207
{validationErrors && validationErrors.length > 0 && (
205208
<Button
206209
onClick={() => setShowValidationPopover(!showValidationPopover)}
@@ -218,7 +221,7 @@ export const MessageBlock: React.FC<MessageBlockProps> = ({
218221
</box>
219222
)}
220223

221-
{/* Bash command metadata header (timestamp + cwd) - now for user messages with bashCwd */}
224+
{/* Bash command metadata header (timestamp + copy button + cwd) */}
222225
{bashCwd && (
223226
<box style={{ flexDirection: 'row', alignItems: 'center', gap: 1 }}>
224227
<text
@@ -230,6 +233,7 @@ export const MessageBlock: React.FC<MessageBlockProps> = ({
230233
>
231234
{`[${timestamp}]`}
232235
</text>
236+
<CopyIconButton textToCopy={content} />
233237
<text
234238
attributes={TextAttributes.DIM}
235239
style={{

0 commit comments

Comments
 (0)