Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat: enhance ToolItem and ToolsList components with improved text handling and styling

Innei9db344fa4b5e
diff --git a/src/features/ChatInput/ActionBar/Tools/ToolItem.tsx b/src/features/ChatInput/ActionBar/Tools/ToolItem.tsx
index dec98e3cc68..f745c4ef439 100644
--- a/src/features/ChatInput/ActionBar/Tools/ToolItem.tsx
+++ b/src/features/ChatInput/ActionBar/Tools/ToolItem.tsx
@@ -1,4 +1,4 @@
-import { Flexbox } from '@lobehub/ui';
+import { Flexbox, Text } from '@lobehub/ui';
import { memo, Suspense } from 'react';
import DebugNode from '@/components/DebugNode';
@@ -6,7 +6,7 @@ import PluginTag from '@/components/Plugins/PluginTag';
import { useToolStore } from '@/store/tool';
import { customPluginSelectors } from '@/store/tool/selectors';
-import { type CheckboxItemProps } from '../components/CheckboxWithLoading';
+import type { CheckboxItemProps } from '../components/CheckboxWithLoading';
import CheckboxItem from '../components/CheckboxWithLoading';
const ToolItem = memo<CheckboxItemProps>(({ id, onUpdate, label, checked }) => {
@@ -19,8 +19,15 @@ const ToolItem = memo<CheckboxItemProps>(({ id, onUpdate, label, checked }) => {
hasPadding={false}
id={id}
label={
- <Flexbox horizontal align={'center'} gap={8}>
- {label || id}
+ <Flexbox allowShrink horizontal align={'center'} gap={8}>
+ <Text
+ style={{ lineHeight: 1.4, paddingBlock: 1 }}
+ ellipsis={{
+ tooltipWhenOverflow: true,
+ }}
+ >
+ {label || id}
+ </Text>
{isCustom && <PluginTag showText={false} type={'customPlugin'} />}
</Flexbox>
}
diff --git a/src/features/ChatInput/ActionBar/Tools/ToolsList.tsx b/src/features/ChatInput/ActionBar/Tools/ToolsList.tsx
index 95776174ac8..78218ab1a1d 100644
--- a/src/features/ChatInput/ActionBar/Tools/ToolsList.tsx
+++ b/src/features/ChatInput/ActionBar/Tools/ToolsList.tsx
@@ -1,13 +1,14 @@
-import { type ItemType } from '@lobehub/ui';
+import type { ItemType } from '@lobehub/ui';
import { Flexbox, Icon, Text } from '@lobehub/ui';
import { Divider } from 'antd';
import { createStaticStyles, cssVar } from 'antd-style';
-import { type ReactNode } from 'react';
+import type { ReactNode } from 'react';
import { Fragment, isValidElement, memo } from 'react';
export const toolsListStyles = createStaticStyles(({ css }) => ({
groupLabel: css`
- padding-block: 4px;
+ padding-block-start: 12px;
+ padding-block-end: 4px;
padding-inline: 12px;
`,
item: css`