From f21bee44a8b9839e7bc332cc9bbde5c48c3b69e9 Mon Sep 17 00:00:00 2001 From: Coen Warmer Date: Wed, 21 Feb 2024 16:47:03 +0100 Subject: [PATCH] [Observability AI Assistant] Fix double plusses (#177314) --- .../components/buttons/new_chat_button.tsx | 39 ++++++++++++++----- .../public/components/chat/chat_flyout.tsx | 7 ++-- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/x-pack/plugins/observability_ai_assistant/public/components/buttons/new_chat_button.tsx b/x-pack/plugins/observability_ai_assistant/public/components/buttons/new_chat_button.tsx index d11451c78eaba..2d7387d9a1040 100644 --- a/x-pack/plugins/observability_ai_assistant/public/components/buttons/new_chat_button.tsx +++ b/x-pack/plugins/observability_ai_assistant/public/components/buttons/new_chat_button.tsx @@ -4,21 +4,40 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import React from 'react'; -import { EuiButton } from '@elastic/eui'; +import React, { SVGProps } from 'react'; +import { EuiButton, EuiButtonIcon } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -export function NewChatButton(props: React.ComponentProps) { - return ( - +export function NewChatButton( + props: React.ComponentProps & { collapsed?: boolean } +) { + return !props.collapsed ? ( + + {i18n.translate('xpack.observabilityAiAssistant.newChatButton', { defaultMessage: 'New chat', })} + ) : ( + + ); +} + +// To-do: replace with Eui icon once https://github.com/elastic/eui/pull/7524 is merged. +export function EuiIconNewChat({ ...props }: SVGProps) { + return ( + + + + ); } diff --git a/x-pack/plugins/observability_ai_assistant/public/components/chat/chat_flyout.tsx b/x-pack/plugins/observability_ai_assistant/public/components/chat/chat_flyout.tsx index 75379cdefed9c..55a665889e2a8 100644 --- a/x-pack/plugins/observability_ai_assistant/public/components/chat/chat_flyout.tsx +++ b/x-pack/plugins/observability_ai_assistant/public/components/chat/chat_flyout.tsx @@ -29,6 +29,7 @@ import { ChatBody } from './chat_body'; import { ConversationList } from './conversation_list'; import type { Message } from '../../../common/types'; import { ChatInlineEditingContent } from './chat_inline_edit'; +import { NewChatButton } from '../buttons/new_chat_button'; const CONVERSATIONS_SIDEBAR_WIDTH = 260; const CONVERSATIONS_SIDEBAR_WIDTH_COLLAPSED = 34; @@ -110,7 +111,7 @@ export function ChatFlyout({ const newChatButtonClassName = css` position: absolute; - bottom: 31px; + bottom: 30px; margin-left: ${conversationsExpanded ? CONVERSATIONS_SIDEBAR_WIDTH - CONVERSATIONS_SIDEBAR_WIDTH_COLLAPSED : 5}px; @@ -228,13 +229,13 @@ export function ChatFlyout({ )} display="block" > -