Skip to content

Commit

Permalink
[Obs AI Assistant] Remove the copy button if there is no content to c…
Browse files Browse the repository at this point in the history
  • Loading branch information
viduni94 committed Nov 12, 2024
1 parent 4a2de76 commit ec86c25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions x-pack/packages/kbn-ai-assistant/src/chat/chat_item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ export function ChatItem({
onCopyToClipboard={handleCopyToClipboard}
onToggleEdit={handleToggleEdit}
onToggleExpand={handleToggleExpand}
content={content}
/>
}
className={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import React, { useEffect, useState } from 'react';
import { i18n } from '@kbn/i18n';
import { EuiButtonIcon, EuiPopover, EuiText } from '@elastic/eui';
import type { Message } from '@kbn/observability-ai-assistant-plugin/common';

export function ChatItemActions({
canCopy,
Expand All @@ -18,6 +19,7 @@ export function ChatItemActions({
onToggleEdit,
onToggleExpand,
onCopyToClipboard,
content,
}: {
canCopy: boolean;
canEdit: boolean;
Expand All @@ -27,6 +29,7 @@ export function ChatItemActions({
onToggleEdit: () => void;
onToggleExpand: () => void;
onCopyToClipboard: () => void;
content: Message['message']['content'];
}) {
const [isPopoverOpen, setIsPopoverOpen] = useState<string | undefined>();

Expand Down Expand Up @@ -70,7 +73,7 @@ export function ChatItemActions({
/>
) : null}

{canCopy ? (
{canCopy && content ? (
<EuiPopover
button={
<EuiButtonIcon
Expand Down

0 comments on commit ec86c25

Please sign in to comment.