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.

♻️ refactor: migrate Tabs to @lobehub/ui/base-ui (#16229)

Inneie751b884f5c6
diff --git a/locales/en-US/agent.json b/locales/en-US/agent.json
index ae954d95bad..83c882aa5c5 100644
--- a/locales/en-US/agent.json
+++ b/locales/en-US/agent.json
@@ -56,7 +56,6 @@
"channel.deleteConfirmDesc": "This action will permanently remove this message channel and its configuration. This cannot be undone.",
"channel.devWebhookProxyUrl": "HTTPS Tunnel URL",
"channel.devWebhookProxyUrlHint": "Optional. HTTPS tunnel URL for forwarding webhook requests to local dev server.",
- "channel.disabled": "Disabled",
"channel.discord.description": "Connect this agent to Discord server for channel chat and direct messages.",
"channel.displayToolCalls": "Display Tool Calls",
"channel.displayToolCallsHint": "Show tool call details during AI responses. When disabled, only the final response is displayed for a cleaner experience.",
@@ -72,7 +71,6 @@
"channel.dmPolicyPairing": "Pairing",
"channel.dmPolicyPairingHint": "Strangers need /approve to DM",
"channel.documentation": "Documentation",
- "channel.enabled": "Enabled",
"channel.encryptKey": "Encrypt Key",
"channel.encryptKeyHint": "Optional. Used to decrypt encrypted event payloads.",
"channel.encryptKeyPlaceholder": "Optional encryption key",
diff --git a/locales/zh-CN/agent.json b/locales/zh-CN/agent.json
index 007b130723a..71028c5a697 100644
--- a/locales/zh-CN/agent.json
+++ b/locales/zh-CN/agent.json
@@ -56,7 +56,6 @@
"channel.deleteConfirmDesc": "此操作将永久移除该消息频道及其配置,且无法撤销。",
"channel.devWebhookProxyUrl": "HTTPS 隧道地址",
"channel.devWebhookProxyUrlHint": "可选。用于将 webhook 请求转发到本地开发服务器的 HTTPS 隧道 URL。",
- "channel.disabled": "已禁用",
"channel.discord.description": "将助手连接到 Discord 服务器,支持频道聊天和私信。",
"channel.displayToolCalls": "展示工具调用",
"channel.displayToolCallsHint": "在 AI 回复过程中展示工具调用详情。关闭后仅展示最终回复,获得更简洁的体验。",
@@ -72,7 +71,6 @@
"channel.dmPolicyPairing": "配对审批",
"channel.dmPolicyPairingHint": "陌生人需经 /approve 审批后才能私信",
"channel.documentation": "文档",
- "channel.enabled": "已启用",
"channel.encryptKey": "Encrypt Key",
"channel.encryptKeyHint": "可选。用于解密加密的事件推送。",
"channel.encryptKeyPlaceholder": "可选的加密密钥",
diff --git a/package.json b/package.json
index 7bf8fdb753b..0982b7e75ed 100644
--- a/package.json
+++ b/package.json
@@ -295,7 +295,7 @@
"@lobehub/icons": "^5.0.0",
"@lobehub/market-sdk": "0.39.1",
"@lobehub/tts": "^5.1.2",
- "@lobehub/ui": "^5.15.10",
+ "@lobehub/ui": "^5.16.1",
"@modelcontextprotocol/sdk": "^1.26.0",
"@napi-rs/canvas": "^0.1.88",
"@neondatabase/serverless": "^1.0.2",
diff --git a/packages/builtin-tool-claude-code/src/client/Intervention/AskUserQuestion/index.tsx b/packages/builtin-tool-claude-code/src/client/Intervention/AskUserQuestion/index.tsx
index 86ee649284d..2f21b35606b 100644
--- a/packages/builtin-tool-claude-code/src/client/Intervention/AskUserQuestion/index.tsx
+++ b/packages/builtin-tool-claude-code/src/client/Intervention/AskUserQuestion/index.tsx
@@ -1,7 +1,8 @@
'use client';
import type { BuiltinInterventionProps } from '@lobechat/types';
-import { Button, Flexbox, Icon, Tabs, Text, TextArea } from '@lobehub/ui';
+import { Button, Flexbox, Icon, Text, TextArea } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { ArrowLeft, Check, PenLine, Send, X } from 'lucide-react';
import { memo } from 'react';
@@ -81,7 +82,6 @@ const AskUserQuestionIntervention = memo<BuiltinInterventionProps<AskUserQuestio
<Flexbox gap={12}>
{!escapeActive && isMulti && (
<Tabs
- compact
activeKey={activeTab}
items={questions.map((q, idx) => {
const done = isQuestionAnswered(q, picks, custom);
diff --git a/packages/locales/src/default/agent.ts b/packages/locales/src/default/agent.ts
index f269e4fb334..c8caafcca9f 100644
--- a/packages/locales/src/default/agent.ts
+++ b/packages/locales/src/default/agent.ts
@@ -28,7 +28,6 @@ export default {
'channel.devWebhookProxyUrl': 'HTTPS Tunnel URL',
'channel.devWebhookProxyUrlHint':
'Optional. HTTPS tunnel URL for forwarding webhook requests to local dev server.',
- 'channel.disabled': 'Disabled',
'channel.discord.description':
'Connect this agent to Discord server for channel chat and direct messages.',
'channel.documentation': 'Documentation',
@@ -41,7 +40,6 @@ export default {
'channel.importSuccess': 'Configuration imported successfully',
'channel.importFailed': 'Failed to import configuration',
'channel.importInvalidFormat': 'Invalid configuration file format',
- 'channel.enabled': 'Enabled',
'channel.encryptKey': 'Encrypt Key',
'channel.encryptKeyHint': 'Optional. Used to decrypt encrypted event payloads.',
'channel.encryptKeyPlaceholder': 'Optional encryption key',
diff --git a/src/components/HtmlPreview/PreviewDrawer.tsx b/src/components/HtmlPreview/PreviewDrawer.tsx
index 1fc106c417d..0e287d9b027 100644
--- a/src/components/HtmlPreview/PreviewDrawer.tsx
+++ b/src/components/HtmlPreview/PreviewDrawer.tsx
@@ -1,6 +1,7 @@
import { TITLE_BAR_HEIGHT } from '@lobechat/desktop-bridge';
import { exportFile } from '@lobechat/utils/client';
-import { Block, Button, Flexbox, Highlighter, HtmlPreview, Segmented } from '@lobehub/ui';
+import { Block, Button, Flexbox, Highlighter, HtmlPreview } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { Drawer } from 'antd';
import { createStaticStyles } from 'antd-style';
import { Code2, Download, Eye } from 'lucide-react';
@@ -51,29 +52,29 @@ const HtmlPreviewDrawer = memo<HtmlPreviewDrawerProps>(({ content, open, onClose
const Title = (
<Flexbox horizontal align={'center'} justify={'space-between'} style={{ width: '100%' }}>
{t('HtmlPreview.title')}
- <Segmented
- value={mode}
- options={[
+ <Tabs
+ activeKey={mode}
+ items={[
{
+ key: 'preview',
label: (
<Flexbox horizontal align={'center'} gap={6}>
<Eye size={16} />
{t('HtmlPreview.mode.preview')}
</Flexbox>
),
- value: 'preview',
},
{
+ key: 'code',
label: (
<Flexbox horizontal align={'center'} gap={6}>
<Code2 size={16} />
{t('HtmlPreview.mode.code')}
</Flexbox>
),
- value: 'code',
},
]}
- onChange={(v) => setMode(v as 'preview' | 'code')}
+ onChange={(key) => setMode(key as 'preview' | 'code')}
/>
<Button
color={'default'}
diff --git a/src/components/OllamaSetupGuide/index.tsx b/src/components/OllamaSetupGuide/index.tsx
index b139f705de3..c34b5513bac 100644
--- a/src/components/OllamaSetupGuide/index.tsx
+++ b/src/components/OllamaSetupGuide/index.tsx
@@ -1,5 +1,6 @@
import { ProviderCombine } from '@lobehub/icons';
-import { Flexbox, Highlighter, Snippet, Tabs } from '@lobehub/ui';
+import { Flexbox, Highlighter, Snippet } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { Steps } from 'antd';
import { createStaticStyles, cssVar } from 'antd-style';
import { readableColor } from 'polished';
@@ -44,7 +45,6 @@ const SetupGuide = memo(() => {
<>
<ProviderCombine provider={'ollama'} size={30} style={{ marginBottom: -8, marginLeft: 4 }} />
<Tabs
- compact
items={[
{
children: (
diff --git a/src/components/SplitButton/index.tsx b/src/components/SplitButton/index.tsx
new file mode 100644
index 00000000000..eb0b5b33daa
--- /dev/null
+++ b/src/components/SplitButton/index.tsx
@@ -0,0 +1,93 @@
+'use client';
+
+import { Button, type ButtonProps, Flexbox } from '@lobehub/ui';
+import { DropdownMenu, type DropdownMenuProps } from '@lobehub/ui/base-ui';
+import { createStaticStyles, cx } from 'antd-style';
+import { ChevronDownIcon } from 'lucide-react';
+import { createContext, type CSSProperties, type ReactNode, use, useMemo } from 'react';
+
+interface SharedVisualProps {
+ danger?: boolean;
+ disabled?: boolean;
+ loading?: boolean;
+ size?: ButtonProps['size'];
+ type?: ButtonProps['type'];
+}
+
+interface SplitButtonProps extends SharedVisualProps {
+ children: ReactNode;
+ className?: string;
+ style?: CSSProperties;
+}
+
+const SplitButtonContext = createContext<SharedVisualProps>({});
+
+const styles = createStaticStyles(({ css }) => ({
+ splitButton: css`
+ & > :where(button, a):first-of-type {
+ border-start-end-radius: 0;
+ border-end-end-radius: 0;
+ }
+
+ & > :where(button, a):last-of-type {
+ margin-inline-start: -1px;
+ border-start-start-radius: 0;
+ border-end-start-radius: 0;
+ }
+ `,
+}));
+
+const SplitButton = ({
+ children,
+ className,
+ style,
+ danger,
+ disabled,
+ loading,
+ size,
+ type,
+}: SplitButtonProps) => {
+ const shared = useMemo<SharedVisualProps>(
+ () => ({ danger, disabled, loading, size, type }),
+ [danger, disabled, loading, size, type],
+ );
+ return (
+ <SplitButtonContext value={shared}>
+ <Flexbox horizontal className={cx(styles.splitButton, className)} style={style}>
+ {children}
+ </Flexbox>
+ </SplitButtonContext>
+ );
+};
+
+const SplitButtonMain = (props: ButtonProps) => {
+ const shared = use(SplitButtonContext);
+ return <Button {...shared} {...props} />;
+};
+
+interface SplitButtonMenuProps extends Omit<DropdownMenuProps, 'children'> {
+ icon?: ReactNode;
+}
+
+const SplitButtonMenu = ({
+ icon = <ChevronDownIcon size={14} />,
+ ...menuProps
+}: SplitButtonMenuProps) => {
+ const shared = use(SplitButtonContext);
+ return (
+ <DropdownMenu {...menuProps}>
+ <Button {...shared} icon={icon} />
+ </DropdownMenu>
+ );
+};
+
+type SplitButtonComponent = typeof SplitButton & {
+ Main: typeof SplitButtonMain;
+ Menu: typeof SplitButtonMenu;
+};
+
+(SplitButton as SplitButtonComponent).Main = SplitButtonMain;
+(SplitButton as SplitButtonComponent).Menu = SplitButtonMenu;
+
+export type { SplitButtonMenuProps, SplitButtonProps };
+export default SplitButton as SplitButtonComponent;
diff --git a/src/features/AgentMockDevtools/DevtoolsLayout.tsx b/src/features/AgentMockDevtools/DevtoolsLayout.tsx
index d86458fe0e0..4e26877f8bf 100644
--- a/src/features/AgentMockDevtools/DevtoolsLayout.tsx
+++ b/src/features/AgentMockDevtools/DevtoolsLayout.tsx
@@ -1,4 +1,5 @@
-import { Flexbox, Segmented, Tag, Text } from '@lobehub/ui';
+import { Flexbox, Tag, Text } from '@lobehub/ui';
+import { Tabs, type TabsItem } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
import { memo, useCallback, useEffect, useMemo, useRef } from 'react';
@@ -13,9 +14,9 @@ import { type DevtoolsTab, useAgentMockStore } from './store/agentMockStore';
import { FixtureView } from './views/FixtureView';
import { TimelineView } from './views/TimelineView';
-const TAB_OPTIONS: Array<{ label: string; value: DevtoolsTab }> = [
- { label: 'Timeline', value: 'timeline' },
- { label: 'Fixture', value: 'fixture' },
+const TAB_OPTIONS: TabsItem[] = [
+ { key: 'timeline', label: 'Timeline' },
+ { key: 'fixture', label: 'Fixture' },
];
const styles = createStaticStyles(({ css }) => ({
@@ -142,11 +143,11 @@ export const DevtoolsLayout = memo(() => {
</Flexbox>
<Flexbox horizontal align="center" className={styles.rowTwo} justify="space-between">
- <Segmented
- options={TAB_OPTIONS}
+ <Tabs
+ activeKey={activeTab}
+ items={TAB_OPTIONS}
size="small"
- value={activeTab}
- onChange={(value) => setActiveTab(value as DevtoolsTab)}
+ onChange={(key) => setActiveTab(key as DevtoolsTab)}
/>
<span className={styles.hint}>⌘K open palette</span>
</Flexbox>
diff --git a/src/features/AgentMockDevtools/components/TransportBar.tsx b/src/features/AgentMockDevtools/components/TransportBar.tsx
index 30c4987ce88..2c98dea4604 100644
--- a/src/features/AgentMockDevtools/components/TransportBar.tsx
+++ b/src/features/AgentMockDevtools/components/TransportBar.tsx
@@ -1,5 +1,6 @@
import type { SpeedMultiplier } from '@lobechat/agent-mock';
-import { ActionIcon, Dropdown, Flexbox, Segmented, toast } from '@lobehub/ui';
+import { ActionIcon, type DropdownItem, DropdownMenu, Flexbox, toast } from '@lobehub/ui';
+import { Tabs, type TabsItem } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
import { Pause, Play, Repeat, RotateCcw, SkipForward } from 'lucide-react';
import { memo, useCallback, useMemo, useRef } from 'react';
@@ -9,12 +10,12 @@ import { useAgentMockReplayTarget } from '../hooks/useAgentMockReplayTarget';
import { useMockCases } from '../hooks/useMockCases';
import { useAgentMockStore } from '../store/agentMockStore';
-const SPEED_OPTIONS: Array<{ label: string; value: SpeedMultiplier }> = [
- { label: '0.5×', value: 0.5 },
- { label: '1×', value: 1 },
- { label: '2×', value: 2 },
- { label: '5×', value: 5 },
- { label: '∞', value: 'instant' },
+const SPEED_OPTIONS: Array<{ key: string; label: string; value: SpeedMultiplier }> = [
+ { key: '0.5', label: '0.5×', value: 0.5 },
+ { key: '1', label: '1×', value: 1 },
+ { key: '2', label: '2×', value: 2 },
+ { key: '5', label: '5×', value: 5 },
+ { key: 'instant', label: '∞', value: 'instant' },
];
const styles = createStaticStyles(({ css }) => ({
@@ -117,7 +118,7 @@ export const TransportBar = memo(() => {
launchCase();
}, [launchCase, playback, seekToEventIndex, selected, status]);
- const stepMenu = useMemo(
+ const stepMenu: DropdownItem[] = useMemo(
() => [
{ key: 'event', label: 'Next event', onClick: stepEvent },
{ key: 'step', label: 'Next step', onClick: stepStep },
@@ -157,16 +158,9 @@ export const TransportBar = memo(() => {
title={running ? 'Pause' : paused ? 'Resume' : 'Play'}
onClick={handlePlay}
/>
- <Dropdown
- disabled={disabled}
- placement="topLeft"
- menu={{
- items: stepMenu.map(({ key, label }) => ({ key, label })),
- onClick: ({ key }) => stepMenu.find((m) => m.key === key)?.onClick(),
- }}
- >
+ <DropdownMenu items={stepMenu} placement="topLeft">
<ActionIcon disabled={disabled} icon={SkipForward} size="small" title="Step" />
- </Dropdown>
+ </DropdownMenu>
<ActionIcon
disabled={disabled}
icon={RotateCcw}
@@ -200,13 +194,13 @@ export const TransportBar = memo(() => {
<span className={styles.time}>
{elapsed} / {total}
</span>
- <Segmented
- disabled={disabled}
- options={SPEED_OPTIONS}
+ <Tabs
+ activeKey={String(speed)}
+ items={SPEED_OPTIONS.map((o): TabsItem => ({ disabled, key: o.key, label: o.label }))}
size="small"
- value={speed}
- onChange={(value) => {
- const next = value as SpeedMultiplier;
+ onChange={(key) => {
+ const next = SPEED_OPTIONS.find((o) => o.key === key)?.value;
+ if (next === undefined) return;
setSpeedStore(next);
setSpeed(next);
}}
diff --git a/src/features/AgentSetting/SettingsModalLayout.tsx b/src/features/AgentSetting/SettingsModalLayout.tsx
index 14e6066e6ae..fd38bfe3880 100644
--- a/src/features/AgentSetting/SettingsModalLayout.tsx
+++ b/src/features/AgentSetting/SettingsModalLayout.tsx
@@ -1,7 +1,7 @@
'use client';
-import { ActionIcon, Avatar, Flexbox, Icon, Tabs, Text } from '@lobehub/ui';
-import { useModalContext } from '@lobehub/ui/base-ui';
+import { ActionIcon, Avatar, Flexbox, Icon, Text } from '@lobehub/ui';
+import { Tabs, useModalContext } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { type LucideIcon, XIcon } from 'lucide-react';
import { memo, type ReactNode } from 'react';
diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskScheduleConfig.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskScheduleConfig.tsx
index 79cba44ee2e..d08622d1bd0 100644
--- a/src/features/AgentTasks/AgentTaskDetail/TaskScheduleConfig.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/TaskScheduleConfig.tsx
@@ -1,16 +1,6 @@
import type { TaskAutomationMode } from '@lobechat/types';
-import {
- ActionIcon,
- Avatar,
- Button,
- Flexbox,
- Icon,
- InputNumber,
- Popover,
- Segmented,
- Text,
-} from '@lobehub/ui';
-import { Select } from '@lobehub/ui/base-ui';
+import { ActionIcon, Avatar, Button, Flexbox, Icon, InputNumber, Popover, Text } from '@lobehub/ui';
+import { Select, Tabs } from '@lobehub/ui/base-ui';
import { Switch } from 'antd';
import { createStaticStyles, cssVar } from 'antd-style';
import dayjs from 'dayjs';
@@ -282,7 +272,7 @@ const TaskScheduleConfig = memo(function TaskScheduleConfig({
);
const handleModeChange = useCallback(
- (value: string | number) => {
+ (value: string) => {
if (!canEditTask) return;
if (!finalTaskId) return;
setAutomationMode(finalTaskId, value as TaskAutomationMode);
@@ -336,30 +326,34 @@ const TaskScheduleConfig = memo(function TaskScheduleConfig({
{enabled && (
<>
- <Segmented
- block
- disabled={!canEditTask}
- value={automationMode ?? 'heartbeat'}
- options={[
+ <Tabs
+ activeKey={automationMode ?? 'heartbeat'}
+ items={[
{
+ disabled: !canEditTask,
+ key: 'schedule',
label: (
<Flexbox horizontal align="center" gap={6} justify="center">
<Icon icon={CalendarDays} size={14} />
<span>{t('taskSchedule.schedulerTab')}</span>
</Flexbox>
),
- value: 'schedule',
},
{
+ disabled: !canEditTask,
+ key: 'heartbeat',
label: (
<Flexbox horizontal align="center" gap={6} justify="center">
<Icon icon={RefreshCw} size={14} />
<span>{t('taskSchedule.intervalTab')}</span>
</Flexbox>
),
- value: 'heartbeat',
},
]}
+ styles={{
+ list: { display: 'flex', width: '100%' },
+ tab: { flex: 1 },
+ }}
onChange={handleModeChange}
/>
{automationMode === 'heartbeat' && (
diff --git a/src/features/AgentTasks/AgentTaskList/TasksGroupConfig.tsx b/src/features/AgentTasks/AgentTaskList/TasksGroupConfig.tsx
index 023f826bd68..29616277f35 100644
--- a/src/features/AgentTasks/AgentTaskList/TasksGroupConfig.tsx
+++ b/src/features/AgentTasks/AgentTaskList/TasksGroupConfig.tsx
@@ -1,5 +1,6 @@
import { type FormItemProps } from '@lobehub/ui';
-import { ActionIcon, Flexbox, Form, Icon, Popover, Segmented, Select } from '@lobehub/ui';
+import { ActionIcon, Flexbox, Form, Icon, Popover, Select } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { Switch } from 'antd';
import { createStaticStyles } from 'antd-style';
import {
@@ -159,18 +160,21 @@ const TasksGroupConfig = memo<TasksHeaderProps>(({ options, setOptions }) => {
const panelContent = (
<Flexbox gap={12} width={280}>
- <Segmented
- block
- value={viewMode}
- options={[
- { icon: <Icon icon={LayoutList} />, label: t('taskList.view.list'), value: 'list' },
+ <Tabs
+ activeKey={viewMode}
+ items={[
+ { icon: <Icon icon={LayoutList} />, key: 'list', label: t('taskList.view.list') },
{
icon: <Icon icon={LayoutGrid} />,
+ key: 'kanban',
label: t('taskList.view.board'),
- value: 'kanban',
},
]}
- onChange={(value) => setViewMode(value as 'kanban' | 'list')}
+ styles={{
+ list: { display: 'flex', width: '100%' },
+ tab: { flex: 1 },
+ }}
+ onChange={(key) => setViewMode(key as 'kanban' | 'list')}
/>
{viewMode === 'list' && (
<Form
diff --git a/src/features/AgentTopicManager/Header.tsx b/src/features/AgentTopicManager/Header.tsx
index 3c9a9a94e6c..2900ef0dcea 100644
--- a/src/features/AgentTopicManager/Header.tsx
+++ b/src/features/AgentTopicManager/Header.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Flexbox, Icon, Input, Segmented, Text } from '@lobehub/ui';
+import { Flexbox, Icon, Input, Text, Tooltip } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { Breadcrumb as AntBreadcrumb } from 'antd';
import { ChevronRight, LayoutGrid, List as ListIcon, Search } from 'lucide-react';
import { memo } from 'react';
@@ -33,7 +34,7 @@ const Header = memo<HeaderProps>(({ agentId }) => {
return (
<NavHeader
- styles={{ center: { maxWidth: 560, paddingInline: 16 } }}
+ styles={{ center: { maxWidth: 560, paddingInline: 16 }, left: { paddingInlineStart: 24 } }}
left={
<AntBreadcrumb
separator={<Icon icon={ChevronRight} size={14} />}
@@ -59,31 +60,36 @@ const Header = memo<HeaderProps>(({ agentId }) => {
}
right={
<Flexbox horizontal align={'center'} gap={6}>
- <Segmented
+ <Tabs
+ activeKey={viewMode}
size={'small'}
- value={viewMode}
- variant={'borderless'}
- options={[
+ items={[
{
- icon: <Icon icon={LayoutGrid} />,
- title: t('management.view.card'),
- value: 'card',
+ key: 'card',
+ label: (
+ <Tooltip title={t('management.view.card')}>
+ <Icon icon={LayoutGrid} />
+ </Tooltip>
+ ),
},
{
- icon: <Icon icon={ListIcon} />,
- title: t('management.view.list'),
- value: 'list',
+ key: 'list',
+ label: (
+ <Tooltip title={t('management.view.list')}>
+ <Icon icon={ListIcon} />
+ </Tooltip>
+ ),
},
]}
- onChange={(v) => setViewMode(v as 'card' | 'list')}
+ onChange={(key) => setViewMode(key as 'card' | 'list')}
/>
</Flexbox>
}
>
<Input
placeholder={t('management.searchPlaceholder')}
- prefix={<Icon icon={Search} size={'small'} />}
- size={'middle'}
+ prefix={<Icon icon={Search} size={'small'} style={{ marginInlineEnd: 4 }} />}
+ size={'small'}
value={search}
variant={'filled'}
onChange={(e) => setSearch(e.target.value)}
diff --git a/src/features/AgentTopicManager/Toolbar.tsx b/src/features/AgentTopicManager/Toolbar.tsx
index 4a4de992256..976e1568876 100644
--- a/src/features/AgentTopicManager/Toolbar.tsx
+++ b/src/features/AgentTopicManager/Toolbar.tsx
@@ -1,37 +1,139 @@
'use client';
-import {
- Button,
- type DropdownItem,
- DropdownMenu,
- Flexbox,
- Icon,
- Segmented,
- Text,
-} from '@lobehub/ui';
+import { ActionIcon, type DropdownItem, DropdownMenu, Flexbox, Icon, Text } from '@lobehub/ui';
+import { confirmModal, Tabs } from '@lobehub/ui/base-ui';
+import { App } from 'antd';
import { createStaticStyles, cssVar } from 'antd-style';
import {
+ Archive,
+ CalendarRange,
ChevronDown,
+ FolderClosed,
+ ListFilter,
ListTodoIcon,
type LucideIcon,
MessageCircle,
+ MoreHorizontal,
+ Plus,
TestTubeIcon,
Webhook,
+ X,
} from 'lucide-react';
-import { memo, useMemo } from 'react';
+import { memo, type ReactNode, useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
+import { useChatStore } from '@/store/chat';
+import { topicSelectors } from '@/store/chat/selectors';
+
import { useTopicsViewStore } from './store';
-import ToolbarActions from './ToolbarActions';
import type { GroupBy, SortBy, StatusFilter, TimeRangeFilter, TriggerFilter } from './types';
+const CONTROL_HEIGHT = 32;
+const THREE_MONTHS_MS = 90 * 24 * 60 * 60 * 1000;
+
const styles = createStaticStyles(({ css }) => ({
+ addPill: css`
+ cursor: pointer;
+ user-select: none;
+
+ display: inline-flex;
+ gap: 6px;
+ align-items: center;
+
+ height: ${CONTROL_HEIGHT}px;
+ padding-inline: 12px;
+ border: 1px dashed ${cssVar.colorBorder};
+ border-radius: ${CONTROL_HEIGHT / 2}px;
+
+ font-size: 13px;
+ color: ${cssVar.colorTextSecondary};
+
+ transition: all 0.15s;
+
+ &:hover {
+ border-color: ${cssVar.colorPrimary};
+ color: ${cssVar.colorText};
+ }
+ `,
+ chip: css`
+ display: inline-flex;
+ align-items: stretch;
+
+ height: ${CONTROL_HEIGHT}px;
+ border: 1px solid ${cssVar.colorBorderSecondary};
+ border-radius: ${CONTROL_HEIGHT / 2}px;
+
+ background: ${cssVar.colorFillTertiary};
+
+ transition: border-color 0.15s;
+
+ &:hover {
+ border-color: ${cssVar.colorBorder};
+ }
+ `,
+ chipClose: css`
+ all: unset;
+
+ cursor: pointer;
+
+ display: inline-flex;
+ align-items: center;
+
+ padding-inline: 8px 12px;
+ border-start-end-radius: ${CONTROL_HEIGHT / 2}px;
+ border-end-end-radius: ${CONTROL_HEIGHT / 2}px;
+
+ color: ${cssVar.colorTextTertiary};
+
+ &:hover {
+ color: ${cssVar.colorText};
+ background: ${cssVar.colorFillSecondary};
+ }
+ `,
+ chipMain: css`
+ cursor: pointer;
+
+ display: inline-flex;
+ gap: 6px;
+ align-items: center;
+
+ padding-block: 0;
+ padding-inline: 12px 6px;
+
+ font-size: 13px;
+ color: ${cssVar.colorText};
+ `,
+ chipValue: css`
+ font-weight: 500;
+ color: ${cssVar.colorText};
+ `,
divider: css`
width: 1px;
height: 16px;
margin-inline: 4px;
background: ${cssVar.colorBorderSecondary};
`,
+ sortPill: css`
+ cursor: pointer;
+ user-select: none;
+
+ display: inline-flex;
+ gap: 6px;
+ align-items: center;
+
+ height: ${CONTROL_HEIGHT}px;
+ padding-inline: 12px;
+ border-radius: ${CONTROL_HEIGHT / 2}px;
+
+ font-size: 13px;
+ color: ${cssVar.colorText};
+
+ background: ${cssVar.colorFillTertiary};
+
+ &:hover {
+ background: ${cssVar.colorFillSecondary};
+ }
+ `,
}));
const STATUS_OPTIONS: { key: StatusFilter; labelKey: string }[] = [
@@ -65,8 +167,46 @@ const CheckMark = ({ visible }: { visible: boolean }) => (
<span style={{ display: 'inline-block', width: 12 }}>{visible ? '✓' : ''}</span>
);
+interface FilterChipProps {
+ icon?: LucideIcon;
+ items: DropdownItem[];
+ label: string;
+ onClear: () => void;
+ value: ReactNode;
+}
+
+const FilterChip = memo<FilterChipProps>(({ icon, label, value, items, onClear }) => {
+ return (
+ <span className={styles.chip}>
+ <DropdownMenu items={items}>
+ <span className={styles.chipMain}>
+ {icon && <Icon icon={icon} size={12} />}
+ <Text style={{ color: cssVar.colorTextSecondary, fontSize: 12 }}>{label}:</Text>
+ <span className={styles.chipValue}>{value}</span>
+ <Icon icon={ChevronDown} size={10} />
+ </span>
+ </DropdownMenu>
+ <button
+ aria-label={`Clear ${label}`}
+ className={styles.chipClose}
+ type="button"
+ onClick={(e) => {
+ e.stopPropagation();
+ onClear();
+ }}
+ >
+ <Icon icon={X} size={12} />
+ </button>
+ </span>
+ );
+});
+
const Toolbar = memo<ToolbarProps>(({ projects, statusCounts }) => {
const { t } = useTranslation('topic');
+ const { message } = App.useApp();
+
+ const topics = useChatStore(topicSelectors.agentTopicsViewTopics);
+ const updateTopicStatus = useChatStore((s) => s.updateTopicStatus);
const status = useTopicsViewStore((s) => s.status);
const setStatus = useTopicsViewStore((s) => s.setStatus);
@@ -81,7 +221,20 @@ const Toolbar = memo<ToolbarProps>(({ projects, statusCounts }) => {
const groupBy = useTopicsViewStore((s) => s.groupBy);
const setGroupBy = useTopicsViewStore((s) => s.setGroupBy);
- const projectMenu: DropdownItem[] = useMemo(() => {
+ const triggerItems: DropdownItem[] = useMemo(
+ () =>
+ TRIGGER_OPTIONS.map((tr) => ({
+ extra: <CheckMark visible={triggers.includes(tr)} />,
+ icon: <Icon icon={TRIGGER_ICON[tr]} size={14} />,
+ key: tr,
+ label: t(`management.filters.trigger.${tr}` as any) as string,
+ onClick: () =>
+ setTriggers(triggers.includes(tr) ? triggers.filter((x) => x !== tr) : [...triggers, tr]),
+ })),
+ [triggers, t, setTriggers],
+ );
+
+ const projectItems: DropdownItem[] = useMemo(() => {
if (projects.length === 0) {
return [{ disabled: true, key: 'empty', label: t('management.filters.project.empty') }];
}
@@ -98,20 +251,7 @@ const Toolbar = memo<ToolbarProps>(({ projects, statusCounts }) => {
}));
}, [projects, groupIds, t, setGroupIds]);
- const triggerMenu: DropdownItem[] = useMemo(
- () =>
- TRIGGER_OPTIONS.map((tr) => ({
- extra: <CheckMark visible={triggers.includes(tr)} />,
- icon: <Icon icon={TRIGGER_ICON[tr]} size={14} />,
- key: tr,
- label: t(`management.filters.trigger.${tr}` as any) as string,
- onClick: () =>
- setTriggers(triggers.includes(tr) ? triggers.filter((x) => x !== tr) : [...triggers, tr]),
- })),
- [triggers, t, setTriggers],
- );
-
- const timeMenu: DropdownItem[] = useMemo(
+ const timeItems: DropdownItem[] = useMemo(
() =>
TIME_OPTIONS.map((r) => ({
icon: <CheckMark visible={timeRange === r} />,
@@ -122,7 +262,7 @@ const Toolbar = memo<ToolbarProps>(({ projects, statusCounts }) => {
[timeRange, t, setTimeRange],
);
- const sortMenu: DropdownItem[] = useMemo(
+ const sortItems: DropdownItem[] = useMemo(
() =>
SORT_OPTIONS.map((s) => ({
icon: <CheckMark visible={sortBy === s} />,
@@ -133,7 +273,7 @@ const Toolbar = memo<ToolbarProps>(({ projects, statusCounts }) => {
[sortBy, t, setSortBy],
);
- const groupMenu: DropdownItem[] = useMemo(
+ const groupItems: DropdownItem[] = useMemo(
() =>
GROUP_OPTIONS.map((g) => ({
icon: <CheckMark visible={groupBy === g} />,
@@ -144,104 +284,217 @@ const Toolbar = memo<ToolbarProps>(({ projects, statusCounts }) => {
[groupBy, t, setGroupBy],
);
- const triggerLabel =
- triggers.length === 0
- ? (t('management.filters.trigger.label') as string)
- : `${t('management.filters.trigger.label')} (${triggers.length})`;
-
- const projectLabel =
- groupIds.length === 0
- ? (t('management.filters.project.label') as string)
- : `${t('management.filters.project.label')} (${groupIds.length})`;
+ const triggerApplied = triggers.length > 0;
+ const projectApplied = groupIds.length > 0;
+ const timeApplied = timeRange !== 'all';
+ const anyFilterApplied = triggerApplied || projectApplied || timeApplied;
+
+ const addFilterItems: DropdownItem[] = useMemo(() => {
+ const items: DropdownItem[] = [];
+ if (!triggerApplied) {
+ items.push({
+ children: triggerItems,
+ icon: <Icon icon={ListFilter} size={14} />,
+ key: 'trigger',
+ label: t('management.filters.trigger.label'),
+ type: 'submenu',
+ });
+ }
+ if (!projectApplied) {
+ items.push({
+ children: projectItems,
+ icon: <Icon icon={FolderClosed} size={14} />,
+ key: 'project',
+ label: t('management.filters.project.label'),
+ type: 'submenu',
+ });
+ }
+ if (!timeApplied) {
+ items.push({
+ children: timeItems,
+ icon: <Icon icon={CalendarRange} size={14} />,
+ key: 'time',
+ label: t('management.filters.time.label'),
+ type: 'submenu',
+ });
+ }
+ return items;
+ }, [triggerApplied, projectApplied, timeApplied, triggerItems, projectItems, timeItems, t]);
- const timeLabel =
- timeRange === 'all'
- ? (t('management.filters.time.label') as string)
- : (t(`management.filters.time.${timeRange}` as any) as string);
+ const projectChipValue = useMemo(() => {
+ if (groupIds.length === 1) {
+ return projects.find((p) => p.value === groupIds[0])?.label ?? groupIds[0];
+ }
+ return `${groupIds.length} selected`;
+ }, [groupIds, projects]);
+
+ const triggerChipValue =
+ triggers.length === 1
+ ? (t(`management.filters.trigger.${triggers[0]}` as any) as string)
+ : `${triggers.length} selected`;
+
+ const handleArchiveStale = useCallback(() => {
+ const cutoff = Date.now() - THREE_MONTHS_MS;
+ const stale = (topics ?? []).filter((tp) => {
+ if (tp.status === 'completed') return false;
+ const updated =
+ typeof tp.updatedAt === 'number' ? tp.updatedAt : new Date(tp.updatedAt).getTime();
+ return updated < cutoff;
+ });
+
+ if (stale.length === 0) {
+ message.info(t('management.actionsMenu.archiveStale.noneFound'));
+ return;
+ }
- const sortLabel = `${t('management.sort.label')}: ${t(`management.sort.${sortBy}` as any)}`;
- const groupLabel = `${t('management.group.label')}: ${t(`management.group.${groupBy}` as any)}`;
+ confirmModal({
+ content: t('management.actionsMenu.archiveStale.confirm', { count: stale.length }),
+ okText: t('management.actionsMenu.archiveStale.confirmOk'),
+ onOk: async () => {
+ for (const topic of stale) {
+ await updateTopicStatus({ status: 'completed', topicId: topic.id });
+ }
+ message.success(t('management.actionsMenu.archiveStale.done', { count: stale.length }));
+ },
+ title: t('management.actionsMenu.archiveStale.title'),
+ });
+ }, [topics, updateTopicStatus, message, t]);
+
+ const overflowItems: DropdownItem[] = useMemo(() => {
+ const items: DropdownItem[] = [
+ {
+ children: groupItems,
+ key: 'group',
+ label: `${t('management.group.label')}: ${t(`management.group.${groupBy}` as any)}`,
+ type: 'submenu',
+ },
+ ];
+ if (anyFilterApplied) {
+ items.push(
+ { key: 'd1', type: 'divider' as const },
+ {
+ icon: <Icon icon={X} size={14} />,
+ key: 'clear',
+ label: t('management.filters.clearAll', { defaultValue: 'Clear all filters' }),
+ onClick: () => {
+ setTriggers([]);
+ setGroupIds([]);
+ setTimeRange('all');
+ },
+ },
+ );
+ }
+ items.push(
+ { key: 'd2', type: 'divider' as const },
+ {
+ icon: <Icon icon={Archive} size={14} />,
+ key: 'archive-stale',
+ label: t('management.actionsMenu.archiveStale.label'),
+ onClick: handleArchiveStale,
+ },
+ );
+ return items;
+ }, [
+ groupItems,
+ groupBy,
+ anyFilterApplied,
+ t,
+ setTriggers,
+ setGroupIds,
+ setTimeRange,
+ handleArchiveStale,
+ ]);
return (
- <Flexbox gap={12}>
- <Flexbox horizontal align={'center'} gap={6} wrap={'wrap'}>
- <Segmented
- value={status}
- options={STATUS_OPTIONS.map((opt) => {
- const count = statusCounts[opt.key] ?? 0;
- return {
- label: (
- <Flexbox horizontal align={'center'} gap={6}>
- <span>{t(opt.labelKey as any) as string}</span>
- <Text
- style={{
- color: status === opt.key ? 'inherit' : cssVar.colorTextTertiary,
- fontSize: 12,
- fontVariantNumeric: 'tabular-nums',
- opacity: status === opt.key ? 0.7 : 1,
- }}
- >
- {count}
- </Text>
- </Flexbox>
- ),
- value: opt.key,
- };
- })}
- onChange={(v) => setStatus(v as StatusFilter)}
+ <Flexbox horizontal align={'center'} gap={6} wrap={'wrap'}>
+ <Tabs
+ activeKey={status}
+ size={'small'}
+ style={{ width: 'auto' }}
+ items={STATUS_OPTIONS.map((opt) => {
+ const count = statusCounts[opt.key] ?? 0;
+ return {
+ key: opt.key,
+ label: (
+ <Flexbox horizontal align={'center'} gap={6}>
+ <span>{t(opt.labelKey as any) as string}</span>
+ <Text
+ style={{
+ color: status === opt.key ? 'inherit' : cssVar.colorTextTertiary,
+ fontSize: 12,
+ fontVariantNumeric: 'tabular-nums',
+ opacity: status === opt.key ? 0.7 : 1,
+ }}
+ >
+ {count}
+ </Text>
+ </Flexbox>
+ ),
+ };
+ })}
+ onChange={(key) => setStatus(key as StatusFilter)}
+ />
+
+ <span className={styles.divider} />
+
+ {triggerApplied && (
+ <FilterChip
+ icon={ListFilter}
+ items={triggerItems}
+ label={t('management.filters.trigger.label')}
+ value={triggerChipValue}
+ onClear={() => setTriggers([])}
/>
-
- <span className={styles.divider} />
-
- <DropdownMenu items={projectMenu}>
- <Button variant={'filled'}>
- <Flexbox horizontal align={'center'} gap={4}>
- {projectLabel}
- <Icon icon={ChevronDown} size={11} />
- </Flexbox>
- </Button>
- </DropdownMenu>
-
- <DropdownMenu items={triggerMenu}>
- <Button variant={'filled'}>
- <Flexbox horizontal align={'center'} gap={4}>
- {triggerLabel}
- <Icon icon={ChevronDown} size={11} />
- </Flexbox>
- </Button>
- </DropdownMenu>
-
- <DropdownMenu items={timeMenu}>
- <Button variant={'filled'}>
- <Flexbox horizontal align={'center'} gap={4}>
- {timeLabel}
- <Icon icon={ChevronDown} size={11} />
- </Flexbox>
- </Button>
- </DropdownMenu>
-
- <Flexbox flex={1} />
-
- <DropdownMenu items={groupMenu}>
- <Button variant={'filled'}>
- <Flexbox horizontal align={'center'} gap={4}>
- {groupLabel}
- <Icon icon={ChevronDown} size={11} />
- </Flexbox>
- </Button>
- </DropdownMenu>
-
- <DropdownMenu items={sortMenu}>
- <Button variant={'filled'}>
- <Flexbox horizontal align={'center'} gap={4}>
- {sortLabel}
- <Icon icon={ChevronDown} size={11} />
- </Flexbox>
- </Button>
+ )}
+ {projectApplied && (
+ <FilterChip
+ icon={FolderClosed}
+ items={projectItems}
+ label={t('management.filters.project.label')}
+ value={projectChipValue}
+ onClear={() => setGroupIds([])}
+ />
+ )}
+ {timeApplied && (
+ <FilterChip
+ icon={CalendarRange}
+ items={timeItems}
+ label={t('management.filters.time.label')}
+ value={t(`management.filters.time.${timeRange}` as any) as string}
+ onClear={() => setTimeRange('all')}
+ />
+ )}
+
+ {addFilterItems.length > 0 && (
+ <DropdownMenu items={addFilterItems}>
+ <span className={styles.addPill}>
+ <Icon icon={Plus} size={12} />
+ {t('management.filters.add', {
+ defaultValue: anyFilterApplied ? 'Add filter' : 'Filter',
+ })}
+ </span>
</DropdownMenu>
-
- <ToolbarActions />
- </Flexbox>
+ )}
+
+ <Flexbox flex={1} />
+
+ <DropdownMenu items={sortItems}>
+ <span className={styles.sortPill}>
+ <Text style={{ color: cssVar.colorTextSecondary, fontSize: 12 }}>
+ {t('management.sort.label')}:
+ </Text>
+ <span style={{ fontWeight: 500 }}>{t(`management.sort.${sortBy}` as any)}</span>
+ <Icon icon={ChevronDown} size={10} />
+ </span>
+ </DropdownMenu>
+
+ <DropdownMenu items={overflowItems} placement={'bottomRight'}>
+ <ActionIcon
+ icon={MoreHorizontal}
+ size={{ blockSize: CONTROL_HEIGHT, size: 18 }}
+ title={t('management.actionsMenu.title')}
+ />
+ </DropdownMenu>
</Flexbox>
);
});
diff --git a/src/features/ChatInput/ActionBar/Tools/SkillActivateMode.tsx b/src/features/ChatInput/ActionBar/Tools/SkillActivateMode.tsx
index f53bff38a07..3bde51e44fe 100644
--- a/src/features/ChatInput/ActionBar/Tools/SkillActivateMode.tsx
+++ b/src/features/ChatInput/ActionBar/Tools/SkillActivateMode.tsx
@@ -1,4 +1,5 @@
-import { Icon, Segmented, Tooltip } from '@lobehub/ui';
+import { Icon, Tooltip } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { SlidersHorizontal, Sparkles } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -18,29 +19,29 @@ const SkillActivateMode = memo(() => {
);
return (
- <Segmented
+ <Tabs
+ activeKey={currentMode}
size="small"
- value={currentMode}
- options={[
+ items={[
{
+ key: 'auto',
label: (
<Tooltip title={t('tools.skillActivateMode.auto.desc')}>
<Icon icon={Sparkles} />
</Tooltip>
),
- value: 'auto',
},
{
+ key: 'manual',
label: (
<Tooltip title={t('tools.skillActivateMode.manual.desc')}>
<Icon icon={SlidersHorizontal} />
</Tooltip>
),
- value: 'manual',
},
]}
- onChange={async (value) => {
- await updateAgentChatConfig({ skillActivateMode: value as 'auto' | 'manual' });
+ onChange={async (key) => {
+ await updateAgentChatConfig({ skillActivateMode: key as 'auto' | 'manual' });
}}
/>
);
diff --git a/src/features/CommunityWorkspaceSettings/index.tsx b/src/features/CommunityWorkspaceSettings/index.tsx
index 8eebc74775c..7e412a21534 100644
--- a/src/features/CommunityWorkspaceSettings/index.tsx
+++ b/src/features/CommunityWorkspaceSettings/index.tsx
@@ -9,12 +9,12 @@ import {
Flexbox,
Icon,
Input,
- Tabs,
Tag,
Text,
TextArea,
Tooltip,
} from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import type { TableColumnsType, UploadProps } from 'antd';
import { App, Input as AntInput, Table, Upload } from 'antd';
import { createStaticStyles, cssVar } from 'antd-style';
diff --git a/src/features/Connectors/ConnectorDetail/index.tsx b/src/features/Connectors/ConnectorDetail/index.tsx
index 7e84bcb6478..0fdcc0844be 100644
--- a/src/features/Connectors/ConnectorDetail/index.tsx
+++ b/src/features/Connectors/ConnectorDetail/index.tsx
@@ -111,18 +111,21 @@ const ConnectorDetail = memo<ConnectorDetailProps>(
};
return (
- <div style={{ display: 'flex', flexDirection: 'column', height: '100%', padding: 16 }}>
- {/* Header */}
+ <div style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>
+ {/* Header — full-bleed bar with bottom border, aligned with the left pane's header */}
<div
style={{
alignItems: 'center',
+ borderBlockEnd: '1px solid var(--ant-color-border-secondary)',
display: 'flex',
+ flexShrink: 0,
gap: 8,
+ height: 42,
justifyContent: 'space-between',
- marginBottom: 16,
+ paddingInline: 16,
}}
>
- <div style={{ fontSize: 16, fontWeight: 600 }}>{connectorName}</div>
+ <div style={{ fontSize: 14, fontWeight: 500 }}>{connectorName}</div>
<div style={{ display: 'flex', gap: 8 }}>
{/* Reset permissions: restore all tools to auto (fully open) */}
<Button size="small" onClick={() => resetConnectorPermissions(connectorId)}>
@@ -187,64 +190,75 @@ const ConnectorDetail = memo<ConnectorDetailProps>(
</div>
</div>
- {/* Description */}
- {connectorDescription && (
- <div
- style={{
- color: 'var(--ant-color-text-secondary)',
- fontSize: 13,
- lineHeight: 1.6,
- marginBottom: 16,
- }}
- >
- {connectorDescription}
- </div>
- )}
-
- {hasTools ? (
- <div style={{ flex: 1, overflowY: 'auto' }}>
- <ToolPermissionGroup
- label={t('connector.readOnlyTools', 'Read-only tools')}
- tools={readTools}
- onBatchPermission={handleBatchPermission}
- onPermissionChange={updateToolPermission}
- />
- <ToolPermissionGroup
- label={t('connector.createTools', 'Create tools')}
- tools={createTools}
- onBatchPermission={handleBatchPermission}
- onPermissionChange={updateToolPermission}
- />
- <ToolPermissionGroup
- label={t('connector.updateTools', 'Update tools')}
- tools={updateTools}
- onBatchPermission={handleBatchPermission}
- onPermissionChange={updateToolPermission}
- />
- <ToolPermissionGroup
- label={t('connector.deleteTools', 'Delete tools')}
- tools={deleteTools}
- onBatchPermission={handleBatchPermission}
- onPermissionChange={updateToolPermission}
+ {/* Body */}
+ <div
+ style={{
+ display: 'flex',
+ flex: 1,
+ flexDirection: 'column',
+ minHeight: 0,
+ padding: 16,
+ }}
+ >
+ {/* Description */}
+ {connectorDescription && (
+ <div
+ style={{
+ color: 'var(--ant-color-text-secondary)',
+ fontSize: 13,
+ lineHeight: 1.6,
+ marginBottom: 16,
+ }}
+ >
+ {connectorDescription}
+ </div>
+ )}
+
+ {hasTools ? (
+ <div style={{ flex: 1, overflowY: 'auto' }}>
+ <ToolPermissionGroup
+ label={t('connector.readOnlyTools', 'Read-only tools')}
+ tools={readTools}
+ onBatchPermission={handleBatchPermission}
+ onPermissionChange={updateToolPermission}
+ />
+ <ToolPermissionGroup
+ label={t('connector.createTools', 'Create tools')}
+ tools={createTools}
+ onBatchPermission={handleBatchPermission}
+ onPermissionChange={updateToolPermission}
+ />
+ <ToolPermissionGroup
+ label={t('connector.updateTools', 'Update tools')}
+ tools={updateTools}
+ onBatchPermission={handleBatchPermission}
+ onPermissionChange={updateToolPermission}
+ />
+ <ToolPermissionGroup
+ label={t('connector.deleteTools', 'Delete tools')}
+ tools={deleteTools}
+ onBatchPermission={handleBatchPermission}
+ onPermissionChange={updateToolPermission}
+ />
+ </div>
+ ) : (
+ <div style={{ color: 'var(--lobe-colors-neutral-500)', fontSize: 14 }}>
+ {t('connector.noTools', 'No tool permissions to configure.')}
+ </div>
+ )}
+
+ {/* Edit modal — only http connectors have a server URL to edit */}
+ {isMcpConnector && connector?.mcpConnectionType === 'http' && (
+ <CustomConnectorModal
+ connectorId={connectorId}
+ open={customModalOpen}
+ onClose={() => setCustomModalOpen(false)}
+ onEditSuccess={() => {
+ fetchConnectors();
+ }}
/>
- </div>
- ) : (
- <div style={{ color: 'var(--lobe-colors-neutral-500)', fontSize: 14 }}>
- {t('connector.noTools', 'No tool permissions to configure.')}
- </div>
- )}
-
- {/* Edit modal — only http connectors have a server URL to edit */}
- {isMcpConnector && connector?.mcpConnectionType === 'http' && (
- <CustomConnectorModal
- connectorId={connectorId}
- open={customModalOpen}
- onClose={() => setCustomModalOpen(false)}
- onEditSuccess={() => {
- fetchConnectors();
- }}
- />
- )}
+ )}
+ </div>
</div>
);
},
diff --git a/src/features/Conversation/Messages/AgentCouncil/index.tsx b/src/features/Conversation/Messages/AgentCouncil/index.tsx
index 29c69200377..31df2220ab6 100644
--- a/src/features/Conversation/Messages/AgentCouncil/index.tsx
+++ b/src/features/Conversation/Messages/AgentCouncil/index.tsx
@@ -2,7 +2,7 @@
import { type UIChatMessage } from '@lobechat/types';
import { Flexbox, Icon } from '@lobehub/ui';
-import { Segmented } from 'antd';
+import { Tabs } from '@lobehub/ui/base-ui';
import isEqual from 'fast-deep-equal';
import { BotIcon, Columns2, Layers } from 'lucide-react';
import { memo, useState } from 'react';
@@ -41,28 +41,27 @@ const AgentCouncilMessage = memo<AgentCouncilMessageProps>(({ id }) => {
paddingBlock={8}
>
{displayMode === 'tab' ? (
- <Segmented
- size={'small'}
- value={activeTab}
- options={members.map((_, idx) => {
- return {
- icon: <Icon icon={BotIcon} size={14} />,
- value: idx,
- };
- })}
- onChange={(value) => setActiveTab(Number(value))}
+ <Tabs
+ activeKey={String(activeTab)}
+ size="small"
+ items={members.map((_, idx) => ({
+ icon: <Icon icon={BotIcon} size={14} />,
+ key: String(idx),
+ label: null,
+ }))}
+ onChange={(key) => setActiveTab(Number(key))}
/>
) : (
<div />
)}
- <Segmented
+ <Tabs
+ activeKey={displayMode}
size="small"
- value={displayMode}
- options={[
- { icon: <Icon icon={Columns2} />, value: 'horizontal' },
- { icon: <Icon icon={Layers} />, value: 'tab' },
+ items={[
+ { icon: <Icon icon={Columns2} />, key: 'horizontal', label: null },
+ { icon: <Icon icon={Layers} />, key: 'tab', label: null },
]}
- onChange={(value) => setDisplayMode(value as DisplayMode)}
+ onChange={(key) => setDisplayMode(key as DisplayMode)}
/>
</Flexbox>
</WideScreenContainer>
diff --git a/src/features/Conversation/Messages/CompressedGroup/index.tsx b/src/features/Conversation/Messages/CompressedGroup/index.tsx
index 749902c36a4..ea1a615149c 100644
--- a/src/features/Conversation/Messages/CompressedGroup/index.tsx
+++ b/src/features/Conversation/Messages/CompressedGroup/index.tsx
@@ -1,16 +1,8 @@
'use client';
import type { CompressionGroupMetadata, UIChatMessage } from '@lobechat/types';
-import {
- ActionIcon,
- Flexbox,
- Icon,
- Markdown,
- ScrollShadow,
- Tabs,
- type TabsProps,
-} from '@lobehub/ui';
-import { confirmModal } from '@lobehub/ui/base-ui';
+import { ActionIcon, Flexbox, Icon, Markdown, ScrollShadow } from '@lobehub/ui';
+import { confirmModal, Tabs, type TabsItem } from '@lobehub/ui/base-ui';
import { createStaticStyles, cx } from 'antd-style';
import isEqual from 'fast-deep-equal';
import { ChevronDown, ChevronUp, History, Sparkles, Undo2 } from 'lucide-react';
@@ -120,7 +112,7 @@ const CompressedGroupMessage = memo<CompressedGroupMessageProps>(({ id }) => {
isGeneratingSummary,
});
- const tabItems: TabsProps['items'] = useMemo(
+ const tabItems: TabsItem[] = useMemo(
() => [
{
icon: <Icon icon={Sparkles} size={14} />,
@@ -151,7 +143,6 @@ const CompressedGroupMessage = memo<CompressedGroupMessageProps>(({ id }) => {
) : (
<Flexbox horizontal align={'center'} distribution={'space-between'} width={'100%'}>
<Tabs
- compact
activeKey={isGeneratingSummary ? 'summary' : activeTab}
className={styles.header}
items={tabItems}
diff --git a/src/features/Conversation/Messages/components/Extras/Usage/UsageDetail/ModelCard.tsx b/src/features/Conversation/Messages/components/Extras/Usage/UsageDetail/ModelCard.tsx
index 50094d77c0d..82127ad40fd 100644
--- a/src/features/Conversation/Messages/components/Extras/Usage/UsageDetail/ModelCard.tsx
+++ b/src/features/Conversation/Messages/components/Extras/Usage/UsageDetail/ModelCard.tsx
@@ -1,6 +1,7 @@
import { getCachedTextInputUnitRate, getWriteCacheInputUnitRate } from '@lobechat/utils';
import { ModelIcon } from '@lobehub/icons';
-import { Flexbox, Icon, Segmented, Tooltip } from '@lobehub/ui';
+import { Flexbox, Icon, Tooltip } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { ArrowDownToDot, ArrowUpFromDot, BookUp2Icon, CircleFadingArrowUp } from 'lucide-react';
import { type LobeDefaultAiModelListItem } from 'model-bank';
@@ -61,22 +62,22 @@ const ModelCard = memo<ModelCardProps>(({ pricing, id, provider, displayName })
</Flexbox>
{!!pricing && (
<Flexbox>
- <Segmented
+ <Tabs
+ activeKey={isShowCredit ? 'credit' : 'token'}
size={'small'}
- value={isShowCredit ? 'credit' : 'token'}
- options={[
- { label: 'Token', value: 'token' },
+ items={[
+ { key: 'token', label: 'Token' },
{
+ key: 'credit',
label: (
<Tooltip title={t('messages.modelCard.creditTooltip')}>
<span>{t('messages.modelCard.credit')}</span>
</Tooltip>
),
- value: 'credit',
},
]}
- onChange={(value) => {
- updateSystemStatus({ isShowCredit: value === 'credit' });
+ onChange={(key) => {
+ updateSystemStatus({ isShowCredit: key === 'credit' });
}}
/>
</Flexbox>
diff --git a/src/features/Conversation/components/ShareMessageModal/ShareImage/index.tsx b/src/features/Conversation/components/ShareMessageModal/ShareImage/index.tsx
index cd209ec013e..00a21ae1898 100644
--- a/src/features/Conversation/components/ShareMessageModal/ShareImage/index.tsx
+++ b/src/features/Conversation/components/ShareMessageModal/ShareImage/index.tsx
@@ -1,6 +1,7 @@
import { type UIChatMessage } from '@lobechat/types';
import { type FormItemProps } from '@lobehub/ui';
-import { Button, Flexbox, Form, Segmented } from '@lobehub/ui';
+import { Button, Flexbox, Form } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { Switch } from 'antd';
import { CopyIcon } from 'lucide-react';
import { memo, useState } from 'react';
@@ -36,8 +37,8 @@ const ShareImage = memo<{ message: UIChatMessage; mobile?: boolean; uniqueId?: s
const { t } = useTranslation(['chat', 'common']);
const widthModeOptions = [
- { label: t('shareModal.widthMode.wide'), value: WidthMode.Wide },
- { label: t('shareModal.widthMode.narrow'), value: WidthMode.Narrow },
+ { key: WidthMode.Wide, label: t('shareModal.widthMode.wide') },
+ { key: WidthMode.Narrow, label: t('shareModal.widthMode.narrow') },
];
// Generate a unique preview ID to avoid DOM conflicts
@@ -51,11 +52,12 @@ const ShareImage = memo<{ message: UIChatMessage; mobile?: boolean; uniqueId?: s
const { loading: copyLoading, onCopy } = useImgToClipboard({ id: `#${previewId}` });
const settings: FormItemProps[] = [
{
- children: <Segmented options={widthModeOptions} />,
+ children: <Tabs items={widthModeOptions} />,
label: t('shareModal.widthMode.label'),
layout: 'horizontal',
minWidth: undefined,
name: 'widthMode',
+ valuePropName: 'activeKey',
},
{
children: <Switch />,
@@ -74,11 +76,12 @@ const ShareImage = memo<{ message: UIChatMessage; mobile?: boolean; uniqueId?: s
valuePropName: 'checked',
},
{
- children: <Segmented options={imageTypeOptions} />,
+ children: <Tabs items={imageTypeOptions} />,
label: t('shareModal.imageType'),
layout: 'horizontal',
minWidth: undefined,
name: 'imageType',
+ valuePropName: 'activeKey',
},
];
diff --git a/src/features/Conversation/components/ShareMessageModal/index.tsx b/src/features/Conversation/components/ShareMessageModal/index.tsx
index 840cc32f69d..00c11308b5a 100644
--- a/src/features/Conversation/components/ShareMessageModal/index.tsx
+++ b/src/features/Conversation/components/ShareMessageModal/index.tsx
@@ -1,5 +1,6 @@
import { type UIChatMessage } from '@lobechat/types';
-import { Flexbox, Modal, Segmented, Tabs } from '@lobehub/ui';
+import { Flexbox, Modal } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { memo, useId, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -68,24 +69,13 @@ const ShareModal = memo<ShareModalProps>(({ onCancel, open, message }) => {
onCancel={onCancel}
>
<Flexbox gap={isMobile ? 8 : 24}>
- <Segmented
- block
- style={{ width: '100%' }}
- value={tab}
- variant={'filled'}
- options={tabItems.map((item) => {
- return {
- label: item?.label,
- value: item?.key,
- };
- })}
- onChange={(value) => setTab(value as Tab)}
- />
<Tabs
activeKey={tab}
- indicator={{ align: 'center', size: (origin) => origin - 20 }}
items={tabItems}
- renderTabBar={() => <></>}
+ styles={{
+ list: { display: 'flex', width: '100%' },
+ tab: { flex: 1 },
+ }}
onChange={(key) => setTab(key as Tab)}
/>
</Flexbox>
diff --git a/src/features/DevFeatureFlagPanel/FlagRow.tsx b/src/features/DevFeatureFlagPanel/FlagRow.tsx
index eda59199432..5f5e3c4aed8 100644
--- a/src/features/DevFeatureFlagPanel/FlagRow.tsx
+++ b/src/features/DevFeatureFlagPanel/FlagRow.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Flexbox, Segmented, Text } from '@lobehub/ui';
+import { Flexbox, Text } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
import { snakeCase } from 'es-toolkit/compat';
import { memo, useMemo } from 'react';
@@ -52,9 +53,9 @@ const styles = createStaticStyles(({ css }) => ({
}));
const segmentOptions = [
- { label: 'true', value: 'true' as const },
- { label: 'false', value: 'false' as const },
- { label: 'inherit', value: 'inherit' as const },
+ { key: 'true' as const, label: 'true' },
+ { key: 'false' as const, label: 'false' },
+ { key: 'inherit' as const, label: 'inherit' },
];
interface FlagRowProps {
@@ -92,11 +93,11 @@ const FlagRow = memo<FlagRowProps>(({ flagKey }) => {
</Text>
<span className={styles.meta}>server: {String(original)}</span>
</Flexbox>
- <Segmented
- options={segmentOptions}
+ <Tabs
+ activeKey={value}
+ items={segmentOptions}
size={'small'}
- value={value}
- onChange={(v) => handleChange(v as SegmentedValue)}
+ onChange={(key) => handleChange(key as SegmentedValue)}
/>
</div>
);
diff --git a/src/features/DevPanel/MetadataViewer/index.tsx b/src/features/DevPanel/MetadataViewer/index.tsx
index 20b59684e3e..7b8a2c460fd 100644
--- a/src/features/DevPanel/MetadataViewer/index.tsx
+++ b/src/features/DevPanel/MetadataViewer/index.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Flexbox, Tabs } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { memo, useState } from 'react';
@@ -41,7 +42,6 @@ const MetadataViewer = memo(() => {
style={{ paddingInlineStart: 0 }}
title={
<Tabs
- compact
activeKey={active}
style={{ margin: 16 }}
items={[
diff --git a/src/features/DevPanel/RenderGallery/ToolPage.tsx b/src/features/DevPanel/RenderGallery/ToolPage.tsx
index 504f27f2f04..3d66b594700 100644
--- a/src/features/DevPanel/RenderGallery/ToolPage.tsx
+++ b/src/features/DevPanel/RenderGallery/ToolPage.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Flexbox, Segmented, Tag, Text } from '@lobehub/ui';
+import { Flexbox, Tag, Text } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { useEffect, useRef, useState } from 'react';
import { useParams } from 'react-router';
@@ -208,28 +209,28 @@ const DevtoolsToolPage = () => {
<Text fontSize={12} type={'secondary'} weight={600}>
View
</Text>
- <Segmented
+ <Tabs
+ activeKey={view}
size={'small'}
- value={view}
- options={[
- { label: 'By API', value: 'api' },
- { label: 'Aggregate', value: 'aggregate' },
+ items={[
+ { key: 'api', label: 'By API' },
+ { key: 'aggregate', label: 'Aggregate' },
]}
- onChange={(value) => setView(value as GalleryView)}
+ onChange={(key) => setView(key as GalleryView)}
/>
</Flexbox>
<Flexbox horizontal className={styles.controlGroup}>
<Text fontSize={12} type={'secondary'} weight={600}>
Lifecycle
</Text>
- <Segmented
+ <Tabs
+ activeKey={mode}
size={'small'}
- value={mode}
- options={LIFECYCLE_MODES.map((value) => ({
+ items={LIFECYCLE_MODES.map((value) => ({
+ key: value,
label: LIFECYCLE_MODE_LABEL[value],
- value,
}))}
- onChange={(value) => setMode(value as LifecycleMode)}
+ onChange={(key) => setMode(key as LifecycleMode)}
/>
</Flexbox>
</Flexbox>
diff --git a/src/features/DevPanel/RenderGallery/ToolPreview.tsx b/src/features/DevPanel/RenderGallery/ToolPreview.tsx
index ea488b31270..e649601f29b 100644
--- a/src/features/DevPanel/RenderGallery/ToolPreview.tsx
+++ b/src/features/DevPanel/RenderGallery/ToolPreview.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Flexbox, Segmented, Tag, Text } from '@lobehub/ui';
+import { Flexbox, Tag, Text } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { useMemo, useState } from 'react';
@@ -97,14 +98,14 @@ const ToolPreview = ({ api, mode }: ToolPreviewProps) => {
</Text>
<Tag>{api.identifier}</Tag>
{variants.length > 1 && (
- <Segmented
+ <Tabs
+ activeKey={activeVariant.id}
size={'small'}
- value={activeVariant.id}
- options={variants.map((variant) => ({
+ items={variants.map((variant) => ({
+ key: variant.id,
label: variant.label,
- value: variant.id,
}))}
- onChange={(value) => setActiveVariantId(value as string)}
+ onChange={(key) => setActiveVariantId(key)}
/>
)}
</Flexbox>
diff --git a/src/features/DevPanel/SystemInspector/index.tsx b/src/features/DevPanel/SystemInspector/index.tsx
index 3e42b9bd8b5..896ece1da7f 100644
--- a/src/features/DevPanel/SystemInspector/index.tsx
+++ b/src/features/DevPanel/SystemInspector/index.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Flexbox, Tabs } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { useState } from 'react';
import AiProviderRuntimeConfig from './AiProviderRuntimeConfig';
@@ -20,7 +21,6 @@ const SystemInspector = () => {
return (
<Flexbox gap={4} height={'100%'}>
<Tabs
- compact
activeKey={activeTab}
items={[
{
diff --git a/src/features/DeviceManager/DeviceConnectModal.tsx b/src/features/DeviceManager/DeviceConnectModal.tsx
index 9ef8a97ca34..9287344bdd1 100644
--- a/src/features/DeviceManager/DeviceConnectModal.tsx
+++ b/src/features/DeviceManager/DeviceConnectModal.tsx
@@ -2,7 +2,8 @@
import { DOWNLOAD_URL } from '@lobechat/const';
import type { DeviceScope } from '@lobechat/types';
-import { Button, CopyButton, Flexbox, Icon, Modal, Segmented, Text } from '@lobehub/ui';
+import { Button, CopyButton, Flexbox, Icon, Modal, Text } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
import { DownloadIcon, MonitorDownIcon, ShieldCheckIcon, TerminalIcon } from 'lucide-react';
import { memo, useEffect, useState } from 'react';
@@ -176,22 +177,25 @@ const DeviceConnectModal = memo<DeviceConnectModalProps>(({ onClose, open, initi
)}
{isWorkspace ? null : (
- <Segmented
- block
- value={active}
- options={[
+ <Tabs
+ activeKey={active}
+ items={[
{
icon: <Icon icon={MonitorDownIcon} />,
+ key: 'desktop',
label: t('devices.connectWizard.method.desktop'),
- value: 'desktop',
},
{
icon: <Icon icon={TerminalIcon} />,
+ key: 'cli',
label: t('devices.connectWizard.method.cli'),
- value: 'cli',
},
]}
- onChange={(value) => setActive(value as 'cli' | 'desktop')}
+ styles={{
+ list: { display: 'flex', width: '100%' },
+ tab: { flex: 1 },
+ }}
+ onChange={(key) => setActive(key as 'cli' | 'desktop')}
/>
)}
diff --git a/src/features/HotkeyHelperPanel/index.tsx b/src/features/HotkeyHelperPanel/index.tsx
index 35741bd7346..3f5cf51a9b4 100644
--- a/src/features/HotkeyHelperPanel/index.tsx
+++ b/src/features/HotkeyHelperPanel/index.tsx
@@ -1,7 +1,8 @@
'use client';
import { HotkeyGroupEnum } from '@lobechat/const/hotkeys';
-import { Grid, Icon, Modal, Segmented } from '@lobehub/ui';
+import { Grid, Icon, Modal } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { MessageSquare, Settings2 } from 'lucide-react';
import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -34,19 +35,18 @@ const HotkeyHelperPanel = memo(() => {
},
}}
title={
- <Segmented
- value={active}
- variant="filled"
- options={[
+ <Tabs
+ activeKey={active}
+ items={[
{
icon: <Icon icon={Settings2} />,
+ key: HotkeyGroupEnum.Essential,
label: t('hotkey.group.essential'),
- value: HotkeyGroupEnum.Essential,
},
{
icon: <Icon icon={MessageSquare} />,
+ key: HotkeyGroupEnum.Conversation,
label: t('hotkey.group.conversation'),
- value: HotkeyGroupEnum.Conversation,
},
]}
onChange={(key) => setActive(key as HotkeyGroupId)}
diff --git a/src/features/MCPPluginDetail/Nav.tsx b/src/features/MCPPluginDetail/Nav.tsx
index 877a32b64e9..bd70c3361d2 100644
--- a/src/features/MCPPluginDetail/Nav.tsx
+++ b/src/features/MCPPluginDetail/Nav.tsx
@@ -1,8 +1,8 @@
'use client';
import { SOCIAL_URL } from '@lobechat/business-const';
-import { type TabsProps } from '@lobehub/ui';
-import { Flexbox, Icon, Tabs, Tag } from '@lobehub/ui';
+import { Flexbox, Icon, Tag } from '@lobehub/ui';
+import { Tabs, type TabsItem } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import {
BookOpenIcon,
@@ -80,7 +80,7 @@ const Nav = memo<NavProps>(
<Tabs
activeKey={activeTab}
className={styles.tabs}
- compact={mobile}
+ variant="square"
items={
[
// Only show the settings tab for installed plugins
@@ -170,7 +170,7 @@ const Nav = memo<NavProps>(
t('mcp.details.versions.title')
),
},
- ].filter(Boolean) as TabsProps['items']
+ ].filter(Boolean) as TabsItem[]
}
onChange={(key) => setActiveTab?.(key as McpNavKey)}
/>
@@ -182,7 +182,12 @@ const Nav = memo<NavProps>(
<Flexbox horizontal align={'center'} className={styles.nav} justify={'space-between'}>
{nav}
{!inModal && (
- <Flexbox horizontal gap={12}>
+ <Flexbox
+ horizontal
+ flex="none"
+ gap={12}
+ style={{ marginInlineStart: 12, whiteSpace: 'nowrap' }}
+ >
<a className={styles.link} href={SOCIAL_URL.discord} rel="noreferrer" target="_blank">
{t('mcp.details.nav.needHelp')}
</a>
diff --git a/src/features/MCPPluginDetail/Schema/Block.tsx b/src/features/MCPPluginDetail/Schema/Block.tsx
index ecac5e9b06b..6050d3926d4 100644
--- a/src/features/MCPPluginDetail/Schema/Block.tsx
+++ b/src/features/MCPPluginDetail/Schema/Block.tsx
@@ -1,4 +1,5 @@
-import { Flexbox, Segmented, Tag } from '@lobehub/ui';
+import { Flexbox, Tag } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { type ReactNode } from 'react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -25,21 +26,19 @@ const Block = memo<BlockProps>(({ title, count, desc, children, mode, setMode, i
<Title id={id} tag={<Tag>{count}</Tag>}>
{title}
</Title>
- <Segmented
- shape={'round'}
- value={mode}
- variant={'outlined'}
- options={[
+ <Tabs
+ activeKey={mode}
+ items={[
{
+ key: ModeType.Docs,
label: t('mcp.details.schema.mode.docs'),
- value: ModeType.Docs,
},
{
+ key: ModeType.JSON,
label: 'JSON',
- value: ModeType.JSON,
},
]}
- onChange={(v) => setMode?.(v as ModeType)}
+ onChange={(key) => setMode?.(key as ModeType)}
/>
</Flexbox>
<p style={{ marginBottom: 24 }}>{desc}</p>
diff --git a/src/features/ModelSwitchPanel/components/Toolbar.tsx b/src/features/ModelSwitchPanel/components/Toolbar.tsx
index 03cdd765f7d..ba314753e9e 100644
--- a/src/features/ModelSwitchPanel/components/Toolbar.tsx
+++ b/src/features/ModelSwitchPanel/components/Toolbar.tsx
@@ -1,4 +1,5 @@
-import { Flexbox, Icon, SearchBar, Segmented, stopPropagation } from '@lobehub/ui';
+import { Flexbox, Icon, SearchBar, stopPropagation, Tooltip } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { ProviderIcon } from '@lobehub/ui/icons';
import { Brain } from 'lucide-react';
import { memo } from 'react';
@@ -39,22 +40,28 @@ export const Toolbar = memo<ToolbarProps>(
onKeyDown={stopPropagation}
/>
{showGroupModeSwitch && (
- <Segmented
+ <Tabs
+ activeKey={groupMode}
size="small"
- value={groupMode}
- options={[
+ items={[
{
- icon: <Icon icon={Brain} />,
- title: t('ModelSwitchPanel.byModel'),
- value: 'byModel',
+ key: 'byModel',
+ label: (
+ <Tooltip title={t('ModelSwitchPanel.byModel')}>
+ <Icon icon={Brain} />
+ </Tooltip>
+ ),
},
{
- icon: <Icon icon={ProviderIcon} />,
- title: t('ModelSwitchPanel.byProvider'),
- value: 'byProvider',
+ key: 'byProvider',
+ label: (
+ <Tooltip title={t('ModelSwitchPanel.byProvider')}>
+ <Icon icon={ProviderIcon} />
+ </Tooltip>
+ ),
},
]}
- onChange={(value) => onGroupModeChange?.(value as GroupMode)}
+ onChange={(key) => onGroupModeChange?.(key as GroupMode)}
/>
)}
</Flexbox>
diff --git a/src/features/Onboarding/components/ModeSwitch.test.tsx b/src/features/Onboarding/components/ModeSwitch.test.tsx
index 14a32968789..470239661a2 100644
--- a/src/features/Onboarding/components/ModeSwitch.test.tsx
+++ b/src/features/Onboarding/components/ModeSwitch.test.tsx
@@ -119,8 +119,14 @@ describe('ModeSwitch', () => {
renderModeSwitch({ enabled: true, showLabel: true });
expect(screen.getByText('Choose a setup method')).toBeInTheDocument();
- expect(screen.getByRole('radio', { name: 'Conversational setup' })).toBeChecked();
- expect(screen.getByRole('radio', { name: 'Manual setup' })).not.toBeChecked();
+ expect(screen.getByRole('tab', { name: 'Conversational setup' })).toHaveAttribute(
+ 'aria-selected',
+ 'true',
+ );
+ expect(screen.getByRole('tab', { name: 'Manual setup' })).toHaveAttribute(
+ 'aria-selected',
+ 'false',
+ );
},
TEST_TIMEOUT_MS,
);
@@ -130,8 +136,8 @@ describe('ModeSwitch', () => {
() => {
renderModeSwitch({ enabled: false });
- expect(screen.queryByRole('radio', { name: 'Conversational setup' })).not.toBeInTheDocument();
- expect(screen.queryByRole('radio', { name: 'Manual setup' })).not.toBeInTheDocument();
+ expect(screen.queryByRole('tab', { name: 'Conversational setup' })).not.toBeInTheDocument();
+ expect(screen.queryByRole('tab', { name: 'Manual setup' })).not.toBeInTheDocument();
expect(screen.queryByText('Choose a setup method')).not.toBeInTheDocument();
},
TEST_TIMEOUT_MS,
@@ -140,8 +146,8 @@ describe('ModeSwitch', () => {
it('hides the onboarding switch until server config is initialized', () => {
renderModeSwitch({ enabled: true, serverConfigInit: false });
- expect(screen.queryByRole('radio', { name: 'Conversational setup' })).not.toBeInTheDocument();
- expect(screen.queryByRole('radio', { name: 'Manual setup' })).not.toBeInTheDocument();
+ expect(screen.queryByRole('tab', { name: 'Conversational setup' })).not.toBeInTheDocument();
+ expect(screen.queryByRole('tab', { name: 'Manual setup' })).not.toBeInTheDocument();
});
it('keeps action buttons visible when agent onboarding is disabled', () => {
@@ -151,21 +157,21 @@ describe('ModeSwitch', () => {
});
expect(screen.getByRole('button', { name: 'Restart' })).toBeInTheDocument();
- expect(screen.queryByRole('radio', { name: 'Conversational setup' })).not.toBeInTheDocument();
- expect(screen.queryByRole('radio', { name: 'Manual setup' })).not.toBeInTheDocument();
+ expect(screen.queryByRole('tab', { name: 'Conversational setup' })).not.toBeInTheDocument();
+ expect(screen.queryByRole('tab', { name: 'Manual setup' })).not.toBeInTheDocument();
});
it('does not render the switch on desktop builds', () => {
renderModeSwitch({ desktop: true, enabled: true });
- expect(screen.queryByRole('radio', { name: 'Conversational setup' })).not.toBeInTheDocument();
- expect(screen.queryByRole('radio', { name: 'Manual setup' })).not.toBeInTheDocument();
+ expect(screen.queryByRole('tab', { name: 'Conversational setup' })).not.toBeInTheDocument();
+ expect(screen.queryByRole('tab', { name: 'Manual setup' })).not.toBeInTheDocument();
});
it('hides the switch when AGENT_ONBOARDING_ENABLED master switch is off', () => {
renderModeSwitch({ AGENT_ONBOARDING_ENABLED: false, enabled: true });
- expect(screen.queryByRole('radio', { name: 'Conversational setup' })).not.toBeInTheDocument();
- expect(screen.queryByRole('radio', { name: 'Manual setup' })).not.toBeInTheDocument();
+ expect(screen.queryByRole('tab', { name: 'Conversational setup' })).not.toBeInTheDocument();
+ expect(screen.queryByRole('tab', { name: 'Manual setup' })).not.toBeInTheDocument();
});
});
diff --git a/src/features/Onboarding/components/ModeSwitch.tsx b/src/features/Onboarding/components/ModeSwitch.tsx
index a59790128b6..1ba5196c755 100644
--- a/src/features/Onboarding/components/ModeSwitch.tsx
+++ b/src/features/Onboarding/components/ModeSwitch.tsx
@@ -2,7 +2,8 @@
import { AGENT_ONBOARDING_ENABLED } from '@lobechat/business-const';
import { isDesktop } from '@lobechat/const';
-import { ActionIcon, Flexbox, Segmented, Text } from '@lobehub/ui';
+import { ActionIcon, Flexbox, Text } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { createStaticStyles, cx } from 'antd-style';
import { ChevronLeft, ChevronRight } from 'lucide-react';
import type { CSSProperties, ReactNode } from 'react';
@@ -91,19 +92,19 @@ const ModeSwitch = memo<ModeSwitchProps>(({ actions, className, showLabel = fals
}
return [
- { label: t('agent.modeSwitch.agent'), value: 'agent' as const },
- { label: t('agent.modeSwitch.classic'), value: 'classic' as const },
+ { key: 'agent', label: t('agent.modeSwitch.agent') },
+ { key: 'classic', label: t('agent.modeSwitch.classic') },
];
}, [enableAgentOnboarding, serverConfigInit, t]);
const segmented =
options.length > 0 ? (
- <Segmented
- options={options}
+ <Tabs
+ activeKey={mode}
+ items={options}
size={'small'}
- value={mode}
- onChange={(value) => {
- navigate(value === 'agent' ? '/onboarding/agent' : '/onboarding/classic');
+ onChange={(key) => {
+ navigate(key === 'agent' ? '/onboarding/agent' : '/onboarding/classic');
}}
/>
) : null;
diff --git a/src/features/PluginDetailModal/index.tsx b/src/features/PluginDetailModal/index.tsx
index 483c091181e..6901caf18e0 100644
--- a/src/features/PluginDetailModal/index.tsx
+++ b/src/features/PluginDetailModal/index.tsx
@@ -1,5 +1,5 @@
-import { type SegmentedProps } from '@lobehub/ui';
-import { Modal, Segmented } from '@lobehub/ui';
+import { Modal } from '@lobehub/ui';
+import { Tabs, type TabsItem } from '@lobehub/ui/base-ui';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import useMergeState from 'use-merge-value';
@@ -48,25 +48,28 @@ const PluginDetailModal = memo<PluginDetailModalProps>(
}}
>
<Meta id={id} />
- <Segmented
- block
- value={tabKey}
- options={
+ <Tabs
+ activeKey={tabKey}
+ items={
[
{
+ key: Tab.Info,
label: t('detailModal.tabs.info'),
- value: Tab.Info,
},
hasSettings && {
+ key: Tab.Settings,
label: t('detailModal.tabs.settings'),
- value: Tab.Settings,
},
- ].filter(Boolean) as SegmentedProps['options']
+ ].filter(Boolean) as TabsItem[]
}
style={{
marginBlock: 16,
}}
- onChange={(v) => setTabKey(v as Tab)}
+ styles={{
+ list: { display: 'flex', width: '100%' },
+ tab: { flex: 1 },
+ }}
+ onChange={(key) => setTabKey(key as Tab)}
/>
{tabKey === 'settings' ? (
hasSettings && <PluginSettingsConfig id={id} schema={schema} />
diff --git a/src/features/Portal/Artifacts/Title.tsx b/src/features/Portal/Artifacts/Title.tsx
index c334dc7bf8d..2456f84e3bf 100644
--- a/src/features/Portal/Artifacts/Title.tsx
+++ b/src/features/Portal/Artifacts/Title.tsx
@@ -1,5 +1,6 @@
import { ArtifactType } from '@lobechat/types';
-import { ActionIcon, Flexbox, Icon, Segmented, Text } from '@lobehub/ui';
+import { ActionIcon, Flexbox, Icon, Text } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { ConfigProvider } from 'antd';
import { cx } from 'antd-style';
import { ArrowLeft, CodeIcon, EyeIcon } from 'lucide-react';
@@ -48,23 +49,23 @@ const Title = () => {
}}
>
{showSwitch && (
- <Segmented
+ <Tabs
+ activeKey={displayMode}
size={'small'}
- value={displayMode}
- options={[
+ items={[
{
icon: <Icon icon={EyeIcon} />,
+ key: ArtifactDisplayMode.Preview,
label: t('artifacts.display.preview'),
- value: ArtifactDisplayMode.Preview,
},
{
icon: <Icon icon={CodeIcon} />,
+ key: ArtifactDisplayMode.Code,
label: t('artifacts.display.code'),
- value: ArtifactDisplayMode.Code,
},
]}
- onChange={(value) => {
- useChatStore.setState({ portalArtifactDisplayMode: value as ArtifactDisplayMode });
+ onChange={(key) => {
+ useChatStore.setState({ portalArtifactDisplayMode: key as ArtifactDisplayMode });
}}
/>
)}
diff --git a/src/features/Portal/FilePreview/Body/index.tsx b/src/features/Portal/FilePreview/Body/index.tsx
index 45c9b52efb6..b68e99fa87c 100644
--- a/src/features/Portal/FilePreview/Body/index.tsx
+++ b/src/features/Portal/FilePreview/Body/index.tsx
@@ -1,4 +1,5 @@
-import { Flexbox, Icon, Markdown, Segmented } from '@lobehub/ui';
+import { Flexbox, Icon, Markdown } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { BoltIcon, FileIcon } from 'lucide-react';
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -47,23 +48,27 @@ const FilePreview = () => {
style={{ borderRadius: 4, overflow: 'hidden' }}
>
{chunkText && (
- <Segmented
- block
- value={tab}
- variant={'filled'}
- options={[
+ <Tabs
+ activeKey={tab}
+ items={[
{
icon: <Icon icon={BoltIcon} />,
+ key: FilePreviewTab.Chunk,
label: t('FilePreview.tabs.chunk'),
- value: FilePreviewTab.Chunk,
},
{
icon: <Icon icon={FileIcon} />,
+ key: FilePreviewTab.File,
label: t('FilePreview.tabs.file'),
- value: FilePreviewTab.File,
},
]}
- onChange={(v) => setTabByTopic((prev) => ({ ...prev, [topicKey]: v as FilePreviewTab }))}
+ styles={{
+ list: { display: 'flex', width: '100%' },
+ tab: { flex: 1 },
+ }}
+ onChange={(key) =>
+ setTabByTopic((prev) => ({ ...prev, [topicKey]: key as FilePreviewTab }))
+ }
/>
)}
diff --git a/src/features/Portal/LocalFile/Body.test.tsx b/src/features/Portal/LocalFile/Body.test.tsx
index 229ea57ae20..3989698dee7 100644
--- a/src/features/Portal/LocalFile/Body.test.tsx
+++ b/src/features/Portal/LocalFile/Body.test.tsx
@@ -42,10 +42,13 @@ vi.mock('@lobehub/ui', () => ({
Icon: () => null,
Image: ({ alt, src }: { alt?: string; src?: string }) => <img alt={alt} src={src} />,
Markdown: ({ children }: { children: ReactNode }) => <div>{children}</div>,
- Segmented: () => null,
Text: ({ children }: { children: ReactNode }) => <span>{children}</span>,
}));
+vi.mock('@lobehub/ui/base-ui', () => ({
+ Tabs: () => null,
+}));
+
vi.mock('@/components/CodeEditorPane', () => ({
default: () => <textarea data-testid="code-editor" />,
}));
diff --git a/src/features/Portal/LocalFile/Body.tsx b/src/features/Portal/LocalFile/Body.tsx
index 6190dc28c02..a792e1fffb1 100644
--- a/src/features/Portal/LocalFile/Body.tsx
+++ b/src/features/Portal/LocalFile/Body.tsx
@@ -1,16 +1,7 @@
import { isDesktop } from '@lobechat/const';
import type { MarkdownProps } from '@lobehub/ui';
-import {
- ActionIcon,
- Center,
- Empty,
- Flexbox,
- Icon,
- Image,
- Markdown,
- Segmented,
- Text,
-} from '@lobehub/ui';
+import { ActionIcon, Center, Empty, Flexbox, Icon, Image, Markdown, Text } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
import { CodeIcon, EyeIcon, RefreshCwIcon } from 'lucide-react';
import { memo, useCallback, useEffect, useMemo, useState } from 'react';
@@ -285,26 +276,26 @@ const TextPreviewPane = memo<TextPreviewPaneProps>(
onClick={handleReloadPreview}
/>
)}
- <Segmented
+ <Tabs
+ activeKey={mode}
size={'small'}
- value={mode}
- options={[
+ items={[
{
icon: <Icon icon={EyeIcon} />,
+ key: 'render',
label: t('workingPanel.localFile.preview.render'),
- value: 'render',
},
{
icon: <Icon icon={CodeIcon} />,
+ key: 'raw',
label: t(
isHtml
? 'workingPanel.localFile.preview.source'
: 'workingPanel.localFile.preview.raw',
),
- value: 'raw',
},
]}
- onChange={(v) => setMode(v as TextPreviewMode)}
+ onChange={(key) => setMode(key as TextPreviewMode)}
/>
</Flexbox>
)}
diff --git a/src/features/ShareModal/Modal.tsx b/src/features/ShareModal/Modal.tsx
index 37b256d5888..fbd08e4533b 100644
--- a/src/features/ShareModal/Modal.tsx
+++ b/src/features/ShareModal/Modal.tsx
@@ -1,8 +1,8 @@
'use client';
import { type ConversationContext } from '@lobechat/types';
-import { Flexbox, Segmented, Skeleton } from '@lobehub/ui';
-import { createModal, type ModalInstance } from '@lobehub/ui/base-ui';
+import { Flexbox, Skeleton } from '@lobehub/ui';
+import { createModal, type ModalInstance, Tabs } from '@lobehub/ui/base-ui';
import { t } from 'i18next';
import { memo, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -36,20 +36,20 @@ const ShareModalContent = memo(() => {
const tabItems = useMemo(
() => [
{
+ key: Tab.Screenshot,
label: t('shareModal.screenshot'),
- value: Tab.Screenshot,
},
{
+ key: Tab.Text,
label: t('shareModal.text'),
- value: Tab.Text,
},
{
+ key: Tab.PDF,
label: t('shareModal.pdf'),
- value: Tab.PDF,
},
{
+ key: Tab.JSON,
label: 'JSON',
- value: Tab.JSON,
},
],
[t],
@@ -61,13 +61,15 @@ const ShareModalContent = memo(() => {
height={'100%'}
style={{ overflow: 'hidden', position: 'relative' }}
>
- <Segmented
- block
- options={tabItems}
- style={{ width: '100%' }}
- value={tab}
- variant={'filled'}
- onChange={(value) => setTab(value as Tab)}
+ <Tabs
+ activeKey={tab}
+ items={tabItems}
+ variant="rounded"
+ styles={{
+ list: { display: 'flex', width: '100%' },
+ tab: { flex: 1 },
+ }}
+ onChange={(key) => setTab(key as Tab)}
/>
{isLoading && dbMessages.length === 0 ? (
<Flexbox gap={12} paddingBlock={8}>
diff --git a/src/features/ShareModal/ShareImage/index.tsx b/src/features/ShareModal/ShareImage/index.tsx
index 5eb846231d3..02b901dcbf7 100644
--- a/src/features/ShareModal/ShareImage/index.tsx
+++ b/src/features/ShareModal/ShareImage/index.tsx
@@ -1,5 +1,6 @@
import { type FormItemProps } from '@lobehub/ui';
-import { Button, Flexbox, Form, Segmented } from '@lobehub/ui';
+import { Button, Flexbox, Form } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { Switch } from 'antd';
import { CopyIcon } from 'lucide-react';
import { memo, useState } from 'react';
@@ -39,17 +40,18 @@ const ShareImage = memo<{ mobile?: boolean }>(() => {
const { loading: copyLoading, onCopy } = useImgToClipboard();
const widthModeOptions = [
- { label: t('shareModal.widthMode.wide'), value: WidthMode.Wide },
- { label: t('shareModal.widthMode.narrow'), value: WidthMode.Narrow },
+ { key: WidthMode.Wide, label: t('shareModal.widthMode.wide') },
+ { key: WidthMode.Narrow, label: t('shareModal.widthMode.narrow') },
];
const settings: FormItemProps[] = [
{
- children: <Segmented options={widthModeOptions} />,
+ children: <Tabs items={widthModeOptions} />,
label: t('shareModal.widthMode.label'),
layout: 'horizontal',
minWidth: undefined,
name: 'widthMode',
+ valuePropName: 'activeKey',
},
{
children: <Switch />,
@@ -68,11 +70,12 @@ const ShareImage = memo<{ mobile?: boolean }>(() => {
valuePropName: 'checked',
},
{
- children: <Segmented options={imageTypeOptions} />,
+ children: <Tabs items={imageTypeOptions} />,
label: t('shareModal.imageType'),
layout: 'horizontal',
minWidth: undefined,
name: 'imageType',
+ valuePropName: 'activeKey',
},
];
diff --git a/src/features/ShareModal/ShareJSON/index.tsx b/src/features/ShareModal/ShareJSON/index.tsx
index 69c91d8299b..53cbd4757e8 100644
--- a/src/features/ShareModal/ShareJSON/index.tsx
+++ b/src/features/ShareModal/ShareJSON/index.tsx
@@ -3,7 +3,8 @@ import { type TopicExportMode } from '@lobechat/types';
import { exportFile } from '@lobechat/utils/client';
import { type FormItemProps } from '@lobehub/ui';
import { Button, copyToClipboard, Flexbox, Form } from '@lobehub/ui';
-import { App, Segmented, Switch } from 'antd';
+import { Tabs } from '@lobehub/ui/base-ui';
+import { App, Switch } from 'antd';
import { CopyIcon } from 'lucide-react';
import { memo, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -30,8 +31,8 @@ const ShareJSON = memo(() => {
const exportModeOptions = useMemo(
() => [
- { label: t('shareModal.exportMode.full'), value: 'full' as TopicExportMode },
- { label: t('shareModal.exportMode.simple'), value: 'simple' as TopicExportMode },
+ { key: 'full' as TopicExportMode, label: t('shareModal.exportMode.full') },
+ { key: 'simple' as TopicExportMode, label: t('shareModal.exportMode.simple') },
],
[t],
);
@@ -39,11 +40,16 @@ const ShareJSON = memo(() => {
const settings: FormItemProps[] = [
{
children: (
- <Segmented
- block
- options={exportModeOptions}
- value={fieldValue.exportMode}
- onChange={(value) => setFieldValue((prev) => ({ ...prev, exportMode: value }))}
+ <Tabs
+ activeKey={fieldValue.exportMode}
+ items={exportModeOptions}
+ styles={{
+ list: { display: 'flex', width: '100%' },
+ tab: { flex: 1 },
+ }}
+ onChange={(key) =>
+ setFieldValue((prev) => ({ ...prev, exportMode: key as TopicExportMode }))
+ }
/>
),
label: t('shareModal.exportMode.label'),
diff --git a/src/features/SkillStore/SkillDetail/Nav.tsx b/src/features/SkillStore/SkillDetail/Nav.tsx
index 7d6aa3d4de9..f5845f634a6 100644
--- a/src/features/SkillStore/SkillDetail/Nav.tsx
+++ b/src/features/SkillStore/SkillDetail/Nav.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Flexbox, Icon, Tabs } from '@lobehub/ui';
+import { Flexbox, Icon } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { BookOpenIcon, BotIcon, CodeIcon } from 'lucide-react';
import { memo, useMemo } from 'react';
@@ -30,7 +31,7 @@ interface NavProps {
setActiveTab?: (tab: TabKey) => void;
}
-const Nav = memo<NavProps>(({ activeTab = 'overview', setActiveTab, mobile }) => {
+const Nav = memo<NavProps>(({ activeTab = 'overview', setActiveTab }) => {
const { t } = useTranslation('plugin');
const items = useMemo(
@@ -59,7 +60,6 @@ const Nav = memo<NavProps>(({ activeTab = 'overview', setActiveTab, mobile }) =>
<Tabs
activeKey={activeTab}
className={styles.tabs}
- compact={mobile}
items={items}
onChange={(key) => setActiveTab?.(key as TabKey)}
/>
diff --git a/src/features/SkillStore/SkillDetail/Schema.tsx b/src/features/SkillStore/SkillDetail/Schema.tsx
index b2d941428e9..2cd595126ec 100644
--- a/src/features/SkillStore/SkillDetail/Schema.tsx
+++ b/src/features/SkillStore/SkillDetail/Schema.tsx
@@ -1,7 +1,8 @@
'use client';
import { type SkillItem } from '@lobechat/types';
-import { Flexbox, Segmented, Skeleton, Tag } from '@lobehub/ui';
+import { Flexbox, Skeleton, Tag } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
import { memo, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -64,15 +65,13 @@ const Schema = memo(() => {
<Title level={3} tag={<Tag>{toolsCount}</Tag>}>
{t('mcp.details.schema.tools.title')}
</Title>
- <Segmented
- shape="round"
- value={mode}
- variant="outlined"
- options={[
- { label: t('mcp.details.schema.mode.docs'), value: ModeType.Docs },
- { label: 'JSON', value: ModeType.JSON },
+ <Tabs
+ activeKey={mode}
+ items={[
+ { key: ModeType.Docs, label: t('mcp.details.schema.mode.docs') },
+ { key: ModeType.JSON, label: 'JSON' },
]}
- onChange={(v) => setMode(v as ModeType)}
+ onChange={(key) => setMode(key as ModeType)}
/>
</Flexbox>
<p style={{ marginBottom: 24 }}>{t('mcp.details.schema.tools.desc')}</p>
diff --git a/src/features/SkillStore/SkillStoreContent.tsx b/src/features/SkillStore/SkillStoreContent.tsx
index bcfbdea4cec..60ff6942546 100644
--- a/src/features/SkillStore/SkillStoreContent.tsx
+++ b/src/features/SkillStore/SkillStoreContent.tsx
@@ -1,7 +1,7 @@
'use client';
-import { Flexbox, Segmented } from '@lobehub/ui';
-import { type SegmentedOptions } from 'antd/es/segmented';
+import { Flexbox } from '@lobehub/ui';
+import { Tabs, type TabsItem } from '@lobehub/ui/base-ui';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -31,10 +31,10 @@ export const SkillStoreContent = () => {
const useFetchUninstalledBuiltinTools = useToolStore((s) => s.useFetchUninstalledBuiltinTools);
useFetchUninstalledBuiltinTools(true);
- const options: SegmentedOptions = [
- { label: t('skillStore.tabs.lobehub'), value: SkillStoreTab.LobeHub },
- { label: t('skillStore.tabs.skills'), value: SkillStoreTab.Skills },
- { label: t('skillStore.tabs.mcp'), value: SkillStoreTab.MCP },
+ const options: TabsItem[] = [
+ { key: SkillStoreTab.LobeHub, label: t('skillStore.tabs.lobehub') },
+ { key: SkillStoreTab.Skills, label: t('skillStore.tabs.skills') },
+ { key: SkillStoreTab.MCP, label: t('skillStore.tabs.mcp') },
];
const isLobeHub = activeTab === SkillStoreTab.LobeHub;
@@ -45,13 +45,15 @@ export const SkillStoreContent = () => {
<Flexbox gap={8} style={{ maxHeight: '75vh' }} width={'100%'}>
<Flexbox gap={8}>
<Flexbox horizontal align={'center'} gap={8}>
- <Segmented
- block
- options={options}
+ <Tabs
+ activeKey={activeTab}
+ items={options}
style={{ flex: 1 }}
- value={activeTab}
- variant={'filled'}
- onChange={(v) => setActiveTab(v as SkillStoreTab)}
+ styles={{
+ list: { display: 'flex', width: '100%' },
+ tab: { flex: 1 },
+ }}
+ onChange={(key) => setActiveTab(key as SkillStoreTab)}
/>
<AddSkillButton />
</Flexbox>
diff --git a/src/hooks/useScreenshot.ts b/src/hooks/useScreenshot.ts
index 62b1f87c6d1..22f1f13c407 100644
--- a/src/hooks/useScreenshot.ts
+++ b/src/hooks/useScreenshot.ts
@@ -1,5 +1,5 @@
import { BRANDING_NAME } from '@lobechat/business-const';
-import { type SegmentedProps } from '@lobehub/ui';
+import { type TabsItem } from '@lobehub/ui/base-ui';
import { snapdom } from '@zumer/snapdom';
import dayjs from 'dayjs';
import { useCallback, useState } from 'react';
@@ -11,23 +11,11 @@ export enum ImageType {
WEBP = 'webp',
}
-export const imageTypeOptions: SegmentedProps['options'] = [
- {
- label: 'JPG',
- value: ImageType.JPG,
- },
- {
- label: 'PNG',
- value: ImageType.PNG,
- },
- {
- label: 'SVG',
- value: ImageType.SVG,
- },
- {
- label: 'WEBP',
- value: ImageType.WEBP,
- },
+export const imageTypeOptions: TabsItem[] = [
+ { key: ImageType.JPG, label: 'JPG' },
+ { key: ImageType.PNG, label: 'PNG' },
+ { key: ImageType.SVG, label: 'SVG' },
+ { key: ImageType.WEBP, label: 'WEBP' },
];
export const getImageUrl = async ({
diff --git a/src/routes/(main)/(create)/features/GenerationLayout/Body/index.tsx b/src/routes/(main)/(create)/features/GenerationLayout/Body/index.tsx
index ec578e22ad8..326679bf2fa 100644
--- a/src/routes/(main)/(create)/features/GenerationLayout/Body/index.tsx
+++ b/src/routes/(main)/(create)/features/GenerationLayout/Body/index.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Accordion, AccordionItem, Flexbox, Icon, Segmented, Text } from '@lobehub/ui';
+import { Accordion, AccordionItem, Flexbox, Icon, Text } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { LayoutGrid, ListIcon } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -39,21 +40,22 @@ const Body = memo<GenerationLayoutCommonProps>((props) => {
paddingInline={'8px 4px'}
action={
<Flexbox horizontal gap={2}>
- <Segmented
+ <Tabs
+ activeKey={viewMode}
size={'small'}
- value={viewMode}
- variant={'borderless'}
- options={[
+ items={[
{
icon: <Icon icon={ListIcon} />,
- value: 'list',
+ key: 'list',
+ label: null,
},
{
icon: <Icon icon={LayoutGrid} />,
- value: 'grid',
+ key: 'grid',
+ label: null,
},
]}
- onChange={(v) => updateSystemStatus({ [viewModeStatusKey]: v })}
+ onChange={(key) => updateSystemStatus({ [viewModeStatusKey]: key })}
/>
</Flexbox>
}
diff --git a/src/routes/(main)/(create)/image/features/ConfigPanel/components/ImageNum.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/components/ImageNum.tsx
index 345e5f74694..74a14b344f3 100644
--- a/src/routes/(main)/(create)/image/features/ConfigPanel/components/ImageNum.tsx
+++ b/src/routes/(main)/(create)/image/features/ConfigPanel/components/ImageNum.tsx
@@ -1,6 +1,7 @@
'use client';
-import { ActionIcon, Flexbox, InputNumber, Segmented } from '@lobehub/ui';
+import { ActionIcon, Flexbox, InputNumber } from '@lobehub/ui';
+import { Tabs, type TabsItem } from '@lobehub/ui/base-ui';
import { Check, Plus, X } from 'lucide-react';
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
@@ -32,39 +33,37 @@ const ImageNum = memo<ImageNumSelectorProps>(
const isCustomValue = !presetCounts.includes(imageNum);
- const options = useMemo(() => {
- const items = presetCounts.map((count) => ({
+ const options = useMemo<TabsItem[]>(() => {
+ const items: TabsItem[] = presetCounts.map((count) => ({
+ key: String(count),
label: String(count),
- value: count,
}));
- // Add custom option or show current custom value
if (isCustomValue) {
items.push({
+ key: String(imageNum),
label: String(imageNum),
- value: imageNum,
});
} else {
items.push({
+ key: CUSTOM_VALUE,
label: <Plus size={16} style={{ verticalAlign: 'middle' }} />,
- value: CUSTOM_VALUE,
- } as any);
+ });
}
return items;
}, [presetCounts, isCustomValue, imageNum]);
const handleChange = useCallback(
- (value: number | string) => {
+ (key: string) => {
if (disabled) return;
- if (value === CUSTOM_VALUE || (isCustomValue && value === imageNum)) {
- // Enter edit mode
+ if (key === CUSTOM_VALUE || (isCustomValue && Number(key) === imageNum)) {
setCustomCount(imageNum);
customCountRef.current = imageNum;
setIsEditing(true);
} else {
- setImageNum(value as number);
+ setImageNum(Number(key));
}
},
[disabled, isCustomValue, imageNum, setImageNum],
@@ -155,13 +154,14 @@ const ImageNum = memo<ImageNumSelectorProps>(
}
return (
- <Segmented
- block
- disabled={disabled}
- options={options}
+ <Tabs
+ activeKey={String(imageNum)}
+ items={options.map((item) => ({ ...item, disabled }))}
style={{ width: '100%' }}
- value={isCustomValue ? imageNum : imageNum}
- variant="filled"
+ styles={{
+ list: { display: 'flex', width: '100%' },
+ tab: { flex: 1 },
+ }}
onChange={handleChange}
/>
);
diff --git a/src/routes/(main)/(create)/image/features/ConfigPanel/components/ResolutionSelect.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/components/ResolutionSelect.tsx
index cdd1a391d6e..2d7c4dc2090 100644
--- a/src/routes/(main)/(create)/image/features/ConfigPanel/components/ResolutionSelect.tsx
+++ b/src/routes/(main)/(create)/image/features/ConfigPanel/components/ResolutionSelect.tsx
@@ -1,4 +1,4 @@
-import { Segmented } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { memo, useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -9,8 +9,8 @@ const ResolutionSelect = memo(() => {
const { value, setValue, enumValues } = useGenerationConfigParam('resolution');
const handleChange = useCallback(
- (resolution: string | number) => {
- setValue(String(resolution));
+ (resolution: string) => {
+ setValue(resolution);
},
[setValue],
);
@@ -18,8 +18,8 @@ const ResolutionSelect = memo(() => {
const options = useMemo(() => {
if (!enumValues || enumValues.length === 0) return [];
return enumValues.map((resolution) => ({
+ key: resolution,
label: t(`config.resolution.options.${resolution}`, { defaultValue: resolution }),
- value: resolution,
}));
}, [enumValues, t]);
@@ -28,12 +28,14 @@ const ResolutionSelect = memo(() => {
}
return (
- <Segmented
- block
- options={options}
+ <Tabs
+ activeKey={value}
+ items={options}
style={{ width: '100%' }}
- value={value}
- variant="filled"
+ styles={{
+ list: { display: 'flex', width: '100%' },
+ tab: { flex: 1 },
+ }}
onChange={handleChange}
/>
);
diff --git a/src/routes/(main)/(create)/image/features/PromptInput/index.tsx b/src/routes/(main)/(create)/image/features/PromptInput/index.tsx
index 540113c8d97..cb075eb995f 100644
--- a/src/routes/(main)/(create)/image/features/PromptInput/index.tsx
+++ b/src/routes/(main)/(create)/image/features/PromptInput/index.tsx
@@ -1,7 +1,8 @@
'use client';
import { ModelIcon } from '@lobehub/icons';
-import { ActionIcon, Flexbox, Segmented, Text } from '@lobehub/ui';
+import { ActionIcon, Flexbox, Text } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { Divider, Switch } from 'antd';
import { Images } from 'lucide-react';
import { memo, useEffect, useRef } from 'react';
@@ -83,22 +84,27 @@ const PromptExtendItem = memo(() => {
const { value, setValue, enumValues } = useGenerationConfigParam('promptExtend');
if (enumValues && enumValues.length > 0) {
- const options = enumValues.map((item) => ({ label: item, value: item }));
+ const options = enumValues.map((item) => ({
+ disabled: !canCreate,
+ key: item,
+ label: item,
+ }));
return (
<Flexbox gap={6}>
<Text weight={500}>{t('config.promptExtend.label')}</Text>
- <Segmented
- block
- disabled={!canCreate}
- options={options}
+ <Tabs
+ activeKey={value as string}
+ items={options}
style={{ width: '100%' }}
- value={value as string}
- variant="filled"
- onChange={(next) => {
+ styles={{
+ list: { display: 'flex', width: '100%' },
+ tab: { flex: 1 },
+ }}
+ onChange={(key) => {
if (!canCreate) return;
- setValue(String(next) as any);
+ setValue(key as any);
}}
/>
</Flexbox>
diff --git a/src/routes/(main)/(create)/video/features/PromptInput/index.tsx b/src/routes/(main)/(create)/video/features/PromptInput/index.tsx
index 1e530f41f88..67ffb32688f 100644
--- a/src/routes/(main)/(create)/video/features/PromptInput/index.tsx
+++ b/src/routes/(main)/(create)/video/features/PromptInput/index.tsx
@@ -1,7 +1,8 @@
'use client';
import { ModelIcon } from '@lobehub/icons';
-import { ActionIcon, Flexbox, InputNumber, Segmented, SliderWithInput, Text } from '@lobehub/ui';
+import { ActionIcon, Flexbox, InputNumber, SliderWithInput, Text } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { Divider, Switch } from 'antd';
import { Clock3, Dices } from 'lucide-react';
import { memo, useCallback, useEffect, useMemo, useRef } from 'react';
@@ -98,24 +99,25 @@ const ResolutionItem = memo(() => {
const { allowed: canCreate } = usePermission('create_content');
const { value, setValue, enumValues } = useVideoGenerationConfigParam('resolution');
const options = useMemo(
- () => (enumValues ?? []).map((v) => ({ label: v, value: v })),
- [enumValues],
+ () => (enumValues ?? []).map((v) => ({ disabled: !canCreate, key: v, label: v })),
+ [enumValues, canCreate],
);
if (options.length === 0) return null;
return (
- <Segmented
- block
- disabled={!canCreate}
- options={options}
+ <Tabs
+ activeKey={value}
+ items={options}
style={{ width: '100%' }}
- value={value}
- variant="filled"
- onChange={(v) => {
+ styles={{
+ list: { display: 'flex', width: '100%' },
+ tab: { flex: 1 },
+ }}
+ onChange={(key) => {
if (!canCreate) return;
- setValue(String(v) as any);
+ setValue(key as any);
}}
/>
);
@@ -129,26 +131,28 @@ const DurationItem = memo(() => {
() =>
enumValues && enumValues.length > 0
? enumValues.map((v) => ({
+ disabled: !canCreate,
+ key: String(v),
label: String(v),
- value: v,
}))
: [],
- [enumValues],
+ [enumValues, canCreate],
);
if (options.length > 0) {
return (
- <Segmented
- block
- disabled={!canCreate}
- options={options}
+ <Tabs
+ activeKey={String(value ?? min)}
+ items={options}
style={{ width: '100%' }}
- value={value ?? min}
- variant="filled"
- onChange={(v) => {
+ styles={{
+ list: { display: 'flex', width: '100%' },
+ tab: { flex: 1 },
+ }}
+ onChange={(key) => {
if (!canCreate) return;
- setValue(Number(v) as any);
+ setValue(Number(key) as any);
}}
/>
);
@@ -236,23 +240,25 @@ const PromptExtendItem = memo(() => {
const { allowed: canCreate } = usePermission('create_content');
const { value, setValue, enumValues } = useVideoGenerationConfigParam('promptExtend');
- const options = enumValues?.map((item) => ({ label: item, value: item })) ?? [];
+ const options =
+ enumValues?.map((item) => ({ disabled: !canCreate, key: item, label: item })) ?? [];
if (options.length > 0) {
return (
<Flexbox gap={6}>
<Text weight={500}>{t('config.promptExtend.label')}</Text>
- <Segmented
- block
- disabled={!canCreate}
- options={options}
+ <Tabs
+ activeKey={value as string}
+ items={options}
style={{ width: '100%' }}
- value={value as string}
- variant="filled"
- onChange={(next) => {
+ styles={{
+ list: { display: 'flex', width: '100%' },
+ tab: { flex: 1 },
+ }}
+ onChange={(key) => {
if (!canCreate) return;
- setValue(String(next) as any);
+ setValue(key as any);
}}
/>
</Flexbox>
diff --git a/src/routes/(main)/agent/channel/detail/Body.tsx b/src/routes/(main)/agent/channel/detail/Body.tsx
index 0f011f30dd7..b8dd9d4ffaf 100644
--- a/src/routes/(main)/agent/channel/detail/Body.tsx
+++ b/src/routes/(main)/agent/channel/detail/Body.tsx
@@ -1,15 +1,8 @@
'use client';
import { Flexbox, Form, FormGroup, FormItem, Tag, Text } from '@lobehub/ui';
-import {
- Button,
- Form as AntdForm,
- type FormInstance,
- InputNumber,
- Popconfirm,
- Select,
- Switch,
-} from 'antd';
+import { Button, Switch } from '@lobehub/ui/base-ui';
+import { Form as AntdForm, type FormInstance, InputNumber, Popconfirm, Select } from 'antd';
import { createStaticStyles } from 'antd-style';
import { Plus, RotateCcw, Trash2 } from 'lucide-react';
import { Fragment, memo, useCallback, useMemo, useState } from 'react';
diff --git a/src/routes/(main)/agent/channel/detail/Footer.tsx b/src/routes/(main)/agent/channel/detail/Footer.tsx
index c11c3804e58..7ddfccc07ff 100644
--- a/src/routes/(main)/agent/channel/detail/Footer.tsx
+++ b/src/routes/(main)/agent/channel/detail/Footer.tsx
@@ -1,7 +1,8 @@
'use client';
import { Alert, Flexbox, Tag } from '@lobehub/ui';
-import { Button, Form as AntdForm, type FormInstance } from 'antd';
+import { Button } from '@lobehub/ui/base-ui';
+import { Form as AntdForm, type FormInstance } from 'antd';
import { createStaticStyles } from 'antd-style';
import { RefreshCw, Save, Trash2 } from 'lucide-react';
import { memo, useEffect, useMemo, useState } from 'react';
diff --git a/src/routes/(main)/agent/channel/detail/Header.tsx b/src/routes/(main)/agent/channel/detail/Header.tsx
index ae1739c324b..fab1e40c9f7 100644
--- a/src/routes/(main)/agent/channel/detail/Header.tsx
+++ b/src/routes/(main)/agent/channel/detail/Header.tsx
@@ -1,7 +1,7 @@
'use client';
import { ActionIcon, Flexbox, Tag } from '@lobehub/ui';
-import { Button, Switch } from 'antd';
+import { Button, Switch } from '@lobehub/ui/base-ui';
import { ExternalLink, RefreshCw } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -126,17 +126,12 @@ const Header = memo<HeaderProps>(
</Flexbox>
<Flexbox horizontal align="center" gap={8}>
{currentConfig && (
- <>
- <span style={{ color: 'var(--ant-color-text-secondary)', fontSize: 14 }}>
- {effectiveEnabled ? t('channel.enabled') : t('channel.disabled')}
- </span>
- <Switch
- checked={effectiveEnabled}
- disabled={disabled}
- loading={toggleLoading}
- onChange={onToggleEnable}
- />
- </>
+ <Switch
+ checked={effectiveEnabled}
+ disabled={disabled}
+ loading={toggleLoading}
+ onChange={onToggleEnable}
+ />
)}
</Flexbox>
</Flexbox>
diff --git a/src/routes/(main)/agent/channel/detail/permission.test.tsx b/src/routes/(main)/agent/channel/detail/permission.test.tsx
index 149e9cd7cfa..6f411a16312 100644
--- a/src/routes/(main)/agent/channel/detail/permission.test.tsx
+++ b/src/routes/(main)/agent/channel/detail/permission.test.tsx
@@ -86,6 +86,36 @@ vi.mock('@lobehub/ui', () => ({
Text: ({ children }: { children?: ReactNode }) => <span>{children}</span>,
}));
+vi.mock('@lobehub/ui/base-ui', () => ({
+ Button: ({
+ children,
+ disabled,
+ loading,
+ onClick,
+ ...rest
+ }: React.ButtonHTMLAttributes<HTMLButtonElement> & { loading?: boolean }) => (
+ <button disabled={disabled || loading} onClick={onClick} {...rest}>
+ {children}
+ </button>
+ ),
+ Switch: ({
+ checked,
+ disabled,
+ onChange,
+ }: {
+ checked?: boolean;
+ disabled?: boolean;
+ onChange?: (next: boolean) => void;
+ }) => (
+ <button
+ aria-checked={checked}
+ disabled={disabled}
+ role="switch"
+ onClick={() => onChange?.(!checked)}
+ />
+ ),
+}));
+
vi.mock('@/components/FormInput', () => ({
FormInput: (props: React.InputHTMLAttributes<HTMLInputElement>) => <input {...props} />,
FormPassword: (props: React.InputHTMLAttributes<HTMLInputElement>) => <input {...props} />,
diff --git a/src/routes/(main)/agent/channel/list.tsx b/src/routes/(main)/agent/channel/list.tsx
index 5e81d2a09f8..bedfe6b7460 100644
--- a/src/routes/(main)/agent/channel/list.tsx
+++ b/src/routes/(main)/agent/channel/list.tsx
@@ -1,9 +1,9 @@
'use client';
import { exportJSONFile } from '@lobechat/utils/client';
-import { Icon, Tag } from '@lobehub/ui';
+import { ActionIcon, type DropdownItem, DropdownMenu, Icon, Tag } from '@lobehub/ui';
import { confirmModal } from '@lobehub/ui/base-ui';
-import { App, Dropdown, type MenuProps } from 'antd';
+import { App } from 'antd';
import { createStaticStyles, cx, useTheme } from 'antd-style';
import { Book, Download, MoreHorizontal, Trash2, Upload } from 'lucide-react';
import { memo, useCallback, useRef } from 'react';
@@ -43,7 +43,6 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
}
&.active {
- font-weight: 500;
color: ${cssVar.colorText};
background: ${cssVar.colorFillSecondary};
}
@@ -179,7 +178,7 @@ const PlatformList = memo<PlatformListProps>(
}, [agentId, deleteAllBotProviders, disabled, message, providers, t]);
const hasProviders = !!providers?.length;
- const menuItems: MenuProps['items'] = [
+ const menuItems: DropdownItem[] = [
{
icon: <Icon icon={Download} size={'small'} />,
key: 'export',
@@ -194,7 +193,7 @@ const PlatformList = memo<PlatformListProps>(
label: t('channel.importConfig'),
onClick: handleImport,
},
- { type: 'divider' },
+ { type: 'divider' as const },
{
danger: true,
disabled: disabled || !hasProviders,
@@ -322,21 +321,9 @@ const PlatformList = memo<PlatformListProps>(
>
<Icon icon={Book} size={'small'} /> {t('channel.documentation')}
</a>
- <Dropdown menu={{ items: menuItems }} trigger={['click']}>
- <button
- style={{
- background: 'transparent',
- border: 'none',
- borderRadius: 4,
- color: theme.colorTextQuaternary,
- cursor: 'pointer',
- display: 'flex',
- padding: 4,
- }}
- >
- <Icon icon={MoreHorizontal} size={'small'} />
- </button>
- </Dropdown>
+ <DropdownMenu items={menuItems}>
+ <ActionIcon icon={MoreHorizontal} />
+ </DropdownMenu>
</div>
</aside>
);
diff --git a/src/routes/(main)/agent/features/Conversation/Header/ViewSwitcher/index.tsx b/src/routes/(main)/agent/features/Conversation/Header/ViewSwitcher/index.tsx
index d82cbffd55a..2000e77da45 100644
--- a/src/routes/(main)/agent/features/Conversation/Header/ViewSwitcher/index.tsx
+++ b/src/routes/(main)/agent/features/Conversation/Header/ViewSwitcher/index.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Flexbox, Segmented } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { FileText, MessageSquareText } from 'lucide-react';
import { memo, useMemo } from 'react';
@@ -21,18 +22,6 @@ const styles = createStaticStyles(({ css }) => ({
width: 100%;
min-width: 0;
`,
- switcher: css`
- .ant-segmented-item-label {
- display: flex;
- align-items: center;
- justify-content: center;
- }
-
- .ant-segmented-item,
- .ant-segmented-thumb {
- border-radius: 999px;
- }
- `,
icon: css`
display: none;
@@ -71,6 +60,7 @@ const ViewSwitcher = memo(() => {
const options = useMemo(
() => [
{
+ key: 'chat',
label: (
<Flexbox
horizontal
@@ -82,9 +72,9 @@ const ViewSwitcher = memo(() => {
<span className={styles.text}>{t('viewSwitcher.chat')}</span>
</Flexbox>
),
- value: 'chat',
},
{
+ key: 'page',
label: (
<Flexbox
horizontal
@@ -96,17 +86,15 @@ const ViewSwitcher = memo(() => {
<span className={styles.text}>{t('viewSwitcher.page')}</span>
</Flexbox>
),
- value: 'page',
},
- // { label: t('viewSwitcher.task'), value: 'task' },
],
[t],
);
- const handleChange = (value: number | string) => {
+ const handleChange = (key: string) => {
if (!aid) return;
- switch (String(value) as ViewTab) {
+ switch (key as ViewTab) {
case 'chat': {
if (topicId) navigate(SESSION_CHAT_TOPIC_URL(aid, topicId));
break;
@@ -124,16 +112,7 @@ const ViewSwitcher = memo(() => {
if (!topicId || isHeterogeneousAgent) return null;
- return (
- <Segmented
- className={styles.switcher}
- options={options}
- shape={'round'}
- size={'small'}
- value={currentTab}
- onChange={handleChange}
- />
- );
+ return <Tabs activeKey={currentTab} items={options} size={'small'} onChange={handleChange} />;
});
ViewSwitcher.displayName = 'ViewSwitcher';
diff --git a/src/routes/(main)/agent/profile/features/ProfileEditor/index.tsx b/src/routes/(main)/agent/profile/features/ProfileEditor/index.tsx
index 82b915901bc..04b8e469e42 100644
--- a/src/routes/(main)/agent/profile/features/ProfileEditor/index.tsx
+++ b/src/routes/(main)/agent/profile/features/ProfileEditor/index.tsx
@@ -3,7 +3,7 @@
import { isDesktop } from '@lobechat/const';
import { isRemoteHeterogeneousType } from '@lobechat/heterogeneous-agents';
import { Flexbox } from '@lobehub/ui';
-import { Tabs, type TabsProps } from 'antd';
+import { Tabs, type TabsItem } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
import isEqual from 'fast-deep-equal';
import React, { memo } from 'react';
@@ -78,7 +78,7 @@ const ProfileEditor = memo(() => {
!!heterogeneousProvider &&
isRemoteHeterogeneousType(heterogeneousProvider.type);
const showCloudHeterogeneousTab = heterogeneousProvider?.type === 'claude-code';
- const heterogeneousTabItems: TabsProps['items'] = heterogeneousProvider
+ const heterogeneousTabItems: TabsItem[] = heterogeneousProvider
? [
...(showCloudHeterogeneousTab
? [
diff --git a/src/routes/(main)/community/(detail)/agent/features/Details/Nav.tsx b/src/routes/(main)/community/(detail)/agent/features/Details/Nav.tsx
index 08f8858e7e7..65b93b4548c 100644
--- a/src/routes/(main)/community/(detail)/agent/features/Details/Nav.tsx
+++ b/src/routes/(main)/community/(detail)/agent/features/Details/Nav.tsx
@@ -1,7 +1,8 @@
'use client';
import { SOCIAL_URL } from '@lobechat/business-const';
-import { Flexbox, Icon, Tabs, Tag } from '@lobehub/ui';
+import { Flexbox, Icon, Tag } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { BookOpenIcon, HistoryIcon, LayersIcon, ListIcon, SquareUserIcon } from 'lucide-react';
import { memo } from 'react';
@@ -50,7 +51,7 @@ const Nav = memo<NavProps>(({ mobile, setActiveTab, activeTab = AssistantNavKey.
const nav = (
<Tabs
activeKey={activeTab}
- compact={mobile}
+ variant="square"
items={[
{
icon: <Icon icon={BookOpenIcon} size={16} />,
diff --git a/src/routes/(main)/community/(detail)/group_agent/features/Details/Nav.tsx b/src/routes/(main)/community/(detail)/group_agent/features/Details/Nav.tsx
index c3e08da07ce..f1e49d52225 100644
--- a/src/routes/(main)/community/(detail)/group_agent/features/Details/Nav.tsx
+++ b/src/routes/(main)/community/(detail)/group_agent/features/Details/Nav.tsx
@@ -1,7 +1,8 @@
'use client';
import { SOCIAL_URL } from '@lobechat/business-const';
-import { Flexbox, Icon, Tabs } from '@lobehub/ui';
+import { Flexbox, Icon } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { BookOpenIcon, HistoryIcon, SquareUserIcon } from 'lucide-react';
import { memo } from 'react';
@@ -40,7 +41,7 @@ const Nav = memo<NavProps>(({ mobile, setActiveTab, activeTab = GroupAgentNavKey
const nav = (
<Tabs
activeKey={activeTab}
- compact={mobile}
+ variant="square"
items={[
{
icon: <Icon icon={BookOpenIcon} size={16} />,
@@ -67,7 +68,12 @@ const Nav = memo<NavProps>(({ mobile, setActiveTab, activeTab = GroupAgentNavKey
) : (
<Flexbox horizontal align={'center'} className={styles.nav} justify={'space-between'}>
{nav}
- <Flexbox horizontal gap={12}>
+ <Flexbox
+ horizontal
+ flex="none"
+ gap={12}
+ style={{ marginInlineStart: 12, whiteSpace: 'nowrap' }}
+ >
<a className={styles.link} href={SOCIAL_URL.discord} rel="noreferrer" target="_blank">
{t('groupAgents.details.nav.needHelp', { defaultValue: 'Need help?' })}
</a>
diff --git a/src/routes/(main)/community/(detail)/model/features/Details/Nav.tsx b/src/routes/(main)/community/(detail)/model/features/Details/Nav.tsx
index 1ddb0bd4c35..b3faca2bab3 100644
--- a/src/routes/(main)/community/(detail)/model/features/Details/Nav.tsx
+++ b/src/routes/(main)/community/(detail)/model/features/Details/Nav.tsx
@@ -1,7 +1,8 @@
'use client';
import { SOCIAL_URL } from '@lobechat/business-const';
-import { Flexbox, Icon, Tabs } from '@lobehub/ui';
+import { Flexbox, Icon } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { BookOpenIcon, ListIcon, Settings2Icon } from 'lucide-react';
import { memo } from 'react';
@@ -36,7 +37,7 @@ const Nav = memo<NavProps>(({ mobile, setActiveTab, activeTab = ModelNavKey.Over
const nav = (
<Tabs
activeKey={activeTab}
- compact={mobile}
+ variant="square"
items={[
{
icon: <Icon icon={BookOpenIcon} size={16} />,
@@ -63,7 +64,12 @@ const Nav = memo<NavProps>(({ mobile, setActiveTab, activeTab = ModelNavKey.Over
) : (
<Flexbox horizontal align={'center'} className={styles.nav} justify={'space-between'}>
{nav}
- <Flexbox horizontal gap={12}>
+ <Flexbox
+ horizontal
+ flex="none"
+ gap={12}
+ style={{ marginInlineStart: 12, whiteSpace: 'nowrap' }}
+ >
<a className={styles.link} href={SOCIAL_URL.discord} rel="noreferrer" target="_blank">
{t('mcp.details.nav.needHelp')}
</a>
diff --git a/src/routes/(main)/community/(detail)/model/features/Sidebar/ActionButton/ChatWithModel.tsx b/src/routes/(main)/community/(detail)/model/features/Sidebar/ActionButton/ChatWithModel.tsx
index 023a4d7fee4..59f89204b18 100644
--- a/src/routes/(main)/community/(detail)/model/features/Sidebar/ActionButton/ChatWithModel.tsx
+++ b/src/routes/(main)/community/(detail)/model/features/Sidebar/ActionButton/ChatWithModel.tsx
@@ -1,14 +1,13 @@
'use client';
import { ProviderIcon } from '@lobehub/icons';
-import { Button, DropdownMenu, Icon } from '@lobehub/ui';
-import { Dropdown } from 'antd';
+import { Button, DropdownMenu } from '@lobehub/ui';
import { createStaticStyles } from 'antd-style';
-import { ChevronDownIcon } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import urlJoin from 'url-join';
+import SplitButton from '@/components/SplitButton';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
@@ -45,20 +44,12 @@ const ChatWithModel = memo(() => {
if (includeLobeHub)
return (
- <Dropdown.Button
- className={styles.button}
- icon={<Icon icon={ChevronDownIcon} />}
- overlayStyle={{ minWidth: 267 }}
- size={'large'}
- style={{ flex: 1, width: 'unset' }}
- type={'primary'}
- menu={{
- items,
- }}
- onClick={handleLobeHubChat}
- >
- {t('models.chat')}
- </Dropdown.Button>
+ <SplitButton size={'large'} style={{ flex: 1, width: 'unset' }} type={'primary'}>
+ <SplitButton.Main style={{ flex: 1 }} onClick={handleLobeHubChat}>
+ {t('models.chat')}
+ </SplitButton.Main>
+ <SplitButton.Menu items={items} popupProps={{ style: { minWidth: 267 } }} />
+ </SplitButton>
);
if (items.length === 1)
diff --git a/src/routes/(main)/community/(detail)/provider/features/Details/Nav.tsx b/src/routes/(main)/community/(detail)/provider/features/Details/Nav.tsx
index b21dc1b217e..0bc4d9833c3 100644
--- a/src/routes/(main)/community/(detail)/provider/features/Details/Nav.tsx
+++ b/src/routes/(main)/community/(detail)/provider/features/Details/Nav.tsx
@@ -1,7 +1,8 @@
'use client';
import { BRANDING_PROVIDER, SOCIAL_URL } from '@lobechat/business-const';
-import { Flexbox, Icon, Tabs } from '@lobehub/ui';
+import { Flexbox, Icon } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { BookOpenIcon, BrainCircuitIcon, ListIcon } from 'lucide-react';
import { memo } from 'react';
@@ -65,8 +66,8 @@ const Nav = memo<NavProps>(({ mobile, setActiveTab, activeTab = ProviderNavKey.O
const nav = (
<Tabs
activeKey={activeTab}
- compact={mobile}
items={items}
+ variant="square"
onChange={(key) => setActiveTab?.(key as ProviderNavKey)}
/>
);
@@ -76,7 +77,12 @@ const Nav = memo<NavProps>(({ mobile, setActiveTab, activeTab = ProviderNavKey.O
) : (
<Flexbox horizontal align={'center'} className={styles.nav} justify={'space-between'}>
{nav}
- <Flexbox horizontal gap={12}>
+ <Flexbox
+ horizontal
+ flex="none"
+ gap={12}
+ style={{ marginInlineStart: 12, whiteSpace: 'nowrap' }}
+ >
<a className={styles.link} href={SOCIAL_URL.discord} rel="noreferrer" target="_blank">
{t('mcp.details.nav.needHelp')}
</a>
diff --git a/src/routes/(main)/community/(detail)/provider/features/Sidebar/ActionButton/ProviderConfig.tsx b/src/routes/(main)/community/(detail)/provider/features/Sidebar/ActionButton/ProviderConfig.tsx
index bf9f9a44980..809a0dbd4b4 100644
--- a/src/routes/(main)/community/(detail)/provider/features/Sidebar/ActionButton/ProviderConfig.tsx
+++ b/src/routes/(main)/community/(detail)/provider/features/Sidebar/ActionButton/ProviderConfig.tsx
@@ -2,25 +2,16 @@
import { isDesktop } from '@lobechat/const';
import { Button, Icon } from '@lobehub/ui';
-import { Dropdown } from 'antd';
-import { createStaticStyles } from 'antd-style';
-import { ChevronDownIcon, SquareArrowOutUpRight } from 'lucide-react';
+import { SquareArrowOutUpRight } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
+import SplitButton from '@/components/SplitButton';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
import { useDetailContext } from '../../DetailProvider';
-const styles = createStaticStyles(({ css }) => ({
- button: css`
- button {
- width: 100%;
- }
- `,
-}));
-
const ProviderConfig = memo(() => {
const { t } = useTranslation('discover');
const { url, modelsUrl, identifier } = useDetailContext();
@@ -67,18 +58,12 @@ const ProviderConfig = memo(() => {
);
return (
- <Dropdown.Button
- className={styles.button}
- icon={<Icon icon={ChevronDownIcon} />}
- menu={{ items }}
- overlayStyle={{ minWidth: 267 }}
- size={'large'}
- style={{ flex: 1, width: 'unset' }}
- type={'primary'}
- onClick={openSettings}
- >
- {t('providers.config')}
- </Dropdown.Button>
+ <SplitButton size={'large'} style={{ flex: 1, width: 'unset' }} type={'primary'}>
+ <SplitButton.Main style={{ flex: 1 }} onClick={openSettings}>
+ {t('providers.config')}
+ </SplitButton.Main>
+ <SplitButton.Menu items={items} popupProps={{ style: { minWidth: 267 } }} />
+ </SplitButton>
);
});
diff --git a/src/routes/(main)/community/(detail)/skill/features/Details/Nav.tsx b/src/routes/(main)/community/(detail)/skill/features/Details/Nav.tsx
index cccfdf45647..2160baa6cd8 100644
--- a/src/routes/(main)/community/(detail)/skill/features/Details/Nav.tsx
+++ b/src/routes/(main)/community/(detail)/skill/features/Details/Nav.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Flexbox, Icon, Tabs, Tag } from '@lobehub/ui';
+import { Flexbox, Icon, Tag } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { SkillsIcon } from '@lobehub/ui/icons';
import { createStaticStyles } from 'antd-style';
import { BookOpenIcon, DownloadIcon, FileTextIcon, HistoryIcon, ListIcon } from 'lucide-react';
@@ -40,7 +41,7 @@ const Nav = memo<{
const nav = (
<Tabs
activeKey={activeTab}
- compact={mobile}
+ variant="square"
items={[
{
icon: <Icon icon={BookOpenIcon} size={16} />,
@@ -112,7 +113,12 @@ const Nav = memo<{
) : (
<Flexbox horizontal align={'center'} className={styles.nav} justify={'space-between'}>
{nav}
- <Flexbox horizontal gap={12}>
+ <Flexbox
+ horizontal
+ flex="none"
+ gap={12}
+ style={{ marginInlineStart: 12, whiteSpace: 'nowrap' }}
+ >
<a
className={styles.link}
href="https://discord.gg/AYFPHvv2jT"
diff --git a/src/routes/(main)/community/(detail)/skill/features/Sidebar/Platform.tsx b/src/routes/(main)/community/(detail)/skill/features/Sidebar/Platform.tsx
index e751202695e..f8a342ee9a4 100644
--- a/src/routes/(main)/community/(detail)/skill/features/Sidebar/Platform.tsx
+++ b/src/routes/(main)/community/(detail)/skill/features/Sidebar/Platform.tsx
@@ -10,10 +10,10 @@ import {
Highlighter,
Icon,
Markdown,
- Segmented,
Select,
Text,
} from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { Divider } from 'antd';
import { createStaticStyles, cx } from 'antd-style';
import { BotIcon, UserRoundIcon } from 'lucide-react';
@@ -210,24 +210,26 @@ const Platform = memo<PlatformProps>(
return (
<Block gap={lite ? 0 : 16} padding={4} variant={lite ? 'outlined' : 'borderless'}>
- <Segmented
- block
+ <Tabs
+ activeKey={mode}
style={{ marginBottom: 8 }}
- value={mode}
- variant={'filled'}
- options={[
+ items={[
{
icon: <Icon icon={BotIcon} />,
+ key: 'agent',
label: t('skills.hero.guide.agent'),
- value: 'agent',
},
{
icon: <Icon icon={UserRoundIcon} />,
+ key: 'human',
label: t('skills.hero.guide.human'),
- value: 'human',
},
]}
- onChange={(value) => setMode(value as GuideMode)}
+ styles={{
+ list: { display: 'flex', width: '100%' },
+ tab: { flex: 1 },
+ }}
+ onChange={(key) => setMode(key as GuideMode)}
/>
{mode === 'agent' ? (
@@ -280,11 +282,18 @@ const Platform = memo<PlatformProps>(
onSelect={(v) => setActive(v as PlatformType)}
/>
) : (
- <Segmented
- block
- options={options}
- value={active}
- onChange={(v) => setActive(v as PlatformType)}
+ <Tabs
+ activeKey={active}
+ items={options.map((opt) => ({
+ icon: opt.icon,
+ key: opt.value,
+ label: opt.label,
+ }))}
+ styles={{
+ list: { display: 'flex', width: '100%' },
+ tab: { flex: 1 },
+ }}
+ onChange={(key) => setActive(key as PlatformType)}
/>
)}
<Flexbox>
diff --git a/src/routes/(main)/eval/bench/[benchmarkId]/features/BenchmarkHeader/index.tsx b/src/routes/(main)/eval/bench/[benchmarkId]/features/BenchmarkHeader/index.tsx
index 0235501602d..72f876ab1ce 100644
--- a/src/routes/(main)/eval/bench/[benchmarkId]/features/BenchmarkHeader/index.tsx
+++ b/src/routes/(main)/eval/bench/[benchmarkId]/features/BenchmarkHeader/index.tsx
@@ -2,9 +2,9 @@
import type { AgentEvalRunListItem } from '@lobechat/types';
import { formatCost } from '@lobechat/utils';
-import { Button, Flexbox, Icon } from '@lobehub/ui';
+import { Button, type DropdownItem, DropdownMenu, Flexbox, Icon } from '@lobehub/ui';
import { confirmModal } from '@lobehub/ui/base-ui';
-import { Badge, Dropdown } from 'antd';
+import { Badge } from 'antd';
import { createStaticStyles, cssVar } from 'antd-style';
import {
CircleDollarSign,
@@ -122,7 +122,7 @@ const BenchmarkHeader = memo<BenchmarkHeaderProps>(
});
};
- const menuItems = [
+ const menuItems: DropdownItem[] = [
{
danger: true,
icon: <Trash2 size={16} />,
@@ -226,9 +226,9 @@ const BenchmarkHeader = memo<BenchmarkHeaderProps>(
<Button icon={Edit} size="small" variant="outlined" onClick={handleEdit}>
{t('common.edit')}
</Button>
- <Dropdown menu={{ items: menuItems }} placement="bottomRight" trigger={['click']}>
+ <DropdownMenu items={menuItems} placement="bottomRight">
<Button icon={EllipsisVertical} size="small" variant="outlined" />
- </Dropdown>
+ </DropdownMenu>
</Flexbox>
</Flexbox>
</Flexbox>
diff --git a/src/routes/(main)/eval/bench/[benchmarkId]/features/DatasetTabs/index.tsx b/src/routes/(main)/eval/bench/[benchmarkId]/features/DatasetTabs/index.tsx
index aeaddd21d82..b68b4b1e8f6 100644
--- a/src/routes/(main)/eval/bench/[benchmarkId]/features/DatasetTabs/index.tsx
+++ b/src/routes/(main)/eval/bench/[benchmarkId]/features/DatasetTabs/index.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Empty, Segmented } from '@lobehub/ui';
+import { Empty } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { Database } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -19,10 +20,10 @@ const DatasetTabs = memo<DatasetTabsProps>(({ datasets, activeDatasetId, onChang
}
return (
- <Segmented
- options={datasets.map((d: any) => ({ label: d.name, value: d.id }))}
- value={activeDatasetId || datasets[0]?.id}
- onChange={(value) => onChange(value as string)}
+ <Tabs
+ activeKey={activeDatasetId || datasets[0]?.id}
+ items={datasets.map((d: any) => ({ key: d.id, label: d.name }))}
+ onChange={onChange}
/>
);
});
diff --git a/src/routes/(main)/eval/bench/[benchmarkId]/features/DatasetsTab/DatasetCard.tsx b/src/routes/(main)/eval/bench/[benchmarkId]/features/DatasetsTab/DatasetCard.tsx
index ed4a6bf95ec..0a522f54653 100644
--- a/src/routes/(main)/eval/bench/[benchmarkId]/features/DatasetsTab/DatasetCard.tsx
+++ b/src/routes/(main)/eval/bench/[benchmarkId]/features/DatasetsTab/DatasetCard.tsx
@@ -1,6 +1,6 @@
-import { Button, Flexbox, Tag } from '@lobehub/ui';
+import { Button, DropdownMenu, Flexbox, Tag } from '@lobehub/ui';
import { confirmModal } from '@lobehub/ui/base-ui';
-import { App, Card, Dropdown } from 'antd';
+import { App, Card } from 'antd';
import { createStaticStyles } from 'antd-style';
import { ArrowRight, ChevronRight, Database, Ellipsis, Pencil, Play, Trash2 } from 'lucide-react';
import { memo, useCallback } from 'react';
@@ -189,26 +189,24 @@ const DatasetCard = memo<DatasetCardProps>(
>
{t('run.actions.run')}
</Button>
- <Dropdown
+ <DropdownMenu
trigger={['click']}
- menu={{
- items: [
- {
- icon: <Pencil size={14} />,
- key: 'edit',
- label: t('common.edit'),
- onClick: () => onEdit(dataset),
- },
- { type: 'divider' },
- {
- danger: true,
- icon: <Trash2 size={14} />,
- key: 'delete',
- label: t('common.delete'),
- onClick: handleDelete,
- },
- ],
- }}
+ items={[
+ {
+ icon: <Pencil size={14} />,
+ key: 'edit',
+ label: t('common.edit'),
+ onClick: () => onEdit(dataset),
+ },
+ { type: 'divider' as const },
+ {
+ danger: true,
+ icon: <Trash2 size={14} />,
+ key: 'delete',
+ label: t('common.delete'),
+ onClick: handleDelete,
+ },
+ ]}
>
<Button
className={styles.dropdownButton}
@@ -217,7 +215,7 @@ const DatasetCard = memo<DatasetCardProps>(
variant="text"
onClick={(e) => e.stopPropagation()}
/>
- </Dropdown>
+ </DropdownMenu>
<ChevronRight
size={16}
style={{
diff --git a/src/routes/(main)/eval/bench/[benchmarkId]/features/DatasetsTab/TestCaseTable.tsx b/src/routes/(main)/eval/bench/[benchmarkId]/features/DatasetsTab/TestCaseTable.tsx
index 09f293d7dd1..c476920746e 100644
--- a/src/routes/(main)/eval/bench/[benchmarkId]/features/DatasetsTab/TestCaseTable.tsx
+++ b/src/routes/(main)/eval/bench/[benchmarkId]/features/DatasetsTab/TestCaseTable.tsx
@@ -1,5 +1,5 @@
-import { Button, Flexbox, Input } from '@lobehub/ui';
-import { Dropdown, Pagination, Table } from 'antd';
+import { Button, DropdownMenu, Flexbox, Input } from '@lobehub/ui';
+import { Pagination, Table } from 'antd';
import { type ColumnsType } from 'antd/es/table';
import { createStaticStyles, cssVar } from 'antd-style';
import { Ellipsis, FileUp, Pencil, Plus, Search, Trash2 } from 'lucide-react';
@@ -208,26 +208,24 @@ const TestCaseTable = memo<TestCaseTableProps>(
key: 'actions',
render: (_: any, record: any) => (
<div onClick={(e) => e.stopPropagation()}>
- <Dropdown
+ <DropdownMenu
trigger={['click']}
- menu={{
- items: [
- {
- icon: <Pencil size={14} />,
- key: 'edit',
- label: t('common.edit'),
- onClick: () => onEdit?.(record),
- },
- { type: 'divider' },
- {
- danger: true,
- icon: <Trash2 size={14} />,
- key: 'delete',
- label: t('common.delete'),
- onClick: () => onDelete?.(record),
- },
- ],
- }}
+ items={[
+ {
+ icon: <Pencil size={14} />,
+ key: 'edit',
+ label: t('common.edit'),
+ onClick: () => onEdit?.(record),
+ },
+ { type: 'divider' as const },
+ {
+ danger: true,
+ icon: <Trash2 size={14} />,
+ key: 'delete',
+ label: t('common.delete'),
+ onClick: () => onDelete?.(record),
+ },
+ ]}
>
<Button
icon={Ellipsis}
@@ -240,7 +238,7 @@ const TestCaseTable = memo<TestCaseTableProps>(
width: 28,
}}
/>
- </Dropdown>
+ </DropdownMenu>
</div>
),
width: 48,
diff --git a/src/routes/(main)/eval/bench/[benchmarkId]/features/RunCreateModal/Footer.tsx b/src/routes/(main)/eval/bench/[benchmarkId]/features/RunCreateModal/Footer.tsx
index 27607802853..4bad1bb52a5 100644
--- a/src/routes/(main)/eval/bench/[benchmarkId]/features/RunCreateModal/Footer.tsx
+++ b/src/routes/(main)/eval/bench/[benchmarkId]/features/RunCreateModal/Footer.tsx
@@ -1,11 +1,34 @@
'use client';
+import { type DropdownItem, DropdownMenu, Flexbox } from '@lobehub/ui';
import { ModalFooter, useModalContext } from '@lobehub/ui/base-ui';
-import { Button, Dropdown, Space } from 'antd';
+import { Button } from 'antd';
+import { createStaticStyles } from 'antd-style';
import { ChevronDown } from 'lucide-react';
import { type FC } from 'react';
import { useTranslation } from 'react-i18next';
+const styles = createStaticStyles(({ css }) => ({
+ // Joined split-button: main action + dropdown chevron, sharing a border like
+ // antd's Dropdown.Button. Both <button>s are direct children because
+ // DropdownMenu renders its trigger inline (Menu.Root is context-only).
+ splitButton: css`
+ & > button + button {
+ margin-inline-start: -1px;
+ }
+
+ & > button:first-child {
+ border-start-end-radius: 0;
+ border-end-end-radius: 0;
+ }
+
+ & > button:last-child {
+ border-start-start-radius: 0;
+ border-end-start-radius: 0;
+ }
+ `,
+}));
+
interface FooterProps {
loading: boolean;
onCreateAndStart: () => void;
@@ -15,29 +38,28 @@ interface FooterProps {
const RunCreateFooter: FC<FooterProps> = ({ loading, onCreateAndStart, onCreateOnly }) => {
const { t } = useTranslation('eval');
const { close } = useModalContext();
+
+ const menuItems: DropdownItem[] = [
+ {
+ key: 'createAndStart',
+ label: t('run.create.confirm'),
+ onClick: onCreateAndStart,
+ },
+ ];
+
return (
<ModalFooter>
<Button disabled={loading} onClick={close}>
{t('common.cancel')}
</Button>
- <Space.Compact>
+ <Flexbox horizontal className={styles.splitButton}>
<Button loading={loading} type="primary" onClick={onCreateOnly}>
{t('run.create.createOnly')}
</Button>
- <Dropdown
- menu={{
- items: [
- {
- key: 'createAndStart',
- label: t('run.create.confirm'),
- onClick: onCreateAndStart,
- },
- ],
- }}
- >
+ <DropdownMenu items={menuItems}>
<Button icon={<ChevronDown size={14} />} loading={loading} type="primary" />
- </Dropdown>
- </Space.Compact>
+ </DropdownMenu>
+ </Flexbox>
</ModalFooter>
);
};
diff --git a/src/routes/(main)/eval/bench/[benchmarkId]/features/RunsTab/RunCard.tsx b/src/routes/(main)/eval/bench/[benchmarkId]/features/RunsTab/RunCard.tsx
index 5c49b68b40c..7553f180201 100644
--- a/src/routes/(main)/eval/bench/[benchmarkId]/features/RunsTab/RunCard.tsx
+++ b/src/routes/(main)/eval/bench/[benchmarkId]/features/RunsTab/RunCard.tsx
@@ -1,7 +1,7 @@
import type { AgentEvalRunListItem } from '@lobechat/types';
-import { Flexbox, Icon } from '@lobehub/ui';
+import { type DropdownItem, DropdownMenu, Flexbox, Icon } from '@lobehub/ui';
import { confirmModal } from '@lobehub/ui/base-ui';
-import { App, Card, Dropdown, Progress } from 'antd';
+import { App, Card, Progress } from 'antd';
import { createStaticStyles } from 'antd-style';
import {
AlertTriangle,
@@ -200,7 +200,7 @@ const RunCard = memo<RunCardProps>(({ benchmarkId, run, onRefresh, onEdit }) =>
onEdit?.(run);
};
- const menuItems = [
+ const menuItems: DropdownItem[] = [
...(canStart
? [
{
@@ -319,7 +319,7 @@ const RunCard = memo<RunCardProps>(({ benchmarkId, run, onRefresh, onEdit }) =>
)}
{/* Actions dropdown */}
- <Dropdown menu={{ items: menuItems }} placement="bottomRight" trigger={['click']}>
+ <DropdownMenu items={menuItems} placement="bottomRight">
<span
className={styles.dropdownTrigger}
onClick={(e) => {
@@ -329,7 +329,7 @@ const RunCard = memo<RunCardProps>(({ benchmarkId, run, onRefresh, onEdit }) =>
>
<Ellipsis size={16} />
</span>
- </Dropdown>
+ </DropdownMenu>
<Icon className={styles.arrowIcon} icon={ArrowRight} size={16} />
</Flexbox>
diff --git a/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/cases/[caseId]/index.tsx b/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/cases/[caseId]/index.tsx
index 74a35ddb5bd..92684494be0 100644
--- a/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/cases/[caseId]/index.tsx
+++ b/src/routes/(main)/eval/bench/[benchmarkId]/runs/[runId]/cases/[caseId]/index.tsx
@@ -1,7 +1,8 @@
'use client';
import type { EvalThreadResult } from '@lobechat/types';
-import { Flexbox, Tabs } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { memo, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useParams } from 'react-router';
@@ -98,7 +99,6 @@ const CaseDetail = memo(() => {
/>
{hasMultipleThreads && (
<Tabs
- compact
activeKey={activeThreadId!}
items={threads.map((thread, index) => ({
key: thread.threadId,
diff --git a/src/routes/(main)/memory/identities/features/SegmentedBar.tsx b/src/routes/(main)/memory/identities/features/SegmentedBar.tsx
index 6d3d87052fe..0340e2653c4 100644
--- a/src/routes/(main)/memory/identities/features/SegmentedBar.tsx
+++ b/src/routes/(main)/memory/identities/features/SegmentedBar.tsx
@@ -1,4 +1,4 @@
-import { Segmented } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -13,15 +13,15 @@ const SegmentedBar = memo<SegmentedBarProps>(({ typeValue, onTypeChange }) => {
const { t } = useTranslation('memory');
return (
- <Segmented
- value={typeValue}
- options={[
- { label: t('identity.filter.type.all'), value: 'all' },
- { label: t('identity.filter.type.personal'), value: 'personal' },
- { label: t('identity.filter.type.professional'), value: 'professional' },
- { label: t('identity.filter.type.demographic'), value: 'demographic' },
+ <Tabs
+ activeKey={typeValue}
+ items={[
+ { key: 'all', label: t('identity.filter.type.all') },
+ { key: 'personal', label: t('identity.filter.type.personal') },
+ { key: 'professional', label: t('identity.filter.type.professional') },
+ { key: 'demographic', label: t('identity.filter.type.demographic') },
]}
- onChange={(value) => onTypeChange(value as IdentityType)}
+ onChange={(key) => onTypeChange(key as IdentityType)}
/>
);
});
diff --git a/src/routes/(main)/settings/chat-appearance/features/ChatAppearance/index.tsx b/src/routes/(main)/settings/chat-appearance/features/ChatAppearance/index.tsx
index 940824a12d0..5ac8760604e 100644
--- a/src/routes/(main)/settings/chat-appearance/features/ChatAppearance/index.tsx
+++ b/src/routes/(main)/settings/chat-appearance/features/ChatAppearance/index.tsx
@@ -6,11 +6,10 @@ import {
highlighterThemes,
Icon,
mermaidThemes,
- Segmented,
Skeleton,
SliderWithInput,
} from '@lobehub/ui';
-import { Select, Switch } from '@lobehub/ui/base-ui';
+import { Select, Switch, Tabs } from '@lobehub/ui/base-ui';
import isEqual from 'fast-deep-equal';
import { Loader2Icon } from 'lucide-react';
import { memo, useState } from 'react';
@@ -51,24 +50,23 @@ const ChatAppearance = memo(() => {
{loadingStates.transitionMode && (
<Icon spin icon={Loader2Icon} size={16} style={{ opacity: 0.5 }} />
)}
- <Segmented
- value={general.transitionMode}
- variant={'outlined'}
- options={[
+ <Tabs
+ activeKey={general.transitionMode}
+ items={[
{
+ key: 'none',
label: t('settingChatAppearance.transitionMode.options.none.value'),
- value: 'none',
},
{
+ key: 'fadeIn',
label: t('settingChatAppearance.transitionMode.options.fadeIn'),
- value: 'fadeIn',
},
{
+ key: 'smooth',
label: t('settingChatAppearance.transitionMode.options.smooth'),
- value: 'smooth',
},
]}
- onChange={(value) => handleChange('transitionMode', value)}
+ onChange={(key) => handleChange('transitionMode', key)}
/>
</Flexbox>
}
diff --git a/src/routes/(main)/settings/common/features/Common/Common.tsx b/src/routes/(main)/settings/common/features/Common/Common.tsx
index a9543b8595f..e8b9ab1ec57 100644
--- a/src/routes/(main)/settings/common/features/Common/Common.tsx
+++ b/src/routes/(main)/settings/common/features/Common/Common.tsx
@@ -2,8 +2,7 @@
import { type FormGroupItemType } from '@lobehub/ui';
import { Flexbox, Form, Icon, ImageSelect, Skeleton } from '@lobehub/ui';
-import { Select } from '@lobehub/ui/base-ui';
-import { Segmented } from 'antd';
+import { Select, Tabs } from '@lobehub/ui/base-ui';
import isEqual from 'fast-deep-equal';
import { Ban, Gauge, Loader2Icon, Monitor, Moon, Mouse, Sun, Waves } from 'lucide-react';
import { useTheme as useNextThemesTheme } from 'next-themes';
@@ -95,22 +94,22 @@ const Common = memo(() => {
},
{
children: (
- <Segmented
- options={[
+ <Tabs
+ items={[
{
icon: <Icon icon={Ban} size={16} />,
+ key: 'disabled',
label: t('settingAppearance.animationMode.disabled'),
- value: 'disabled',
},
{
icon: <Icon icon={Gauge} size={16} />,
+ key: 'agile',
label: t('settingAppearance.animationMode.agile'),
- value: 'agile',
},
{
icon: <Icon icon={Waves} size={16} />,
+ key: 'elegant',
label: t('settingAppearance.animationMode.elegant'),
- value: 'elegant',
},
]}
/>
@@ -119,20 +118,21 @@ const Common = memo(() => {
label: t('settingAppearance.animationMode.title'),
minWidth: undefined,
name: 'animationMode',
+ valuePropName: 'activeKey',
},
{
children: (
- <Segmented
- options={[
+ <Tabs
+ items={[
{
icon: <Icon icon={Ban} size={16} />,
+ key: 'disabled',
label: t('settingAppearance.contextMenuMode.disabled'),
- value: 'disabled',
},
{
icon: <Icon icon={Mouse} size={16} />,
+ key: 'default',
label: t('settingAppearance.contextMenuMode.default'),
- value: 'default',
},
]}
/>
@@ -141,6 +141,7 @@ const Common = memo(() => {
label: t('settingAppearance.contextMenuMode.title'),
minWidth: undefined,
name: 'contextMenuMode',
+ valuePropName: 'activeKey',
},
{
diff --git a/src/routes/(main)/settings/provider/features/ModelList/index.tsx b/src/routes/(main)/settings/provider/features/ModelList/index.tsx
index 20dca6bf5bf..0ca09155da9 100644
--- a/src/routes/(main)/settings/provider/features/ModelList/index.tsx
+++ b/src/routes/(main)/settings/provider/features/ModelList/index.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Flexbox, Icon, Tabs } from '@lobehub/ui';
+import { Flexbox, Icon } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { cssVar } from 'antd-style';
import isEqual from 'fast-deep-equal';
import {
diff --git a/src/routes/(main)/settings/skill/features/AgentSkillItem.tsx b/src/routes/(main)/settings/skill/features/AgentSkillItem.tsx
index 659bf90f8a3..523ca559cc3 100644
--- a/src/routes/(main)/settings/skill/features/AgentSkillItem.tsx
+++ b/src/routes/(main)/settings/skill/features/AgentSkillItem.tsx
@@ -5,10 +5,12 @@ import { Avatar, Button, DropdownMenu, Flexbox, Icon, Modal, stopPropagation } f
import { confirmModal } from '@lobehub/ui/base-ui';
import { SkillsIcon } from '@lobehub/ui/icons';
import { Space } from 'antd';
+import { cssVar } from 'antd-style';
import { DownloadIcon, MoreHorizontalIcon, Plus, Trash2 } from 'lucide-react';
import { lazy, memo, Suspense, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import NavItem from '@/features/NavPanel/components/NavItem';
import { createBuiltinAgentSkillDetailModal } from '@/features/SkillStore/SkillDetail';
import { usePermission } from '@/hooks/usePermission';
import { agentSkillService } from '@/services/skill';
@@ -206,6 +208,20 @@ const AgentSkillItem = memo<AgentSkillItemProps>(({ skill, isSelected, onSelect
const showDisconnected = isBuiltin && !isBuiltinInstalled;
+ if (onSelect) {
+ return (
+ <NavItem
+ active={isSelected}
+ title={title}
+ titleColor={showDisconnected ? cssVar.colorTextDescription : undefined}
+ icon={() =>
+ avatar ? <Avatar avatar={avatar} size={18} /> : <Icon icon={SkillsIcon} size={18} />
+ }
+ onClick={onSelect}
+ />
+ );
+ }
+
return (
<>
<Flexbox
diff --git a/src/routes/(main)/settings/skill/features/BuiltinSkillItem.tsx b/src/routes/(main)/settings/skill/features/BuiltinSkillItem.tsx
index b3841280f85..403eb8de317 100644
--- a/src/routes/(main)/settings/skill/features/BuiltinSkillItem.tsx
+++ b/src/routes/(main)/settings/skill/features/BuiltinSkillItem.tsx
@@ -2,10 +2,12 @@
import { Avatar, Button, DropdownMenu, Flexbox, Icon, stopPropagation } from '@lobehub/ui';
import { confirmModal } from '@lobehub/ui/base-ui';
+import { cssVar } from 'antd-style';
import { MoreHorizontalIcon, Plus, Trash2 } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
+import NavItem from '@/features/NavPanel/components/NavItem';
import { createBuiltinSkillDetailModal } from '@/features/SkillStore/SkillDetail';
import { usePermission } from '@/hooks/usePermission';
import { useToolStore } from '@/store/tool';
@@ -96,6 +98,18 @@ const BuiltinSkillItem = memo<BuiltinSkillItemProps>(
);
};
+ if (onSelect) {
+ return (
+ <NavItem
+ active={isSelected}
+ icon={() => <Avatar avatar={avatar} size={18} />}
+ title={title}
+ titleColor={!isInstalled ? cssVar.colorTextDescription : undefined}
+ onClick={onSelect}
+ />
+ );
+ }
+
return (
<Flexbox
horizontal
diff --git a/src/routes/(main)/settings/skill/features/ComposioSkillItem.tsx b/src/routes/(main)/settings/skill/features/ComposioSkillItem.tsx
index 6c1212edd7e..581520e5d6c 100644
--- a/src/routes/(main)/settings/skill/features/ComposioSkillItem.tsx
+++ b/src/routes/(main)/settings/skill/features/ComposioSkillItem.tsx
@@ -1,9 +1,17 @@
'use client';
import { type ComposioAppType } from '@lobechat/const';
-import { Avatar, Button as LobeButton, DropdownMenu, Flexbox, Icon, Tooltip } from '@lobehub/ui';
+import {
+ Avatar,
+ Button as LobeButton,
+ Center,
+ DropdownMenu,
+ Flexbox,
+ Icon,
+ Tooltip,
+} from '@lobehub/ui';
import { confirmModal } from '@lobehub/ui/base-ui';
-import { Button } from 'antd';
+import { Badge, Button } from 'antd';
import { cssVar } from 'antd-style';
import {
Loader2,
@@ -13,9 +21,10 @@ import {
Trash2,
Unplug,
} from 'lucide-react';
-import { memo, useCallback, useEffect, useRef, useState } from 'react';
+import { memo, type ReactNode, useCallback, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import NavItem from '@/features/NavPanel/components/NavItem';
import { usePermission } from '@/hooks/usePermission';
import { useToolStore } from '@/store/tool';
import { type ComposioServer } from '@/store/tool/slices/composioStore';
@@ -328,6 +337,40 @@ const ComposioSkillItem = memo<ComposioSkillItemProps>(
};
const isConnected = server?.status === ComposioServerStatus.ACTIVE;
+ const isPending = server?.status === ComposioServerStatus.PENDING_AUTH;
+ const isError = server?.status === ComposioServerStatus.ERROR;
+
+ if (onSelect) {
+ let badge: ReactNode;
+ if (isPending) {
+ badge = (
+ <Center width={18}>
+ <Badge status="warning" />
+ </Center>
+ );
+ } else if (isError) {
+ badge = (
+ <Center width={18}>
+ <Badge status="error" />
+ </Center>
+ );
+ }
+ const renderNavIcon = () => {
+ const { icon, label } = serverType;
+ if (typeof icon === 'string') return <Avatar alt={label} avatar={icon} size={18} />;
+ return <Icon fill={cssVar.colorText} icon={icon} size={18} />;
+ };
+ return (
+ <NavItem
+ active={isSelected}
+ extra={badge}
+ icon={renderNavIcon}
+ title={serverType.label}
+ titleColor={!isConnected ? cssVar.colorTextDescription : undefined}
+ onClick={onSelect}
+ />
+ );
+ }
return (
<Flexbox
diff --git a/src/routes/(main)/settings/skill/features/LeftPanel.tsx b/src/routes/(main)/settings/skill/features/LeftPanel.tsx
new file mode 100644
index 00000000000..6bdfa34ade9
--- /dev/null
+++ b/src/routes/(main)/settings/skill/features/LeftPanel.tsx
@@ -0,0 +1,166 @@
+'use client';
+
+import { Button, DropdownMenu, Flexbox, Icon, Text } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
+import { GithubIcon } from '@lobehub/ui/icons';
+import { createStaticStyles } from 'antd-style';
+import { FileArchive, Grid2x2Plus, Link, Store } from 'lucide-react';
+import { memo, useCallback, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { CustomConnectorModal } from '@/features/Connectors';
+import { createSkillStoreModal } from '@/features/SkillStore';
+import { openImportFromGithubModal } from '@/features/SkillStore/SkillList/ImportFromGithubModal';
+import { openImportFromUrlModal } from '@/features/SkillStore/SkillList/ImportFromUrlModal';
+import { openUploadSkillModal } from '@/features/SkillStore/SkillList/UploadSkillModal';
+
+import { type ToolDetailType } from './SkillDetail';
+import SkillList, { type SkillViewMode } from './SkillList';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ body: css`
+ overflow-y: auto;
+ flex: 1;
+ padding-block: 4px;
+ padding-inline: 8px;
+ `,
+ header: css`
+ display: flex;
+ flex-shrink: 0;
+ gap: 8px;
+ align-items: center;
+ justify-content: space-between;
+
+ height: 42px;
+ padding-inline: 16px;
+ border-block-end: 1px solid ${cssVar.colorBorderSecondary};
+ `,
+ root: css`
+ overflow-y: auto;
+ display: flex;
+ flex-direction: column;
+
+ width: 300px;
+ min-width: 260px;
+ border-inline-end: 1px solid ${cssVar.colorBorderSecondary};
+ `,
+}));
+
+interface LeftPanelProps {
+ onDeleteSelected: () => void;
+ onSelect: (identifier: string, type: ToolDetailType) => void;
+ onViewModeChange: (mode: SkillViewMode) => void;
+ selectedIdentifier?: string;
+ viewMode: SkillViewMode;
+}
+
+const LeftPanel = memo<LeftPanelProps>(
+ ({ onDeleteSelected, onSelect, onViewModeChange, selectedIdentifier, viewMode }) => {
+ const { t } = useTranslation('setting');
+ const [showAddConnector, setShowAddConnector] = useState(false);
+
+ const handleOpenStore = useCallback(() => {
+ createSkillStoreModal();
+ }, []);
+
+ return (
+ <>
+ <div className={styles.root}>
+ <div className={styles.header}>
+ <Tabs
+ activeKey={viewMode}
+ size="small"
+ style={{ width: 'auto' }}
+ items={[
+ { key: 'connector', label: t('skillView.connectors', 'Connectors') },
+ { key: 'skill', label: t('skillView.skills', 'Skills') },
+ ]}
+ onChange={(key) => onViewModeChange(key as SkillViewMode)}
+ />
+
+ <div style={{ display: 'flex', gap: 6 }} onClick={(e) => e.stopPropagation()}>
+ <DropdownMenu
+ nativeButton={false}
+ placement="bottomRight"
+ items={[
+ {
+ icon: <Icon icon={Link} />,
+ key: 'importUrl',
+ label: (
+ <Flexbox gap={2}>
+ <span>{t('tab.importFromUrl')}</span>
+ <Text style={{ fontSize: 12 }} type="secondary">
+ {t('tab.importFromUrl.desc')}
+ </Text>
+ </Flexbox>
+ ),
+ onClick: () => openImportFromUrlModal(),
+ },
+ {
+ icon: <Icon icon={GithubIcon} />,
+ key: 'importGithub',
+ label: (
+ <Flexbox gap={2}>
+ <span>{t('tab.importFromGithub')}</span>
+ <Text style={{ fontSize: 12 }} type="secondary">
+ {t('tab.importFromGithub.desc')}
+ </Text>
+ </Flexbox>
+ ),
+ onClick: () => openImportFromGithubModal(),
+ },
+ {
+ icon: <Icon icon={FileArchive} />,
+ key: 'uploadZip',
+ label: (
+ <Flexbox gap={2}>
+ <span>{t('tab.uploadZip')}</span>
+ <Text style={{ fontSize: 12 }} type="secondary">
+ {t('tab.uploadZip.desc')}
+ </Text>
+ </Flexbox>
+ ),
+ onClick: () => openUploadSkillModal(),
+ },
+ { type: 'divider' as const },
+ {
+ icon: <Icon icon={Grid2x2Plus} />,
+ key: 'addConnector',
+ label: (
+ <Flexbox gap={2}>
+ <span>
+ {t('connector.add.title', {
+ defaultValue: 'Add Custom Connector',
+ ns: 'tool',
+ })}
+ </span>
+ </Flexbox>
+ ),
+ onClick: () => setShowAddConnector(true),
+ },
+ ]}
+ >
+ <Button icon={Grid2x2Plus} size="small" />
+ </DropdownMenu>
+ <Button icon={<Icon icon={Store} />} size="small" onClick={handleOpenStore} />
+ </div>
+ </div>
+
+ <div className={styles.body}>
+ <SkillList
+ selectedIdentifier={selectedIdentifier}
+ viewMode={viewMode}
+ onDeleteSelected={onDeleteSelected}
+ onSelect={onSelect}
+ />
+ </div>
+ </div>
+ <CustomConnectorModal open={showAddConnector} onClose={() => setShowAddConnector(false)} />
+ </>
+ );
+ },
+);
+
+LeftPanel.displayName = 'SkillSettingsLeftPanel';
+
+export default LeftPanel;
diff --git a/src/routes/(main)/settings/skill/features/LobehubSkillItem.tsx b/src/routes/(main)/settings/skill/features/LobehubSkillItem.tsx
index d80c98daead..d4a628ecdbd 100644
--- a/src/routes/(main)/settings/skill/features/LobehubSkillItem.tsx
+++ b/src/routes/(main)/settings/skill/features/LobehubSkillItem.tsx
@@ -1,14 +1,23 @@
'use client';
import { type LobehubSkillProviderType } from '@lobechat/const';
-import { Avatar, Button as LobeButton, DropdownMenu, Flexbox, Icon, Tooltip } from '@lobehub/ui';
+import {
+ Avatar,
+ Button as LobeButton,
+ Center,
+ DropdownMenu,
+ Flexbox,
+ Icon,
+ Tooltip,
+} from '@lobehub/ui';
import { confirmModal } from '@lobehub/ui/base-ui';
-import { Button } from 'antd';
+import { Badge, Button } from 'antd';
import { cssVar } from 'antd-style';
import { Loader2, MoreHorizontalIcon, SquareArrowOutUpRight, Unplug } from 'lucide-react';
import { memo, useCallback, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import NavItem from '@/features/NavPanel/components/NavItem';
import { createLobehubSkillDetailModal } from '@/features/SkillStore/SkillDetail';
import { usePermission } from '@/hooks/usePermission';
import { useToolStore } from '@/store/tool';
@@ -275,6 +284,31 @@ const LobehubSkillItem = memo<LobehubSkillItemProps>(
};
const isConnected = server?.status === LobehubSkillStatus.CONNECTED;
+ const isError = server?.status === LobehubSkillStatus.ERROR;
+
+ if (onSelect) {
+ const renderNavIcon = () => {
+ const { icon, label } = provider;
+ if (typeof icon === 'string') return <Avatar alt={label} avatar={icon} size={18} />;
+ return <Icon fill={cssVar.colorText} icon={icon} size={18} />;
+ };
+ return (
+ <NavItem
+ active={isSelected}
+ icon={renderNavIcon}
+ title={provider.label}
+ titleColor={!isConnected ? cssVar.colorTextDescription : undefined}
+ extra={
+ isError ? (
+ <Center width={18}>
+ <Badge status="error" />
+ </Center>
+ ) : undefined
+ }
+ onClick={onSelect}
+ />
+ );
+ }
return (
<Flexbox
diff --git a/src/routes/(main)/settings/skill/features/McpSkillItem.tsx b/src/routes/(main)/settings/skill/features/McpSkillItem.tsx
index 503864b67e9..4b6fa2bedc5 100644
--- a/src/routes/(main)/settings/skill/features/McpSkillItem.tsx
+++ b/src/routes/(main)/settings/skill/features/McpSkillItem.tsx
@@ -9,6 +9,7 @@ import MCPTag from '@/components/Plugins/MCPTag';
import PluginTag from '@/components/Plugins/PluginTag';
import McpDetail from '@/features/MCP/MCPDetail';
import McpDetailLoading from '@/features/MCP/MCPDetail/Loading';
+import NavItem from '@/features/NavPanel/components/NavItem';
import PluginDetailModal from '@/features/PluginDetailModal';
import { useToolStore } from '@/store/tool';
import { pluginSelectors } from '@/store/tool/selectors';
@@ -38,6 +39,23 @@ const McpSkillItem = memo<McpSkillItemProps>(
const plugin = useToolStore(pluginSelectors.getToolManifestById(identifier));
+ if (onSelect) {
+ return (
+ <NavItem
+ active={isSelected}
+ title={title}
+ icon={() =>
+ avatar && avatar !== 'MCP_AVATAR' ? (
+ <Avatar avatar={avatar} shape="square" size={18} />
+ ) : (
+ <Icon icon={McpIcon} size={18} />
+ )
+ }
+ onClick={onSelect}
+ />
+ );
+ }
+
return (
<>
<Flexbox
diff --git a/src/routes/(main)/settings/skill/features/SkillList.tsx b/src/routes/(main)/settings/skill/features/SkillList.tsx
index 462c6fb24c5..2ea9c5229b0 100644
--- a/src/routes/(main)/settings/skill/features/SkillList.tsx
+++ b/src/routes/(main)/settings/skill/features/SkillList.tsx
@@ -65,12 +65,12 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
gap: 4px;
align-items: center;
- padding-block: 8px 2px;
- padding-inline: 0;
+ padding-block: 12px 4px;
+ padding-inline: 4px;
- font-size: 11px;
+ font-size: 12px;
font-weight: 500;
- color: ${cssVar.colorTextTertiary};
+ color: ${cssVar.colorTextSecondary};
&:hover {
color: ${cssVar.colorText};
diff --git a/src/routes/(main)/settings/skill/index.tsx b/src/routes/(main)/settings/skill/index.tsx
index 3133b53e99e..e755e643794 100644
--- a/src/routes/(main)/settings/skill/index.tsx
+++ b/src/routes/(main)/settings/skill/index.tsx
@@ -1,92 +1,37 @@
'use client';
-import { Button, DropdownMenu, Flexbox, Icon, Text } from '@lobehub/ui';
-import { GithubIcon } from '@lobehub/ui/icons';
import { createStaticStyles } from 'antd-style';
import isEqual from 'fast-deep-equal';
-import { FileArchive, Grid2x2Plus, Link, Store } from 'lucide-react';
-import { memo, useCallback, useEffect, useState } from 'react';
-import { useTranslation } from 'react-i18next';
+import { memo, useEffect, useState } from 'react';
import { useSearchParams } from 'react-router';
-import { CustomConnectorModal } from '@/features/Connectors';
import NavHeader from '@/features/NavHeader';
-import { createSkillStoreModal } from '@/features/SkillStore';
-import { openImportFromGithubModal } from '@/features/SkillStore/SkillList/ImportFromGithubModal';
-import { openImportFromUrlModal } from '@/features/SkillStore/SkillList/ImportFromUrlModal';
-import { openUploadSkillModal } from '@/features/SkillStore/SkillList/UploadSkillModal';
import { useToolStore } from '@/store/tool';
import { agentSkillsSelectors, builtinToolSelectors } from '@/store/tool/selectors';
+import LeftPanel from './features/LeftPanel';
import SkillDetail, { type ToolDetailType } from './features/SkillDetail';
-import SkillList, { type SkillViewMode } from './features/SkillList';
+import { type SkillViewMode } from './features/SkillList';
export interface SelectedTool {
identifier: string;
type: ToolDetailType;
}
-const styles = createStaticStyles(({ css, cssVar }) => ({
+const styles = createStaticStyles(({ css }) => ({
detail: css`
overflow-y: auto;
flex: 1;
`,
- left: css`
- overflow-y: auto;
- display: flex;
- flex-direction: column;
-
- width: 300px;
- min-width: 260px;
- border-inline-end: 1px solid ${cssVar.colorBorderSecondary};
- `,
- leftHeader: css`
- display: flex;
- gap: 8px;
- align-items: center;
- justify-content: space-between;
-
- padding-block: 10px;
- padding-inline: 16px;
- border-block-end: 1px solid ${cssVar.colorBorderSecondary};
- `,
root: css`
overflow: hidden;
display: flex;
flex: 1;
height: 100%;
`,
- tab: css`
- cursor: pointer;
-
- padding-block: 4px;
- padding-inline: 10px;
- border-radius: 6px;
-
- font-size: 13px;
- font-weight: 500;
- color: ${cssVar.colorTextSecondary};
-
- transition: all 0.15s;
-
- &:hover {
- color: ${cssVar.colorText};
- background: ${cssVar.colorFillSecondary};
- }
- `,
- tabActive: css`
- color: ${cssVar.colorText};
- background: ${cssVar.colorFillSecondary};
- `,
- tabs: css`
- display: flex;
- gap: 2px;
- align-items: center;
- `,
}));
const Page = memo(() => {
- const { t } = useTranslation('setting');
const [searchParams] = useSearchParams();
const queryViewMode: SkillViewMode =
searchParams.get('tab') === 'skill' || searchParams.get('view') === 'skill'
@@ -95,9 +40,7 @@ const Page = memo(() => {
const querySkillIdentifier = searchParams.get('skill');
const [selected, setSelected] = useState<SelectedTool | null>(null);
const [viewMode, setViewMode] = useState<SkillViewMode>(queryViewMode);
- const [showAddConnector, setShowAddConnector] = useState(false);
- // Data sources for auto-select
const builtinTools = useToolStore((s) => s.builtinTools, isEqual);
const builtinSkills = useToolStore((s) => s.builtinSkills, isEqual);
const marketAgentSkills = useToolStore(agentSkillsSelectors.getMarketAgentSkills, isEqual);
@@ -106,7 +49,7 @@ const Page = memo(() => {
(s) => builtinToolSelectors.installedAllMetaList(s).map((tool) => tool.identifier),
isEqual,
);
- // Auto-select first item when view changes or on load
+
useEffect(() => {
setSelected(null);
}, [viewMode]);
@@ -142,10 +85,6 @@ const Page = memo(() => {
if (skill) setSelected({ identifier: skill.id, type: 'agent-skill' });
}, [marketAgentSkills, querySkillIdentifier, userAgentSkills, viewMode]);
- const handleOpenStore = useCallback(() => {
- createSkillStoreModal();
- }, []);
-
const handleSelect = (identifier: string, type: ToolDetailType) => {
setSelected({ identifier, type });
};
@@ -154,104 +93,14 @@ const Page = memo(() => {
<>
<NavHeader />
<div className={styles.root}>
- {/* Left panel */}
- <div className={styles.left}>
- <div className={styles.leftHeader}>
- {/* Connector / Skill tab switcher */}
- <div className={styles.tabs}>
- <span
- className={`${styles.tab} ${viewMode === 'connector' ? styles.tabActive : ''}`}
- onClick={() => setViewMode('connector')}
- >
- {t('skillView.connectors', 'Connectors')}
- </span>
- <span
- className={`${styles.tab} ${viewMode === 'skill' ? styles.tabActive : ''}`}
- onClick={() => setViewMode('skill')}
- >
- {t('skillView.skills', 'Skills')}
- </span>
- </div>
-
- <div style={{ display: 'flex', gap: 6 }} onClick={(e) => e.stopPropagation()}>
- <DropdownMenu
- nativeButton={false}
- placement="bottomRight"
- items={[
- {
- icon: <Icon icon={Link} />,
- key: 'importUrl',
- label: (
- <Flexbox gap={2}>
- <span>{t('tab.importFromUrl')}</span>
- <Text style={{ fontSize: 12 }} type="secondary">
- {t('tab.importFromUrl.desc')}
- </Text>
- </Flexbox>
- ),
- onClick: () => openImportFromUrlModal(),
- },
- {
- icon: <Icon icon={GithubIcon} />,
- key: 'importGithub',
- label: (
- <Flexbox gap={2}>
- <span>{t('tab.importFromGithub')}</span>
- <Text style={{ fontSize: 12 }} type="secondary">
- {t('tab.importFromGithub.desc')}
- </Text>
- </Flexbox>
- ),
- onClick: () => openImportFromGithubModal(),
- },
- {
- icon: <Icon icon={FileArchive} />,
- key: 'uploadZip',
- label: (
- <Flexbox gap={2}>
- <span>{t('tab.uploadZip')}</span>
- <Text style={{ fontSize: 12 }} type="secondary">
- {t('tab.uploadZip.desc')}
- </Text>
- </Flexbox>
- ),
- onClick: () => openUploadSkillModal(),
- },
- { type: 'divider' as const },
- {
- icon: <Icon icon={Grid2x2Plus} />,
- key: 'addConnector',
- label: (
- <Flexbox gap={2}>
- <span>
- {t('connector.add.title', {
- defaultValue: 'Add Custom Connector',
- ns: 'tool',
- })}
- </span>
- </Flexbox>
- ),
- onClick: () => setShowAddConnector(true),
- },
- ]}
- >
- <Button icon={Grid2x2Plus} size="small" />
- </DropdownMenu>
- <Button icon={<Icon icon={Store} />} size="small" onClick={handleOpenStore} />
- </div>
- </div>
-
- <div style={{ flex: 1, overflowY: 'auto', padding: '4px 8px' }}>
- <SkillList
- selectedIdentifier={selected?.identifier}
- viewMode={viewMode}
- onDeleteSelected={() => setSelected(null)}
- onSelect={handleSelect}
- />
- </div>
- </div>
+ <LeftPanel
+ selectedIdentifier={selected?.identifier}
+ viewMode={viewMode}
+ onDeleteSelected={() => setSelected(null)}
+ onSelect={handleSelect}
+ onViewModeChange={setViewMode}
+ />
- {/* Right: tool detail + permissions */}
{selected && (
<div className={styles.detail}>
<SkillDetail
@@ -262,7 +111,6 @@ const Page = memo(() => {
</div>
)}
</div>
- <CustomConnectorModal open={showAddConnector} onClose={() => setShowAddConnector(false)} />
</>
);
});
diff --git a/src/routes/(main)/settings/stats/features/components/StatsFormGroup.tsx b/src/routes/(main)/settings/stats/features/components/StatsFormGroup.tsx
index 68fce8c92aa..9e1190257ac 100644
--- a/src/routes/(main)/settings/stats/features/components/StatsFormGroup.tsx
+++ b/src/routes/(main)/settings/stats/features/components/StatsFormGroup.tsx
@@ -17,14 +17,14 @@ const StatsFormGroup = memo<StatsFormGroupProps>(
({ fontSize = 18, afterTitle, children, extra, title, ...rest }) => {
return (
<Block gap={16} variant={'borderless'} {...rest}>
- <Flexbox horizontal align={'center'} justify={'space-between'}>
- <Flexbox horizontal align={'center'} gap={8}>
+ <Flexbox horizontal align={'center'} gap={8} justify={'space-between'}>
+ <Flexbox horizontal align={'center'} flex={1} gap={8} style={{ minWidth: 0 }}>
<Text fontSize={fontSize} weight={500}>
{title}
</Text>
{afterTitle}
</Flexbox>
- <Flexbox horizontal align={'center'} gap={8}>
+ <Flexbox horizontal align={'center'} flex={'none'} gap={8}>
{extra}
</Flexbox>
</Flexbox>
diff --git a/src/routes/(main)/settings/stats/features/overview/ShareButton/ShareModal.tsx b/src/routes/(main)/settings/stats/features/overview/ShareButton/ShareModal.tsx
index 26dbcdd1c4b..0e3716e9ce5 100644
--- a/src/routes/(main)/settings/stats/features/overview/ShareButton/ShareModal.tsx
+++ b/src/routes/(main)/settings/stats/features/overview/ShareButton/ShareModal.tsx
@@ -1,7 +1,8 @@
'use client';
import { type FormItemProps, type FormModalProps } from '@lobehub/ui';
-import { FormModal, Segmented, Skeleton } from '@lobehub/ui';
+import { FormModal, Skeleton } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { createStaticStyles } from 'antd-style';
import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -58,11 +59,12 @@ const ShareModal = memo<FormModalProps & { mobile?: boolean }>(({ open, onCancel
minWidth: '100%',
},
{
- children: <Segmented options={imageTypeOptions} />,
+ children: <Tabs items={imageTypeOptions} />,
divider: false,
label: t('shareModal.imageType'),
minWidth: undefined,
name: 'imageType',
+ valuePropName: 'activeKey',
},
];
diff --git a/src/routes/(main)/settings/stats/features/usage/UsageTrends.tsx b/src/routes/(main)/settings/stats/features/usage/UsageTrends.tsx
index e3741fa6b6f..81c2425e1a5 100644
--- a/src/routes/(main)/settings/stats/features/usage/UsageTrends.tsx
+++ b/src/routes/(main)/settings/stats/features/usage/UsageTrends.tsx
@@ -1,5 +1,6 @@
import { type BarChartProps } from '@lobehub/charts';
-import { Segmented, Skeleton } from '@lobehub/ui';
+import { Skeleton } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -118,13 +119,14 @@ const UsageTrends = memo<UsageChartProps>(({ isLoading, data, groupBy, resolveUs
return (
<StatsFormGroup
extra={
- <Segmented
- value={type}
- options={[
- { label: t('usage.trends.spend'), value: ShowType.Spend },
- { label: t('usage.trends.tokens'), value: ShowType.Token },
+ <Tabs
+ activeKey={type}
+ style={{ width: 'auto' }}
+ items={[
+ { key: ShowType.Spend, label: t('usage.trends.spend') },
+ { key: ShowType.Token, label: t('usage.trends.tokens') },
]}
- onChange={(value) => setType(value as ShowType)}
+ onChange={(key) => setType(key as ShowType)}
/>
}
>
diff --git a/src/routes/(main)/settings/stats/features/visualization/AiHeatmaps.tsx b/src/routes/(main)/settings/stats/features/visualization/AiHeatmaps.tsx
index 5f18fd188e6..7ba97bafca4 100644
--- a/src/routes/(main)/settings/stats/features/visualization/AiHeatmaps.tsx
+++ b/src/routes/(main)/settings/stats/features/visualization/AiHeatmaps.tsx
@@ -1,6 +1,7 @@
import { type HeatmapsProps } from '@lobehub/charts';
import { Heatmaps } from '@lobehub/charts';
-import { Flexbox, Icon, Segmented, Tag } from '@lobehub/ui';
+import { Flexbox, Icon, Tag } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { cssVar } from 'antd-style';
import { CoinsIcon, FlameIcon, MessageSquareIcon } from 'lucide-react';
import { memo, useState } from 'react';
@@ -78,23 +79,23 @@ const AiHeatmaps = memo<
);
const typeSwitch = (
- <Segmented
+ <Tabs
+ activeKey={type}
size={'small'}
- value={type}
- variant={'outlined'}
- options={[
+ style={{ width: 'auto' }}
+ items={[
{
icon: <Icon icon={CoinsIcon} />,
+ key: HeatmapType.Tokens,
label: t('stats.tokens'),
- value: HeatmapType.Tokens,
},
{
icon: <Icon icon={MessageSquareIcon} />,
+ key: HeatmapType.Messages,
label: t('stats.messages'),
- value: HeatmapType.Messages,
},
]}
- onChange={(v) => setType(v as HeatmapType)}
+ onChange={(key) => setType(key as HeatmapType)}
/>
);
diff --git a/src/routes/(main)/settings/stats/index.tsx b/src/routes/(main)/settings/stats/index.tsx
index ddf4a6f9542..1514cb1e04a 100644
--- a/src/routes/(main)/settings/stats/index.tsx
+++ b/src/routes/(main)/settings/stats/index.tsx
@@ -1,6 +1,7 @@
'use client';
-import { FormGroup, Grid, Icon, Segmented } from '@lobehub/ui';
+import { FormGroup, Grid, Icon } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { ProviderIcon } from '@lobehub/ui/icons';
import { type DatePickerProps } from 'antd';
import { DatePicker, Divider } from 'antd';
@@ -116,32 +117,31 @@ const StatsSetting = memo<StatsSettingProps>(
extra={
<>
<DatePicker picker="month" value={dateRange} onChange={handleDateChange} />
- <Segmented
+ <Tabs
+ activeKey={groupBy}
style={{ marginLeft: 8 }}
- value={groupBy}
- variant={'outlined'}
- options={[
+ items={[
{
icon: <Icon icon={Brain} />,
+ key: GroupBy.Model,
label: t('usage.welcome.model'),
- value: GroupBy.Model,
},
{
icon: <Icon icon={ProviderIcon} />,
+ key: GroupBy.Provider,
label: t('usage.welcome.provider'),
- value: GroupBy.Provider,
},
...(enableUserDimension
? [
{
icon: <Icon icon={UserIcon} />,
+ key: GroupBy.User,
label: t('usage.welcome.user'),
- value: GroupBy.User,
},
]
: []),
]}
- onChange={(v) => setGroupBy(v as GroupBy)}
+ onChange={(key) => setGroupBy(key as GroupBy)}
/>
</>
}
diff --git a/src/routes/(mobile)/chat/settings/index.tsx b/src/routes/(mobile)/chat/settings/index.tsx
index 06dd0d0c9ae..d6eae8e7883 100644
--- a/src/routes/(mobile)/chat/settings/index.tsx
+++ b/src/routes/(mobile)/chat/settings/index.tsx
@@ -1,6 +1,6 @@
'use client';
-import { Tabs } from '@lobehub/ui';
+import { Tabs } from '@lobehub/ui/base-ui';
import { cssVar } from 'antd-style';
import { memo, useState } from 'react';
@@ -33,7 +33,6 @@ export default memo(() => {
return (
<MobileContentLayout header={<MobileHeader />}>
<Tabs
- compact
activeKey={tab}
items={cateItems as any}
style={{