From 450e3ade5f9b37e0617c7d50464e15eab3f28ba9 Mon Sep 17 00:00:00 2001 From: MuhammadUmer44 Date: Wed, 2 Jul 2025 14:55:03 +0500 Subject: [PATCH 1/2] Add tooltip to Hive Chat AddButton --- src/components/common/Tooltip.tsx | 108 ++++++++++++++++++++++++++++++ src/people/hiveChat/index.tsx | 9 ++- 2 files changed, 114 insertions(+), 3 deletions(-) create mode 100644 src/components/common/Tooltip.tsx diff --git a/src/components/common/Tooltip.tsx b/src/components/common/Tooltip.tsx new file mode 100644 index 000000000..4c9b17083 --- /dev/null +++ b/src/components/common/Tooltip.tsx @@ -0,0 +1,108 @@ +import React, { useState } from 'react'; +import styled from 'styled-components'; +interface TooltipProps { + text: string; + children: React.ReactNode; + position?: 'top' | 'right' | 'bottom' | 'left'; +} +const TooltipWrapper = styled.div` + position: relative; + display: inline-block; +`; +const TooltipContent = styled.div<{ visible: boolean; position: string }>` + position: absolute; + background: rgba(31, 41, 55, 0.95); + color: white; + padding: 8px 16px; + border-radius: 6px; + font-size: 13px; + font-weight: 500; + max-width: 200px; + white-space: nowrap; + pointer-events: none; + z-index: 1000; + box-shadow: + 0 4px 6px -1px rgba(0, 0, 0, 0.1), + 0 2px 4px -1px rgba(0, 0, 0, 0.06); + transition: + opacity 0.2s, + visibility 0.2s; + opacity: ${({ visible }) => (visible ? 1 : 0)}; + visibility: ${({ visible }) => (visible ? 'visible' : 'hidden')}; + ${({ position }) => { + switch (position) { + case 'top': + return ` + bottom: 100%; + left: 50%; + transform: translateX(-50%); + margin-bottom: 8px; + &::after { + top: 100%; + left: 50%; + transform: translateX(-50%); + border-color: rgba(31, 41, 55, 0.95) transparent transparent transparent; + } + `; + case 'right': + return ` + left: 100%; + top: 50%; + transform: translateY(-50%); + margin-left: 8px; + &::after { + right: 100%; + top: 50%; + transform: translateY(-50%); + border-color: transparent rgba(31, 41, 55, 0.95) transparent transparent; + } + `; + case 'bottom': + return ` + top: 100%; + left: 50%; + transform: translateX(-50%); + margin-top: 8px; + &::after { + bottom: 100%; + left: 50%; + transform: translateX(-50%); + border-color: transparent transparent rgba(31, 41, 55, 0.95) transparent; + } + `; + case 'left': + return ` + right: 100%; + top: 50%; + transform: translateY(-50%); + margin-right: 8px; + &::after { + left: 100%; + top: 50%; + transform: translateY(-50%); + border-color: transparent transparent transparent rgba(31, 41, 55, 0.95); + } + `; + default: + return ''; + } + }} + &::after { + content: ''; + position: absolute; + border-width: 5px; + border-style: solid; + } +`; +const Tooltip: React.FC = ({ text, children, position = 'right' }) => { + const [visible, setVisible] = useState(false); + return ( + setVisible(true)} onMouseLeave={() => setVisible(false)}> + {children} + + {text} + + + ); +}; +export default Tooltip; diff --git a/src/people/hiveChat/index.tsx b/src/people/hiveChat/index.tsx index 24a738948..e2b5b2f7e 100644 --- a/src/people/hiveChat/index.tsx +++ b/src/people/hiveChat/index.tsx @@ -11,6 +11,7 @@ import styled from 'styled-components'; import { EuiLoadingSpinner } from '@elastic/eui'; import MaterialIcon from '@material/react-material-icon'; import { chatHistoryStore } from 'store/chat.ts'; +import Tooltip from 'components/common/Tooltip'; import { renderMarkdown } from '../utils/RenderMarkdown.tsx'; import { UploadModal } from '../../components/UploadModal'; import { useFeatureFlag, useBrowserTabTitle } from '../../hooks'; @@ -1504,9 +1505,11 @@ export const HiveChatView: React.FC = observer(() => { Save )} - handleNewChat()} disabled={isUpdatingTitle}> - - + + handleNewChat()} disabled={isUpdatingTitle}> + + + {isMinimized && ( Date: Wed, 2 Jul 2025 10:08:50 +0000 Subject: [PATCH 2/2] fix prettier issue --- src/people/hiveChat/ActionArtifactRenderer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/people/hiveChat/ActionArtifactRenderer.tsx b/src/people/hiveChat/ActionArtifactRenderer.tsx index 741fbcd84..03f074923 100644 --- a/src/people/hiveChat/ActionArtifactRenderer.tsx +++ b/src/people/hiveChat/ActionArtifactRenderer.tsx @@ -116,7 +116,7 @@ export const ActionArtifactRenderer: React.FC = obs return null; } - console.log("actionArtifact", actionArtifact) + console.log('actionArtifact', actionArtifact); const content = actionArtifact.content as ActionContent; const hasButtonOptions =