From a00aba23bd11e2ec6ccb24bcc8fff776e1602a65 Mon Sep 17 00:00:00 2001 From: Pleasure1234 <3196812536@qq.com> Date: Sun, 5 Oct 2025 11:33:21 +0100 Subject: [PATCH] refactor: migrate all antd Tooltip components to HeroUI Tooltip (#10295) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: migrate tooltip components to @cherrystudio/ui - Replace all antd Tooltip + InfoCircleOutlined patterns with InfoTooltip component - Replace all antd Tooltip + QuestionCircleOutlined patterns with HelpTooltip component - Migrate all WarnTooltip imports to @cherrystudio/ui - Add onClick support to InfoTooltip and HelpTooltip components - Remove local tooltip components from renderer - Update eslint config to restrict antd Tooltip imports - Clean up unused imports and styled components 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude * fix: replace tooltip * fix: yarn format * fix: type check * Update QuickModelPopup.tsx * fix: yarn test * fix: ci error * Update TabContainer.tsx * fix: ci error * fix: ci error * fix: issue * fix: ci * fix: again * refactor(ui): replace Tooltip title prop with content for consistency * refactor(Tooltip): improve Tooltip component by extending props and simplifying implementation - Extend TooltipProps from HeroUITooltipProps instead of redefining - Remove redundant props and use spread operator for classNames - Export TooltipProps type for better type support * refactor(HelpTooltip): rename title prop to content and simplify component Update HelpTooltip component to use TooltipProps interface and rename title prop to content for consistency Update all instances where HelpTooltip is used to reflect the prop name change * refactor(IconTooltips): consolidate tooltip components into unified module Move HelpTooltip, InfoTooltip, and WarnTooltip into a single IconTooltips directory with shared types Update exports in components index to use new module structure * refactor(tooltip): update InfoTooltip prop from title to content and simplify component Consolidate tooltip props interface and update all instances to use content prop instead of title for consistency. Remove redundant interface definitions and simplify InfoTooltip component implementation. * refactor(ui): rename WarnTooltip prop from title to content for consistency Update all instances of WarnTooltip component to use content prop instead of title for better consistency with Tooltip component interface. Also simplify the component props by extending IconTooltipProps type. * fix(tooltip): update tooltip usage - Replace deprecated props like `mouseEnterDelay` and `mouseLeaveDelay` with `delay` and `closeDelay` - Rename `arrow` prop to `showArrow` for better semantics - Update styling props to use `classNames` instead of inline styles - Remove unnecessary props like `fresh` and `destroyOnHidden` * refactor(components): remove redundant placement="top" from Tooltip components The placement="top" prop was removed from all Tooltip components since it's the default value and redundant. This change improves code cleanliness without affecting functionality. * fix(HeaderNavbar): add tooltip placement for sidebar toggle buttons * fix(ui): add delay to tooltip components for better user experience * refactor(tooltip): adjust tooltip behavior and styling across components - Remove default delay values from base Tooltip component - Add delay and closeDelay props to specific tooltip instances - Fix tooltip compatibility issue with Antd Dropdown - Adjust tooltip placement and styling in various components * fix(ui): set closeDelay to 0 for Tooltip components to improve responsiveness Prevent tooltip delay from causing poor user experience by making them close immediately when mouse leaves the element * refactor(ui): remove redundant tooltip placement prop The 'placement="top"' prop was removed from Tooltip components as it's the default value and doesn't need to be explicitly set. * fix(ui): adjust tooltip delays for better user experience - Set consistent default delay of 1000ms for window controls - Increase delay for sidebar toggle tooltips to 2000ms - Adjust various message action tooltip delays between 600-1200ms * fix(SelectModelPopup): add delay props to provider settings tooltip Add delay and closeDelay props to Tooltip component to improve user experience by preventing accidental triggers * style(HelpTooltip): add cursor help style to improve UX * fix(components): add tooltip delay and placement props for better UX Add delay prop to CustomTag and ModelIdWithTags tooltips to prevent flickering Set placement prop for LocalBackupManager tooltip to top-start Add closeDelay prop to HelpTooltip in SaveToKnowledgePopup for immediate closing * refactor(ModelSelectButton): simplify tooltip props by using TooltipProps type Replace individual tooltip placement props with TooltipProps type from ui library for better maintainability * fix(ui): remove tooltip close delay for better user experience * docs(tooltip): add jsdoc comments explaining tooltip wrapper behavior * refactor(Tooltip): clarify showArrow prop * fix(Inputbar): set closeDelay to 0 for pause tooltip to improve UX Prevent tooltip from staying visible after interaction by removing the close delay * style(InputbarTools): improve tooltip consistency and css formatting - Add closeDelay to new topic tooltip for consistency - Remove redundant line breaks in tooltip props - Format css transition properties for better readability * chore: add tailwindCSS class attributes to vscode settings * fix(tooltips): improve tooltip behavior and styling across components - Add closeDelay=0 to most tooltips for instant closing - Add custom styling to CitationTooltip and ChatFlowHistory tooltips - Adjust delay times for navigation tooltips - Remove conflicting Tooltip wrappers around Popconfirm actions * refactor(ui): adjust tooltip delays and placements across components - Remove redundant isOpen prop from CustomNode tooltip - Standardize tooltip delays and placements in MessageGroupMenuBar, MessageTokens, ChatNavbar - Simplify tooltip wrapper structure in HeaderNavbar - Add consistent tooltip delays in MessageGroupModelList - Set tooltip placements in MinimalToolbar * refactor(Tooltip): enhance tooltip structure and props - Add className prop to Tooltip component for better customization - Wrap children in a div with relative positioning to improve layout * refactor(Tooltip): enhance props structure for improved customization - Update Tooltip component to allow optional classNames with a placeholder property - Modify child wrapper to utilize classNames for better styling control * refactor(IconTooltips): consolidate icon props into single iconProps object Replace individual icon styling props (iconColor, iconSize, iconStyle) with a unified iconProps object using LucideProps type. This simplifies the component API and improves maintainability by using a standardized props structure across all icon tooltip components. * feat(JoplinSettings): add help button to open Joplin documentation Add a help button in Joplin settings that opens the official Joplin documentation in a minapp popup when clicked. This provides users with quick access to Joplin's help resources. * feat(NotionSettings): add help link click handler for notion title Add click handler to open help documentation when clicking on Notion title in settings * feat(S3Settings): add help link to S3 settings title Add click handler to open documentation for S3 settings when title is clicked * feat(settings): add help button for siyuan integration Add click handler to open help documentation for siyuan integration settings * feat(yuque-settings): add help button to open yuque token guide Add a help button in Yuque settings that opens a minapp popup with Yuque's token guide. This helps users easily access documentation for generating API tokens. * fix(ui): adjust tooltip delay settings for better user experience Set closeDelay to 0 for reset button tooltip to prevent lingering Add delay of 500ms for api key list tooltip to avoid accidental triggers * fix(ModelList): set closeDelay to 0 for all Tooltip components Prevent tooltips from staying open longer than necessary by immediately closing them on mouse leave * fix(ui): improve tooltip placement and delay settings adjust tooltip placement and delay for better user experience * refactor(tests): update tooltip mock implementation and snapshots - Consolidate tooltip mock to handle both title and content props - Remove deprecated placement attributes from snapshots - Clean up test tooltip content assertions * refactor: remove unnecessary whitespace and simplify tooltip components clean up code by removing redundant whitespace and simplifying tooltip component usage across multiple files --------- Co-authored-by: Claude Co-authored-by: icarus Co-authored-by: MyPrototypeWhat --- .vscode/settings.json | 6 +- eslint.config.mjs | 2 +- packages/ui/package.json | 2 +- .../components/base/Avatar/EmojiAvatar.tsx | 11 +- .../src/components/base/CustomTag/index.tsx | 2 +- .../ui/src/components/base/Tooltip/index.tsx | 34 ++ .../src/components/display/ListItem/index.tsx | 2 +- .../icons/ToolsCallingIcon/index.tsx | 2 +- packages/ui/src/components/index.ts | 8 +- .../CollapsibleSearchBar/index.tsx | 6 +- .../DraggableList/virtual-list.tsx | 2 +- .../interactive/HelpTooltip/index.tsx | 22 -- .../interactive/IconTooltips/HelpTooltip.tsx | 19 + .../interactive/IconTooltips/InfoTooltip.tsx | 19 + .../interactive/IconTooltips/WarnTooltip.tsx | 19 + .../interactive/IconTooltips/index.tsx | 4 + .../interactive/IconTooltips/types.ts | 7 + .../interactive/ImageToolButton/index.tsx | 7 +- .../interactive/InfoTooltip/index.tsx | 22 -- .../interactive/WarnTooltip/index.tsx | 27 -- .../CodeBlockView/HtmlArtifactsPopup.tsx | 8 +- .../__tests__/CodeToolButton.test.tsx | 9 +- .../__tests__/CodeToolbar.test.tsx | 9 +- .../src/components/CodeToolbar/button.tsx | 5 +- .../src/components/CodeToolbar/toolbar.tsx | 4 +- .../src/components/CollapsibleSearchBar.tsx | 5 +- src/renderer/src/components/ContentSearch.tsx | 12 +- src/renderer/src/components/CopyButton.tsx | 4 +- .../DraggableVirtualList.test.tsx.snap | 3 +- .../HealthStatusIndicator/indicator.tsx | 5 +- .../src/components/Icons/ReasoningIcon.tsx | 4 +- src/renderer/src/components/Icons/SVGIcon.tsx | 4 +- .../src/components/Icons/ToolsCallingIcon.tsx | 4 +- .../src/components/Icons/VisionIcon.tsx | 4 +- .../src/components/Icons/WebSearchIcon.tsx | 4 +- .../components/InputEmbeddingDimension.tsx | 6 +- .../src/components/LocalBackupManager.tsx | 6 +- .../MinApp/MinappPopupContainer.tsx | 44 +-- .../src/components/ModelIdWithTags.tsx | 16 +- .../src/components/ModelSelectButton.tsx | 7 +- .../Popups/ApiKeyListPopup/item.tsx | 22 +- .../Popups/ApiKeyListPopup/list.tsx | 9 +- .../components/Popups/MultiSelectionPopup.tsx | 13 +- .../Popups/SaveToKnowledgePopup.tsx | 10 +- .../TagFilterSection.test.tsx.snap | 3 +- .../Popups/SelectModelPopup/popup.tsx | 5 +- .../components/Preview/ImageToolButton.tsx | 5 +- .../__tests__/ImageToolButton.test.tsx | 15 +- .../ImageToolButton.test.tsx.snap | 27 +- .../components/ProviderLogoPicker/index.tsx | 12 +- .../code-block-shiki/CodeBlockNodeView.tsx | 6 +- .../src/components/RichEditor/index.tsx | 6 +- .../src/components/RichEditor/toolbar.tsx | 4 +- .../src/components/S3BackupManager.tsx | 6 +- .../src/components/Tab/TabContainer.tsx | 8 +- .../src/components/Tags/CustomTag.tsx | 4 +- .../components/TooltipIcons/HelpTooltip.tsx | 28 -- .../components/TooltipIcons/InfoTooltip.tsx | 21 - .../components/TooltipIcons/WarnTooltip.tsx | 26 -- .../__tests__/InfoTooltip.test.tsx | 38 -- .../__snapshots__/InfoTooltip.test.tsx.snap | 18 - .../src/components/TooltipIcons/index.ts | 3 - .../src/components/TranslateButton.tsx | 9 +- .../src/components/WebdavBackupManager.tsx | 6 +- .../src/components/WindowControls/index.tsx | 14 +- .../components/__tests__/CustomTag.test.tsx | 8 +- .../InputEmbeddingDimension.test.tsx | 25 +- .../InputEmbeddingDimension.test.tsx.snap | 18 +- .../src/components/app/PinnedMinapps.tsx | 27 +- src/renderer/src/components/app/Sidebar.tsx | 13 +- src/renderer/src/pages/code/CodeToolsPage.tsx | 7 +- src/renderer/src/pages/home/ChatNavbar.tsx | 14 +- .../pages/home/Inputbar/AttachmentButton.tsx | 8 +- .../pages/home/Inputbar/AttachmentPreview.tsx | 12 +- .../home/Inputbar/GenerateImageButton.tsx | 9 +- .../src/pages/home/Inputbar/Inputbar.tsx | 4 +- .../src/pages/home/Inputbar/InputbarTools.tsx | 31 +- .../home/Inputbar/KnowledgeBaseButton.tsx | 4 +- .../pages/home/Inputbar/MCPToolsButton.tsx | 5 +- .../home/Inputbar/MentionModelsButton.tsx | 9 +- .../pages/home/Inputbar/NewContextButton.tsx | 8 +- .../home/Inputbar/QuickPhrasesButton.tsx | 5 +- .../pages/home/Inputbar/ThinkingButton.tsx | 8 +- .../pages/home/Inputbar/UrlContextbutton.tsx | 4 +- .../pages/home/Inputbar/WebSearchButton.tsx | 8 +- .../pages/home/Markdown/CitationTooltip.tsx | 16 +- .../src/pages/home/Markdown/Hyperlink.tsx | 1 - .../src/pages/home/Markdown/Table.tsx | 4 +- .../__tests__/CitationTooltip.test.tsx | 33 +- .../Markdown/__tests__/Hyperlink.test.tsx | 1 - .../home/Markdown/__tests__/Table.test.tsx | 11 +- .../CitationTooltip.test.tsx.snap | 4 +- .../__snapshots__/Hyperlink.test.tsx.snap | 1 - .../home/Messages/Blocks/ThinkingBlock.tsx | 5 +- .../Blocks/__tests__/ThinkingBlock.test.tsx | 18 +- .../__snapshots__/ThinkingBlock.test.tsx.snap | 2 - .../pages/home/Messages/ChatFlowHistory.tsx | 23 +- .../pages/home/Messages/ChatNavigation.tsx | 18 +- .../src/pages/home/Messages/MessageEditor.tsx | 9 +- .../home/Messages/MessageGroupMenuBar.tsx | 11 +- .../home/Messages/MessageGroupModelList.tsx | 15 +- .../src/pages/home/Messages/MessageHeader.tsx | 6 +- .../pages/home/Messages/MessageMenubar.tsx | 68 ++-- .../home/Messages/Tools/MessageMcpTool.tsx | 10 +- src/renderer/src/pages/home/Navbar.tsx | 14 +- .../src/pages/home/Tabs/AssistantsTab.tsx | 5 +- .../src/pages/home/Tabs/SettingsTab.tsx | 23 +- .../src/pages/home/Tabs/TopicsTab.tsx | 17 +- .../Tabs/components/OpenAISettingsGroup.tsx | 16 +- .../src/pages/knowledge/KnowledgeContent.tsx | 7 +- .../__tests__/AdvancedSettingsPanel.test.tsx | 7 +- .../__tests__/GeneralSettingsPanel.test.tsx | 6 +- .../AdvancedSettingsPanel.test.tsx.snap | 12 +- .../GeneralSettingsPanel.test.tsx.snap | 25 +- .../KnowledgeSearchItem/components.tsx | 5 +- .../AdvancedSettingsPanel.tsx | 8 +- .../GeneralSettingsPanel.tsx | 12 +- .../pages/knowledge/components/StatusIcon.tsx | 17 +- .../knowledge/items/KnowledgeDirectories.tsx | 5 +- .../pages/knowledge/items/KnowledgeFiles.tsx | 6 +- .../knowledge/items/KnowledgeSitemaps.tsx | 5 +- .../pages/knowledge/items/KnowledgeUrls.tsx | 6 +- .../pages/knowledge/items/KnowledgeVideos.tsx | 5 +- .../src/pages/memory/settings-modal.tsx | 4 +- .../MiniappSettings/MiniAppSettings.tsx | 7 +- .../minapps/components/MinimalToolbar.tsx | 18 +- src/renderer/src/pages/notes/HeaderNavbar.tsx | 32 +- .../src/pages/notes/NotesSidebarHeader.tsx | 17 +- .../src/pages/paintings/AihubmixPage.tsx | 26 +- .../src/pages/paintings/DmxapiPage.tsx | 27 +- .../src/pages/paintings/SiliconPage.tsx | 44 +-- .../src/pages/paintings/TokenFluxPage.tsx | 27 +- .../src/pages/settings/AboutSettings.tsx | 22 +- .../AssistantKnowledgeBaseSettings.tsx | 5 +- .../AssistantMCPSettings.tsx | 21 +- .../AssistantMemorySettings.tsx | 23 +- .../AssistantModelSettings.tsx | 41 +- .../settings/DataSettings/JoplinSettings.tsx | 28 +- .../DataSettings/LocalBackupSettings.tsx | 15 +- .../settings/DataSettings/NotionSettings.tsx | 28 +- .../DataSettings/NutstoreSettings.tsx | 15 +- .../settings/DataSettings/S3Settings.tsx | 25 +- .../settings/DataSettings/SiyuanSettings.tsx | 18 +- .../settings/DataSettings/WebDavSettings.tsx | 15 +- .../settings/DataSettings/YuqueSettings.tsx | 20 +- .../DocProcessSettings/OcrSystemSettings.tsx | 4 +- .../OcrTesseractSettings.tsx | 4 +- .../PreprocessProviderSettings.tsx | 8 +- .../src/pages/settings/GeneralSettings.tsx | 16 +- .../pages/settings/MCPSettings/McpPrompt.tsx | 5 +- .../settings/MCPSettings/McpServerCard.tsx | 9 +- .../pages/settings/MCPSettings/McpTool.tsx | 17 +- .../settings/MemorySettings/UserSelector.tsx | 12 +- .../DefaultAssistantSettings.tsx | 45 +-- .../settings/ModelSettings/ModelSettings.tsx | 9 +- .../ApiOptionsSettings/ApiOptionsSettings.tsx | 4 +- .../EditModelPopup/ModelEditContent.tsx | 11 +- .../GithubCopilotSettings.tsx | 6 +- .../ModelList/ManageModelsList.tsx | 11 +- .../ModelList/ManageModelsPopup.tsx | 13 +- .../ProviderSettings/ModelList/ModelList.tsx | 8 +- .../ModelList/ModelListGroup.tsx | 6 +- .../ModelList/ModelListItem.tsx | 9 +- .../ProviderSettings/ProviderSetting.tsx | 20 +- .../pages/settings/QuickAssistantSettings.tsx | 22 +- .../SelectionAssistantSettings.tsx | 49 +-- .../components/SelectionActionUserModal.tsx | 11 +- .../components/SettingsActionsListHeader.tsx | 8 +- .../src/pages/settings/ShortcutSettings.tsx | 10 +- .../ApiServerSettings/ApiServerSettings.tsx | 10 +- .../CustomLanguageModal.tsx | 5 +- .../TranslatePromptSettings.tsx | 5 +- .../WebSearchSettings/BasicSettings.tsx | 11 +- .../CompressionSettings/CutoffSettings.tsx | 17 +- .../CompressionSettings/RagSettings.tsx | 26 +- .../WebSearchProviderSetting.tsx | 24 +- .../src/pages/translate/TranslatePage.tsx | 15 +- .../src/pages/translate/TranslateSettings.tsx | 31 +- .../windows/mini/home/components/Footer.tsx | 5 +- .../selection/action/SelectionActionApp.tsx | 10 +- .../action/components/ActionTranslate.tsx | 10 +- tests/renderer.setup.ts | 63 +++ yarn.lock | 367 +++++++++++++++++- 183 files changed, 1432 insertions(+), 1350 deletions(-) create mode 100644 packages/ui/src/components/base/Tooltip/index.tsx delete mode 100644 packages/ui/src/components/interactive/HelpTooltip/index.tsx create mode 100644 packages/ui/src/components/interactive/IconTooltips/HelpTooltip.tsx create mode 100644 packages/ui/src/components/interactive/IconTooltips/InfoTooltip.tsx create mode 100644 packages/ui/src/components/interactive/IconTooltips/WarnTooltip.tsx create mode 100644 packages/ui/src/components/interactive/IconTooltips/index.tsx create mode 100644 packages/ui/src/components/interactive/IconTooltips/types.ts delete mode 100644 packages/ui/src/components/interactive/InfoTooltip/index.tsx delete mode 100644 packages/ui/src/components/interactive/WarnTooltip/index.tsx delete mode 100644 src/renderer/src/components/TooltipIcons/HelpTooltip.tsx delete mode 100644 src/renderer/src/components/TooltipIcons/InfoTooltip.tsx delete mode 100644 src/renderer/src/components/TooltipIcons/WarnTooltip.tsx delete mode 100644 src/renderer/src/components/TooltipIcons/__tests__/InfoTooltip.test.tsx delete mode 100644 src/renderer/src/components/TooltipIcons/__tests__/__snapshots__/InfoTooltip.test.tsx.snap delete mode 100644 src/renderer/src/components/TooltipIcons/index.ts diff --git a/.vscode/settings.json b/.vscode/settings.json index e961d76450..4097b2bdac 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -48,5 +48,9 @@ "search.exclude": { "**/dist/**": true, ".yarn/releases/**": true - } + }, + "tailwindCSS.classAttributes": [ + "className", + "classNames", + ] } diff --git a/eslint.config.mjs b/eslint.config.mjs index efbc13b0d0..0bcc6b57d1 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -145,7 +145,7 @@ export default defineConfig([ paths: [ { name: 'antd', - importNames: ['Flex', 'Switch', 'message', 'Button'], + importNames: ['Flex', 'Switch', 'message', 'Button', 'Tooltip'], message: '❌ Do not import this component from antd. Use our custom components instead: import { ... } from "@cherrystudio/ui"' }, diff --git a/packages/ui/package.json b/packages/ui/package.json index a0835b838b..93eb4abfa0 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -69,7 +69,7 @@ "react-dom": "^19.0.0", "storybook": "^9.1.6", "styled-components": "^6.1.15", - "tsdown": "^0.12.9", + "tsdown": "^0.15.5", "tsx": "^4.20.5", "typescript": "^5.6.2", "vitest": "^3.2.4" diff --git a/packages/ui/src/components/base/Avatar/EmojiAvatar.tsx b/packages/ui/src/components/base/Avatar/EmojiAvatar.tsx index 20df79d9e0..da637b42f5 100644 --- a/packages/ui/src/components/base/Avatar/EmojiAvatar.tsx +++ b/packages/ui/src/components/base/Avatar/EmojiAvatar.tsx @@ -10,14 +10,7 @@ interface EmojiAvatarProps { style?: React.CSSProperties } -const EmojiAvatar = ({ - children, - size = 31, - fontSize, - onClick, - className, - style -}: EmojiAvatarProps) => ( +const EmojiAvatar = ({ children, size = 31, fontSize, onClick, className, style }: EmojiAvatarProps) => (
= ({ ) return tooltip ? ( - + {tagContent} ) : ( diff --git a/packages/ui/src/components/base/Tooltip/index.tsx b/packages/ui/src/components/base/Tooltip/index.tsx new file mode 100644 index 0000000000..d69deadba2 --- /dev/null +++ b/packages/ui/src/components/base/Tooltip/index.tsx @@ -0,0 +1,34 @@ +import type { TooltipProps as HeroUITooltipProps } from '@heroui/react' +import { cn, Tooltip as HeroUITooltip } from '@heroui/react' + +export interface TooltipProps extends HeroUITooltipProps {} + +/** + * Tooltip wrapper that applies consistent styling and arrow display. + * Differences from raw HeroUI Tooltip: + * 1. Defaults showArrow={true} + * 2. Merges a default max-w-60 class into the content slot, capping width at 240px. + * All other HeroUI Tooltip props/behaviors remain unchanged. + * + * @see https://www.heroui.com/docs/components/tooltip + */ +export const Tooltip = ({ + children, + classNames, + showArrow, + ...rest +}: Omit & { + classNames?: TooltipProps['classNames'] & { placeholder?: string } +}) => { + return ( + +
{children}
+
+ ) +} diff --git a/packages/ui/src/components/display/ListItem/index.tsx b/packages/ui/src/components/display/ListItem/index.tsx index a105020928..196fdb2949 100644 --- a/packages/ui/src/components/display/ListItem/index.tsx +++ b/packages/ui/src/components/display/ListItem/index.tsx @@ -43,7 +43,7 @@ const ListItem = ({
{icon && {icon}}
- +
{title}
diff --git a/packages/ui/src/components/icons/ToolsCallingIcon/index.tsx b/packages/ui/src/components/icons/ToolsCallingIcon/index.tsx index b8faa2493a..a6b31babea 100644 --- a/packages/ui/src/components/icons/ToolsCallingIcon/index.tsx +++ b/packages/ui/src/components/icons/ToolsCallingIcon/index.tsx @@ -14,7 +14,7 @@ interface ToolsCallingIconProps extends React.HTMLAttributes { const ToolsCallingIcon = ({ className, iconClassName, TooltipProps, ...props }: ToolsCallingIconProps) => { return (
- +
diff --git a/packages/ui/src/components/index.ts b/packages/ui/src/components/index.ts index 39a2a6d4c7..db518c81f1 100644 --- a/packages/ui/src/components/index.ts +++ b/packages/ui/src/components/index.ts @@ -15,6 +15,7 @@ export { ErrorTag, InfoTag, StatusTag, SuccessTag, WarnTag } from './base/Status export { DescriptionSwitch, Switch } from './base/Switch' export { default as TextBadge } from './base/TextBadge' export { getToastUtilities, type ToastUtilities } from './base/Toast' +export { Tooltip, type TooltipProps } from './base/Tooltip' // Display Components export { default as Ellipsis } from './display/Ellipsis' @@ -80,15 +81,12 @@ export { DraggableList, useDraggableReorder } from './interactive/DraggableList' export type { EditableNumberProps } from './interactive/EditableNumber' // EditableNumber export { default as EditableNumber } from './interactive/EditableNumber' -export { default as HelpTooltip } from './interactive/HelpTooltip' +// Tooltip variants +export { HelpTooltip, type IconTooltipProps, InfoTooltip, WarnTooltip } from './interactive/IconTooltips' // ImageToolButton export { default as ImageToolButton } from './interactive/ImageToolButton' -// InfoTooltip -export { default as InfoTooltip } from './interactive/InfoTooltip' // Sortable export { Sortable } from './interactive/Sortable' -// WarnTooltip -export { default as WarnTooltip } from './interactive/WarnTooltip' // Composite Components (复合组件) // 暂无复合组件 diff --git a/packages/ui/src/components/interactive/CollapsibleSearchBar/index.tsx b/packages/ui/src/components/interactive/CollapsibleSearchBar/index.tsx index 43a0ac60f4..6e850f7d56 100644 --- a/packages/ui/src/components/interactive/CollapsibleSearchBar/index.tsx +++ b/packages/ui/src/components/interactive/CollapsibleSearchBar/index.tsx @@ -1,10 +1,12 @@ // Original path: src/renderer/src/components/CollapsibleSearchBar.tsx import type { InputRef } from 'antd' -import { Input, Tooltip } from 'antd' +import { Input } from 'antd' import { Search } from 'lucide-react' import { motion } from 'motion/react' import React, { memo, useCallback, useEffect, useRef, useState } from 'react' +import { Tooltip } from '../../base/Tooltip' + interface CollapsibleSearchBarProps { onSearch: (text: string) => void placeholder?: string @@ -93,7 +95,7 @@ const CollapsibleSearchBar = ({ }} style={{ cursor: 'pointer', display: 'flex' }} onClick={() => setSearchVisible(true)}> - + {icon} diff --git a/packages/ui/src/components/interactive/DraggableList/virtual-list.tsx b/packages/ui/src/components/interactive/DraggableList/virtual-list.tsx index 794d2204eb..6085bdfd8e 100644 --- a/packages/ui/src/components/interactive/DraggableList/virtual-list.tsx +++ b/packages/ui/src/components/interactive/DraggableList/virtual-list.tsx @@ -1,4 +1,3 @@ -import { Scrollbar } from '@cherrystudio/ui' import type { DroppableProps, DropResult, @@ -10,6 +9,7 @@ import { DragDropContext, Draggable, Droppable } from '@hello-pangea/dnd' import { type ScrollToOptions, useVirtualizer, type VirtualItem } from '@tanstack/react-virtual' import { type Key, memo, useCallback, useImperativeHandle, useRef } from 'react' +import Scrollbar from '../../layout/Scrollbar' import { droppableReorder } from './sort' export interface DraggableVirtualListRef { diff --git a/packages/ui/src/components/interactive/HelpTooltip/index.tsx b/packages/ui/src/components/interactive/HelpTooltip/index.tsx deleted file mode 100644 index 592f6ae2ad..0000000000 --- a/packages/ui/src/components/interactive/HelpTooltip/index.tsx +++ /dev/null @@ -1,22 +0,0 @@ -// Original path: src/renderer/src/components/TooltipIcons/HelpTooltip.tsx -import type { TooltipProps } from 'antd' -import { Tooltip } from 'antd' -import { HelpCircle } from 'lucide-react' - -type InheritedTooltipProps = Omit - -interface HelpTooltipProps extends InheritedTooltipProps { - iconColor?: string - iconSize?: string | number - iconStyle?: React.CSSProperties -} - -const HelpTooltip = ({ iconColor = 'var(--color-text-2)', iconSize = 14, iconStyle, ...rest }: HelpTooltipProps) => { - return ( - - - - ) -} - -export default HelpTooltip diff --git a/packages/ui/src/components/interactive/IconTooltips/HelpTooltip.tsx b/packages/ui/src/components/interactive/IconTooltips/HelpTooltip.tsx new file mode 100644 index 0000000000..43643ff061 --- /dev/null +++ b/packages/ui/src/components/interactive/IconTooltips/HelpTooltip.tsx @@ -0,0 +1,19 @@ +// Original path: src/renderer/src/components/TooltipIcons/HelpTooltip.tsx +import { HelpCircle } from 'lucide-react' + +import { Tooltip } from '../../base/Tooltip' +import type { IconTooltipProps } from './types' + +export const HelpTooltip = ({ iconProps, ...rest }: IconTooltipProps) => { + return ( + + + + ) +} diff --git a/packages/ui/src/components/interactive/IconTooltips/InfoTooltip.tsx b/packages/ui/src/components/interactive/IconTooltips/InfoTooltip.tsx new file mode 100644 index 0000000000..7e05cb1413 --- /dev/null +++ b/packages/ui/src/components/interactive/IconTooltips/InfoTooltip.tsx @@ -0,0 +1,19 @@ +// Original: src/renderer/src/components/TooltipIcons/InfoTooltip.tsx +import { Info } from 'lucide-react' + +import { Tooltip } from '../../base/Tooltip' +import type { IconTooltipProps } from './types' + +export const InfoTooltip = ({ iconProps, ...rest }: IconTooltipProps) => { + return ( + + + + ) +} diff --git a/packages/ui/src/components/interactive/IconTooltips/WarnTooltip.tsx b/packages/ui/src/components/interactive/IconTooltips/WarnTooltip.tsx new file mode 100644 index 0000000000..746f3233d0 --- /dev/null +++ b/packages/ui/src/components/interactive/IconTooltips/WarnTooltip.tsx @@ -0,0 +1,19 @@ +// Original path: src/renderer/src/components/TooltipIcons/WarnTooltip.tsx +import { AlertTriangle } from 'lucide-react' + +import { Tooltip } from '../../base/Tooltip' +import type { IconTooltipProps } from './types' + +export const WarnTooltip = ({ iconProps, ...rest }: IconTooltipProps) => { + return ( + + + + ) +} diff --git a/packages/ui/src/components/interactive/IconTooltips/index.tsx b/packages/ui/src/components/interactive/IconTooltips/index.tsx new file mode 100644 index 0000000000..a88bfa3683 --- /dev/null +++ b/packages/ui/src/components/interactive/IconTooltips/index.tsx @@ -0,0 +1,4 @@ +export { HelpTooltip } from './HelpTooltip' +export { InfoTooltip } from './InfoTooltip' +export type { IconTooltipProps } from './types' +export { WarnTooltip } from './WarnTooltip' diff --git a/packages/ui/src/components/interactive/IconTooltips/types.ts b/packages/ui/src/components/interactive/IconTooltips/types.ts new file mode 100644 index 0000000000..356a280c80 --- /dev/null +++ b/packages/ui/src/components/interactive/IconTooltips/types.ts @@ -0,0 +1,7 @@ +import type { LucideProps } from 'lucide-react' + +import type { TooltipProps } from '../../base/Tooltip' + +export interface IconTooltipProps extends TooltipProps { + iconProps?: LucideProps +} diff --git a/packages/ui/src/components/interactive/ImageToolButton/index.tsx b/packages/ui/src/components/interactive/ImageToolButton/index.tsx index 97a5eeaebd..198c3cbe85 100644 --- a/packages/ui/src/components/interactive/ImageToolButton/index.tsx +++ b/packages/ui/src/components/interactive/ImageToolButton/index.tsx @@ -1,8 +1,9 @@ // Original path: src/renderer/src/components/Preview/ImageToolButton.tsx -import { Button } from '@cherrystudio/ui' -import { Tooltip } from 'antd' import { memo } from 'react' +import Button from '../../base/Button' +import { Tooltip } from '../../base/Tooltip' + interface ImageToolButtonProps { tooltip: string icon: React.ReactNode @@ -11,7 +12,7 @@ interface ImageToolButtonProps { const ImageToolButton = ({ tooltip, icon, onPress }: ImageToolButtonProps) => { return ( - + diff --git a/packages/ui/src/components/interactive/InfoTooltip/index.tsx b/packages/ui/src/components/interactive/InfoTooltip/index.tsx deleted file mode 100644 index 34d9ba7968..0000000000 --- a/packages/ui/src/components/interactive/InfoTooltip/index.tsx +++ /dev/null @@ -1,22 +0,0 @@ -// Original: src/renderer/src/components/TooltipIcons/InfoTooltip.tsx -import type { TooltipProps } from 'antd' -import { Tooltip } from 'antd' -import { Info } from 'lucide-react' - -type InheritedTooltipProps = Omit - -interface InfoTooltipProps extends InheritedTooltipProps { - iconColor?: string - iconSize?: string | number - iconStyle?: React.CSSProperties -} - -const InfoTooltip = ({ iconColor = 'var(--color-text-2)', iconSize = 14, iconStyle, ...rest }: InfoTooltipProps) => { - return ( - - - - ) -} - -export default InfoTooltip diff --git a/packages/ui/src/components/interactive/WarnTooltip/index.tsx b/packages/ui/src/components/interactive/WarnTooltip/index.tsx deleted file mode 100644 index f0dc05ce4e..0000000000 --- a/packages/ui/src/components/interactive/WarnTooltip/index.tsx +++ /dev/null @@ -1,27 +0,0 @@ -// Original path: src/renderer/src/components/TooltipIcons/WarnTooltip.tsx -import type { TooltipProps } from 'antd' -import { Tooltip } from 'antd' -import { AlertTriangle } from 'lucide-react' - -type InheritedTooltipProps = Omit - -interface WarnTooltipProps extends InheritedTooltipProps { - iconColor?: string - iconSize?: string | number - iconStyle?: React.CSSProperties -} - -const WarnTooltip = ({ - iconColor = 'var(--color-status-warning)', - iconSize = 14, - iconStyle, - ...rest -}: WarnTooltipProps) => { - return ( - - - - ) -} - -export default WarnTooltip diff --git a/src/renderer/src/components/CodeBlockView/HtmlArtifactsPopup.tsx b/src/renderer/src/components/CodeBlockView/HtmlArtifactsPopup.tsx index 82e3a5849b..d7f14b209a 100644 --- a/src/renderer/src/components/CodeBlockView/HtmlArtifactsPopup.tsx +++ b/src/renderer/src/components/CodeBlockView/HtmlArtifactsPopup.tsx @@ -1,5 +1,5 @@ import { CodeEditor, type CodeEditorHandles } from '@cherrystudio/ui' -import { Button } from '@cherrystudio/ui' +import { Button, Tooltip } from '@cherrystudio/ui' import { usePreference } from '@data/hooks/usePreference' import { CopyIcon, FilePngIcon } from '@renderer/components/Icons' import { isMac } from '@renderer/config/constant' @@ -8,7 +8,7 @@ import { useTemporaryValue } from '@renderer/hooks/useTemporaryValue' import { classNames } from '@renderer/utils' import { extractHtmlTitle, getFileNameFromHtmlTitle } from '@renderer/utils/formats' import { captureScrollableIframeAsBlob, captureScrollableIframeAsDataURL } from '@renderer/utils/image' -import { Dropdown, Modal, Splitter, Tooltip, Typography } from 'antd' +import { Dropdown, Modal, Splitter, Typography } from 'antd' import { Camera, Check, Code, Eye, Maximize2, Minimize2, SaveIcon, SquareSplitHorizontal, X } from 'lucide-react' import { useCallback, useEffect, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' @@ -126,7 +126,7 @@ const HtmlArtifactsPopup: React.FC = ({ open, title, ht } ] }}> - +
= ({ return ( {latencyText && {latencyText}} - + {icon} diff --git a/src/renderer/src/components/Icons/ReasoningIcon.tsx b/src/renderer/src/components/Icons/ReasoningIcon.tsx index 8d7aa94fed..ae83187891 100644 --- a/src/renderer/src/components/Icons/ReasoningIcon.tsx +++ b/src/renderer/src/components/Icons/ReasoningIcon.tsx @@ -1,4 +1,4 @@ -import { Tooltip } from 'antd' +import { Tooltip } from '@cherrystudio/ui' import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' @@ -9,7 +9,7 @@ const ReasoningIcon: FC - + diff --git a/src/renderer/src/components/Icons/SVGIcon.tsx b/src/renderer/src/components/Icons/SVGIcon.tsx index ad503f0e38..f866ad21d5 100644 --- a/src/renderer/src/components/Icons/SVGIcon.tsx +++ b/src/renderer/src/components/Icons/SVGIcon.tsx @@ -279,7 +279,7 @@ export function PoeLogo(props: SVGProps) { y1="7.303" y2="27.715"> - + ) { y1="23.511" y2="9.464"> - + diff --git a/src/renderer/src/components/Icons/ToolsCallingIcon.tsx b/src/renderer/src/components/Icons/ToolsCallingIcon.tsx index 36b831e715..f8fe661e58 100644 --- a/src/renderer/src/components/Icons/ToolsCallingIcon.tsx +++ b/src/renderer/src/components/Icons/ToolsCallingIcon.tsx @@ -1,5 +1,5 @@ import { ToolOutlined } from '@ant-design/icons' -import { Tooltip } from 'antd' +import { Tooltip } from '@cherrystudio/ui' import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' @@ -10,7 +10,7 @@ const ToolsCallingIcon: FC - + diff --git a/src/renderer/src/components/Icons/VisionIcon.tsx b/src/renderer/src/components/Icons/VisionIcon.tsx index d1f2b4e180..8ae435789b 100644 --- a/src/renderer/src/components/Icons/VisionIcon.tsx +++ b/src/renderer/src/components/Icons/VisionIcon.tsx @@ -1,4 +1,4 @@ -import { Tooltip } from 'antd' +import { Tooltip } from '@cherrystudio/ui' import { ImageIcon } from 'lucide-react' import type { FC } from 'react' import React from 'react' @@ -10,7 +10,7 @@ const VisionIcon: FC, return ( - + diff --git a/src/renderer/src/components/Icons/WebSearchIcon.tsx b/src/renderer/src/components/Icons/WebSearchIcon.tsx index 156ea1307b..2a32227196 100644 --- a/src/renderer/src/components/Icons/WebSearchIcon.tsx +++ b/src/renderer/src/components/Icons/WebSearchIcon.tsx @@ -1,5 +1,5 @@ import { GlobalOutlined } from '@ant-design/icons' -import { Tooltip } from 'antd' +import { Tooltip } from '@cherrystudio/ui' import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' @@ -10,7 +10,7 @@ const WebSearchIcon: FC - + diff --git a/src/renderer/src/components/InputEmbeddingDimension.tsx b/src/renderer/src/components/InputEmbeddingDimension.tsx index db2c79d87f..f5d8134e96 100644 --- a/src/renderer/src/components/InputEmbeddingDimension.tsx +++ b/src/renderer/src/components/InputEmbeddingDimension.tsx @@ -1,11 +1,11 @@ -import { Button } from '@cherrystudio/ui' +import { Button, Tooltip } from '@cherrystudio/ui' import { loggerService } from '@logger' import AiProvider from '@renderer/aiCore' import { RefreshIcon } from '@renderer/components/Icons' import { useProvider } from '@renderer/hooks/useProvider' import type { Model } from '@renderer/types' import { getErrorMessage } from '@renderer/utils' -import { InputNumber, Space, Tooltip } from 'antd' +import { InputNumber, Space } from 'antd' import { memo, useCallback, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' @@ -74,7 +74,7 @@ const InputEmbeddingDimension = ({ onChange={onChange} disabled={disabled} /> - + - )), - Tooltip: vi.fn(({ children, title }) =>
{children}
) + )) +})) + +vi.mock('@cherrystudio/ui', () => ({ + Button: ({ children, onPress, disabled, isDisabled, startContent, ...props }: any) => ( + + ), + Tooltip: ({ children }: { children: React.ReactNode }) => <>{children} })) describe('ImageToolButton', () => { diff --git a/src/renderer/src/components/Preview/__tests__/__snapshots__/ImageToolButton.test.tsx.snap b/src/renderer/src/components/Preview/__tests__/__snapshots__/ImageToolButton.test.tsx.snap index fe1074ed7a..1835123608 100644 --- a/src/renderer/src/components/Preview/__tests__/__snapshots__/ImageToolButton.test.tsx.snap +++ b/src/renderer/src/components/Preview/__tests__/__snapshots__/ImageToolButton.test.tsx.snap @@ -2,24 +2,17 @@ exports[`ImageToolButton > should match snapshot 1`] = ` -
- -
+ Icon + +
`; diff --git a/src/renderer/src/components/ProviderLogoPicker/index.tsx b/src/renderer/src/components/ProviderLogoPicker/index.tsx index d06a1a9cbe..338b0ef647 100644 --- a/src/renderer/src/components/ProviderLogoPicker/index.tsx +++ b/src/renderer/src/components/ProviderLogoPicker/index.tsx @@ -1,8 +1,9 @@ import { SearchOutlined } from '@ant-design/icons' +import { Tooltip } from '@cherrystudio/ui' import { ProviderAvatarPrimitive } from '@renderer/components/ProviderAvatar' import { PROVIDER_LOGO_MAP } from '@renderer/config/providers' import { getProviderLabel } from '@renderer/i18n/label' -import { Input, Tooltip } from 'antd' +import { Input } from 'antd' import type { FC } from 'react' import { useMemo, useState } from 'react' import styled from 'styled-components' @@ -51,9 +52,14 @@ const ProviderLogoPicker: FC = ({ onProviderClick }) => { {filteredProviders.map(({ id, name, logo }) => ( - + handleProviderClick(e, id)}> - + ))} diff --git a/src/renderer/src/components/RichEditor/extensions/code-block-shiki/CodeBlockNodeView.tsx b/src/renderer/src/components/RichEditor/extensions/code-block-shiki/CodeBlockNodeView.tsx index 7b6853a7bd..b989c545cf 100644 --- a/src/renderer/src/components/RichEditor/extensions/code-block-shiki/CodeBlockNodeView.tsx +++ b/src/renderer/src/components/RichEditor/extensions/code-block-shiki/CodeBlockNodeView.tsx @@ -1,8 +1,8 @@ import { CopyOutlined } from '@ant-design/icons' -import { Button } from '@cherrystudio/ui' +import { Button, Tooltip } from '@cherrystudio/ui' import { DEFAULT_LANGUAGES, getHighlighter, getShiki } from '@renderer/utils/shiki' import { NodeViewContent, NodeViewWrapper, type ReactNodeViewProps, ReactNodeViewRenderer } from '@tiptap/react' -import { Select, Tooltip } from 'antd' +import { Select } from 'antd' import type { FC } from 'react' import { useCallback, useEffect, useState } from 'react' @@ -66,7 +66,7 @@ const CodeBlockNodeView: FC = (props) => { options={languageOptions.map((lang) => ({ value: lang, label: lang }))} style={{ minWidth: 90 }} /> - + ) - const MockTooltip: React.FC> = ({ children, title }) => ( + return { + Button: MockButton, + InputNumber: MockInputNumber, + Space: { Compact: MockSpaceCompact } + } +}) + +vi.mock('@cherrystudio/ui', () => ({ + Button: ({ children, onPress, disabled, isDisabled, startContent, ...props }: any) => ( + + ), + Tooltip: ({ children, title }: { children: React.ReactNode; title: React.ReactNode }) => (
{children}
) - - return { - Button: MockButton, - InputNumber: MockInputNumber, - Space: { Compact: MockSpaceCompact }, - Tooltip: MockTooltip - } -}) +})) // Mock dependencies vi.mock('@renderer/aiCore', () => ({ diff --git a/src/renderer/src/components/__tests__/__snapshots__/InputEmbeddingDimension.test.tsx.snap b/src/renderer/src/components/__tests__/__snapshots__/InputEmbeddingDimension.test.tsx.snap index 609d3df380..f8ddaa407d 100644 --- a/src/renderer/src/components/__tests__/__snapshots__/InputEmbeddingDimension.test.tsx.snap +++ b/src/renderer/src/components/__tests__/__snapshots__/InputEmbeddingDimension.test.tsx.snap @@ -14,22 +14,17 @@ exports[`InputEmbeddingDimension > basic rendering > should match snapshot with />
diff --git a/src/renderer/src/components/app/PinnedMinapps.tsx b/src/renderer/src/components/app/PinnedMinapps.tsx index eb1603d52a..1c51464bcf 100644 --- a/src/renderer/src/components/app/PinnedMinapps.tsx +++ b/src/renderer/src/components/app/PinnedMinapps.tsx @@ -1,3 +1,4 @@ +import { Tooltip } from '@cherrystudio/ui' import { usePreference } from '@data/hooks/usePreference' import { useTheme } from '@renderer/context/ThemeProvider' import { useMinappPopup } from '@renderer/hooks/useMinappPopup' @@ -5,7 +6,7 @@ import { useMinapps } from '@renderer/hooks/useMinapps' import { useNavbarPosition } from '@renderer/hooks/useNavbar' import type { MinAppType } from '@renderer/types' import type { MenuProps } from 'antd' -import { Dropdown, Tooltip } from 'antd' +import { Dropdown } from 'antd' import type { FC } from 'react' import { useEffect } from 'react' import { useTranslation } from 'react-i18next' @@ -86,16 +87,18 @@ export const SidebarOpenedMinappTabs: FC = () => { const isActive = minappShow && currentMinappId === app.id return ( - - - handleOnClick(app)} - className={`${isActive ? 'opened-active' : ''}`}> - - - - + + {/* FIXME: Antd Dropdown is not compatible with HeroUI Tooltip */} + {/* */} + handleOnClick(app)} className={`${isActive ? 'opened-active' : ''}`}> + + + {/* */} + ) })} @@ -126,7 +129,7 @@ export const SidebarPinnedApps: FC = () => { ] const isActive = minappShow && currentMinappId === app.id return ( - + { + placement="right" + content={t('settings.theme.title') + ': ' + getThemeModeLabel(settedTheme)} + delay={800}> {settedTheme === ThemeMode.dark ? ( @@ -103,7 +102,7 @@ const Sidebar: FC = () => { )} - + { hideMinappPopup() @@ -161,7 +160,7 @@ const MainMenus: FC = () => { const isActive = path === '/' ? isRoute(path) : isRoutes(path) return ( - + { hideMinappPopup() diff --git a/src/renderer/src/pages/code/CodeToolsPage.tsx b/src/renderer/src/pages/code/CodeToolsPage.tsx index 982988383f..054654632e 100644 --- a/src/renderer/src/pages/code/CodeToolsPage.tsx +++ b/src/renderer/src/pages/code/CodeToolsPage.tsx @@ -1,5 +1,4 @@ -import { Button } from '@cherrystudio/ui' -import { Avatar } from '@cherrystudio/ui' +import { Avatar, Button, Tooltip } from '@cherrystudio/ui' import AiProvider from '@renderer/aiCore' import { Navbar, NavbarCenter } from '@renderer/components/app/Navbar' import ModelSelector from '@renderer/components/ModelSelector' @@ -18,7 +17,7 @@ import { setIsBunInstalled } from '@renderer/store/mcp' import type { EndpointType, Model } from '@renderer/types' import type { TerminalConfig } from '@shared/config/constant' import { codeTools, terminalApps } from '@shared/config/constant' -import { Alert, Checkbox, Input, Popover, Select, Space, Tooltip } from 'antd' +import { Alert, Checkbox, Input, Popover, Select, Space } from 'antd' import { ArrowUpRight, Download, FolderOpen, HelpCircle, Terminal, X } from 'lucide-react' import type { FC } from 'react' import { useCallback, useEffect, useMemo, useState } from 'react' @@ -458,7 +457,7 @@ const CodeToolsPage: FC = () => { selectedTerminal !== terminalApps.cmd && selectedTerminal !== terminalApps.powershell && selectedTerminal !== terminalApps.windowsTerminal && ( - +
diff --git a/src/renderer/src/pages/home/Tabs/components/OpenAISettingsGroup.tsx b/src/renderer/src/pages/home/Tabs/components/OpenAISettingsGroup.tsx index e752f450b5..aaae0925ab 100644 --- a/src/renderer/src/pages/home/Tabs/components/OpenAISettingsGroup.tsx +++ b/src/renderer/src/pages/home/Tabs/components/OpenAISettingsGroup.tsx @@ -1,3 +1,4 @@ +import { HelpTooltip } from '@cherrystudio/ui' import Selector from '@renderer/components/Selector' import { isSupportedReasoningEffortOpenAIModel, @@ -14,8 +15,6 @@ import { setOpenAISummaryText, setOpenAIVerbosity } from '@renderer/store/settin import type { Model, OpenAIServiceTier, OpenAISummaryText, ServiceTier } from '@renderer/types' import { GroqServiceTiers, OpenAIServiceTiers, SystemProviderIds } from '@renderer/types' import type { OpenAIVerbosity } from '@types' -import { Tooltip } from 'antd' -import { CircleHelp } from 'lucide-react' import type { FC } from 'react' import { useCallback, useEffect, useMemo } from 'react' import { useTranslation } from 'react-i18next' @@ -167,9 +166,7 @@ const OpenAISettingsGroup: FC = ({ model, providerId, SettingGroup, Setti {t('settings.openai.service_tier.title')}{' '} - - - + = ({ model, providerId, SettingGroup, Setti {t('settings.openai.summary_text_mode.title')}{' '} - - - + = ({ model, providerId, SettingGroup, Setti {isSupportVerbosity && ( - {t('settings.openai.verbosity.title')}{' '} - - - + {t('settings.openai.verbosity.title')} = ({ selectedBase }) => {
- +
{base.model.name}
diff --git a/src/renderer/src/pages/knowledge/__tests__/AdvancedSettingsPanel.test.tsx b/src/renderer/src/pages/knowledge/__tests__/AdvancedSettingsPanel.test.tsx index 8bb50c250f..053936899c 100644 --- a/src/renderer/src/pages/knowledge/__tests__/AdvancedSettingsPanel.test.tsx +++ b/src/renderer/src/pages/knowledge/__tests__/AdvancedSettingsPanel.test.tsx @@ -25,7 +25,7 @@ const mocks = vi.hoisted(() => { } }) -vi.mock('@renderer/components/TooltipIcons', () => ({ +vi.mock('@cherrystudio/ui', () => ({ InfoTooltip: ({ title }: { title: string }) =>
{mocks.i18n.t(title)}
})) @@ -36,7 +36,10 @@ vi.mock('react-i18next', () => ({ })) vi.mock('lucide-react', () => ({ - TriangleAlert: () => warning + TriangleAlert: () => warning, + CheckIcon: () => check, + CircleXIcon: () => error, + AlertTriangleIcon: () => alert })) vi.mock('antd', () => ({ diff --git a/src/renderer/src/pages/knowledge/__tests__/GeneralSettingsPanel.test.tsx b/src/renderer/src/pages/knowledge/__tests__/GeneralSettingsPanel.test.tsx index 64c566ac2d..95d1f8e6bc 100644 --- a/src/renderer/src/pages/knowledge/__tests__/GeneralSettingsPanel.test.tsx +++ b/src/renderer/src/pages/knowledge/__tests__/GeneralSettingsPanel.test.tsx @@ -31,10 +31,10 @@ const mocks = vi.hoisted(() => ({ })) // Mock InfoTooltip component -vi.mock('@renderer/components/TooltipIcons', () => ({ +vi.mock('@cherrystudio/ui', () => ({ InfoTooltip: ({ title, placement }: { title: string; placement: string }) => ( - - ℹ️ + + {title} ) })) diff --git a/src/renderer/src/pages/knowledge/__tests__/__snapshots__/AdvancedSettingsPanel.test.tsx.snap b/src/renderer/src/pages/knowledge/__tests__/__snapshots__/AdvancedSettingsPanel.test.tsx.snap index 20daa4a4ef..4dca9d125c 100644 --- a/src/renderer/src/pages/knowledge/__tests__/__snapshots__/AdvancedSettingsPanel.test.tsx.snap +++ b/src/renderer/src/pages/knowledge/__tests__/__snapshots__/AdvancedSettingsPanel.test.tsx.snap @@ -27,9 +27,7 @@ exports[`AdvancedSettingsPanel > basic rendering > should match snapshot 1`] = ` class="settings-label" > 分块大小 -
- knowledge.chunk_size_tooltip -
+
basic rendering > should match snapshot 1`] = ` class="settings-label" > 分块重叠 -
- knowledge.chunk_overlap_tooltip -
+
basic rendering > should match snapshot 1`] = ` class="settings-label" > 检索相似度阈值 -
- knowledge.threshold_tooltip -
+
basic rendering > should match snapshot 1`] = ` - ℹ️ - + />
basic rendering > should match snapshot 1`] = ` - ℹ️ - + />
basic rendering > should match snapshot 1`] = ` - ℹ️ - + /> = ({ textTo return ( - + handleCopy(textToCopy)}> diff --git a/src/renderer/src/pages/knowledge/components/KnowledgeSettings/AdvancedSettingsPanel.tsx b/src/renderer/src/pages/knowledge/components/KnowledgeSettings/AdvancedSettingsPanel.tsx index 03b6d1b4e4..788155b277 100644 --- a/src/renderer/src/pages/knowledge/components/KnowledgeSettings/AdvancedSettingsPanel.tsx +++ b/src/renderer/src/pages/knowledge/components/KnowledgeSettings/AdvancedSettingsPanel.tsx @@ -1,4 +1,4 @@ -import { InfoTooltip } from '@renderer/components/TooltipIcons' +import { InfoTooltip } from '@cherrystudio/ui' import type { KnowledgeBase } from '@renderer/types' import { Alert, InputNumber } from 'antd' import { TriangleAlert } from 'lucide-react' @@ -24,7 +24,7 @@ const AdvancedSettingsPanel: React.FC = ({ newBase,
{t('knowledge.chunk_size')} - +
= ({ newBase,
{t('knowledge.chunk_overlap')} - +
= ({ newBase,
{t('knowledge.threshold')} - +
= ({
{t('settings.tool.preprocess.title')} - +
= ({ Options }) => { {t('paintings.auto_create_paint')} - - - + onChangeAutoCreate(checked)} /> @@ -1103,18 +1096,6 @@ const ToolbarMenu = styled.div` align-items: center; gap: 6px; ` -const InfoIcon = styled(Info)` - margin-left: 5px; - cursor: help; - color: var(--color-text-2); - opacity: 0.6; - width: 16px; - height: 16px; - - &:hover { - opacity: 1; - } -` const SliderContainer = styled.div` display: flex; diff --git a/src/renderer/src/pages/paintings/SiliconPage.tsx b/src/renderer/src/pages/paintings/SiliconPage.tsx index 442f7b310a..f13282ad8b 100644 --- a/src/renderer/src/pages/paintings/SiliconPage.tsx +++ b/src/renderer/src/pages/paintings/SiliconPage.tsx @@ -1,7 +1,5 @@ import { PlusOutlined, RedoOutlined } from '@ant-design/icons' -import { ColFlex, RowFlex } from '@cherrystudio/ui' -import { Switch } from '@cherrystudio/ui' -import { Button } from '@cherrystudio/ui' +import { Button, ColFlex, InfoTooltip, RowFlex, Switch } from '@cherrystudio/ui' import { useCache } from '@data/hooks/useCache' import { usePreference } from '@data/hooks/usePreference' import { loggerService } from '@logger' @@ -26,9 +24,8 @@ import FileManager from '@renderer/services/FileManager' import { translateText } from '@renderer/services/TranslateService' import type { FileMetadata, Painting } from '@renderer/types' import { getErrorMessage, uuid } from '@renderer/utils' -import { Input, InputNumber, Radio, Select, Slider, Tooltip } from 'antd' +import { Input, InputNumber, Radio, Select, Slider } from 'antd' import TextArea from 'antd/es/input/TextArea' -import { Info } from 'lucide-react' import type { FC } from 'react' import { useEffect, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' @@ -407,9 +404,7 @@ const SiliconPage: FC<{ Options: string[] }> = ({ Options }) => { {t('paintings.number_images')} - - - + = ({ Options }) => { {t('paintings.seed')} - - - + = ({ Options }) => { {t('paintings.inference_steps')} - - - + updatePaintingState({ steps: v })} /> @@ -453,9 +444,7 @@ const SiliconPage: FC<{ Options: string[] }> = ({ Options }) => { {t('paintings.guidance_scale')} - - - + = ({ Options }) => { {t('paintings.negative_prompt')} - - - +