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: type menu items with @lobehub/ui instead of antd (#20408)

Innei07147f5ca1b0
diff --git a/src/business/client/hooks/useAgentGroupTransferMenuItem.ts b/src/business/client/hooks/useAgentGroupTransferMenuItem.ts
index 104bf3ad0ec..edee3259b6d 100644
--- a/src/business/client/hooks/useAgentGroupTransferMenuItem.ts
+++ b/src/business/client/hooks/useAgentGroupTransferMenuItem.ts
@@ -1,4 +1,4 @@
-import type { ItemType } from 'antd/es/menu/interface';
+import type { ItemType } from '@lobehub/ui';
interface AgentGroupTransferMeta {
avatar?: string | null;
diff --git a/src/business/client/hooks/useAgentGroupTransferToMemberMenuItem.ts b/src/business/client/hooks/useAgentGroupTransferToMemberMenuItem.ts
index abf96d9c794..77ce3d714b8 100644
--- a/src/business/client/hooks/useAgentGroupTransferToMemberMenuItem.ts
+++ b/src/business/client/hooks/useAgentGroupTransferToMemberMenuItem.ts
@@ -1,4 +1,4 @@
-import { type ItemType } from 'antd/es/menu/interface';
+import type { ItemType } from '@lobehub/ui';
export interface AgentGroupTransferToMemberMeta {
avatar?: string | null;
diff --git a/src/business/client/hooks/useAgentTransferMenuItem.ts b/src/business/client/hooks/useAgentTransferMenuItem.ts
index a909209b076..bb92e4db057 100644
--- a/src/business/client/hooks/useAgentTransferMenuItem.ts
+++ b/src/business/client/hooks/useAgentTransferMenuItem.ts
@@ -1,5 +1,5 @@
import type { MetaData } from '@lobechat/types';
-import { type ItemType } from 'antd/es/menu/interface';
+import type { ItemType } from '@lobehub/ui';
export interface AgentTransferScope {
userId?: string | null;
diff --git a/src/business/client/hooks/useAgentTransferToMemberMenuItem.ts b/src/business/client/hooks/useAgentTransferToMemberMenuItem.ts
index d3c99f8db5e..387dfe62b9d 100644
--- a/src/business/client/hooks/useAgentTransferToMemberMenuItem.ts
+++ b/src/business/client/hooks/useAgentTransferToMemberMenuItem.ts
@@ -1,5 +1,5 @@
import type { MetaData } from '@lobechat/types';
-import { type ItemType } from 'antd/es/menu/interface';
+import type { ItemType } from '@lobehub/ui';
import type { AgentTransferScope } from './useAgentTransferMenuItem';
diff --git a/src/business/client/hooks/useBusinessAgentImportMenuItem.ts b/src/business/client/hooks/useBusinessAgentImportMenuItem.ts
index 50d62316d17..4f75d12ea6e 100644
--- a/src/business/client/hooks/useBusinessAgentImportMenuItem.ts
+++ b/src/business/client/hooks/useBusinessAgentImportMenuItem.ts
@@ -1,3 +1,3 @@
-import { type ItemType } from 'antd/es/menu/interface';
+import type { ItemType } from '@lobehub/ui';
export const useBusinessAgentImportMenuItem = (_agentId?: string): ItemType | null => null;
diff --git a/src/business/client/hooks/useDocumentTransferMenuItem.ts b/src/business/client/hooks/useDocumentTransferMenuItem.ts
index 449bf1e1210..d79c3fe8bf4 100644
--- a/src/business/client/hooks/useDocumentTransferMenuItem.ts
+++ b/src/business/client/hooks/useDocumentTransferMenuItem.ts
@@ -1,4 +1,4 @@
-import type { ItemType } from 'antd/es/menu/interface';
+import type { ItemType } from '@lobehub/ui';
export interface DocumentTransferMenuItemOptions {
defaultTargetVisibility?: 'private' | 'public';
diff --git a/src/business/client/hooks/useFileTransferMenuItem.ts b/src/business/client/hooks/useFileTransferMenuItem.ts
index 5e50e265d08..75e1f83b319 100644
--- a/src/business/client/hooks/useFileTransferMenuItem.ts
+++ b/src/business/client/hooks/useFileTransferMenuItem.ts
@@ -1,4 +1,4 @@
-import { type ItemType } from 'antd/es/menu/interface';
+import type { ItemType } from '@lobehub/ui';
export const useFileTransferMenuItem = (
_id?: string,
diff --git a/src/business/client/hooks/useKnowledgeBaseTransferMenuItem.ts b/src/business/client/hooks/useKnowledgeBaseTransferMenuItem.ts
index a28bb3fe955..f2570546c48 100644
--- a/src/business/client/hooks/useKnowledgeBaseTransferMenuItem.ts
+++ b/src/business/client/hooks/useKnowledgeBaseTransferMenuItem.ts
@@ -1,3 +1,3 @@
-import { type ItemType } from 'antd/es/menu/interface';
+import type { ItemType } from '@lobehub/ui';
export const useKnowledgeBaseTransferMenuItem = (_id?: string): ItemType[] | null => null;
diff --git a/src/business/client/hooks/useTaskTransferMenuItem.ts b/src/business/client/hooks/useTaskTransferMenuItem.ts
index 277d424247b..50be4ac89fc 100644
--- a/src/business/client/hooks/useTaskTransferMenuItem.ts
+++ b/src/business/client/hooks/useTaskTransferMenuItem.ts
@@ -1,3 +1,3 @@
-import { type ItemType } from 'antd/es/menu/interface';
+import type { ItemType } from '@lobehub/ui';
export const useTaskTransferMenuItem = (_taskId?: string): ItemType[] | null => null;
diff --git a/src/features/HomeSidebar/hooks/useCreateMenuItems.tsx b/src/features/HomeSidebar/hooks/useCreateMenuItems.tsx
index f758d2f8e5e..1b941552c17 100644
--- a/src/features/HomeSidebar/hooks/useCreateMenuItems.tsx
+++ b/src/features/HomeSidebar/hooks/useCreateMenuItems.tsx
@@ -1,8 +1,8 @@
import type { SFSymbol } from '@lobechat/electron-client-ipc';
+import type { ItemType } from '@lobehub/ui';
import { Flexbox, Icon } from '@lobehub/ui';
import { Text, toast } from '@lobehub/ui/base-ui';
import { GroupBotSquareIcon } from '@lobehub/ui/icons';
-import type { ItemType } from 'antd/es/menu/interface';
import {
BotIcon,
FileTextIcon,
diff --git a/src/features/HomeSidebar/hooks/useProjectMenuItems.tsx b/src/features/HomeSidebar/hooks/useProjectMenuItems.tsx
index 5dd0e8728fc..980b6cfabdd 100644
--- a/src/features/HomeSidebar/hooks/useProjectMenuItems.tsx
+++ b/src/features/HomeSidebar/hooks/useProjectMenuItems.tsx
@@ -1,5 +1,5 @@
+import type { ItemType } from '@lobehub/ui';
import { Icon } from '@lobehub/ui';
-import { type ItemType } from 'antd/es/menu/interface';
import { BoxIcon } from 'lucide-react';
import { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
diff --git a/src/features/HomeSidebar/hooks/useSessionGroupMenuItems.tsx b/src/features/HomeSidebar/hooks/useSessionGroupMenuItems.tsx
index 72316fbeb52..ebacbce498d 100644
--- a/src/features/HomeSidebar/hooks/useSessionGroupMenuItems.tsx
+++ b/src/features/HomeSidebar/hooks/useSessionGroupMenuItems.tsx
@@ -1,7 +1,7 @@
import type { SFSymbol } from '@lobechat/electron-client-ipc';
+import type { ItemType } from '@lobehub/ui';
import { Icon } from '@lobehub/ui';
import { confirmModal, toast } from '@lobehub/ui/base-ui';
-import { type ItemType } from 'antd/es/menu/interface';
import { FolderCogIcon, FolderPenIcon, Trash } from 'lucide-react';
import { useCallback, useState } from 'react';
import { useTranslation } from 'react-i18next';
diff --git a/src/features/Messenger/PushResourceModal/useSendToMessengerMenuItem.tsx b/src/features/Messenger/PushResourceModal/useSendToMessengerMenuItem.tsx
index 47b67930f0f..830df8b36d2 100644
--- a/src/features/Messenger/PushResourceModal/useSendToMessengerMenuItem.tsx
+++ b/src/features/Messenger/PushResourceModal/useSendToMessengerMenuItem.tsx
@@ -1,7 +1,7 @@
'use client';
+import type { ItemType } from '@lobehub/ui';
import { Flexbox, Icon } from '@lobehub/ui';
-import { type ItemType } from 'antd/es/menu/interface';
import { cssVar } from 'antd-style';
import { SendIcon, Settings2Icon } from 'lucide-react';
import { useTranslation } from 'react-i18next';
diff --git a/src/features/MobileHome/SessionListContent/List/Item/Actions.tsx b/src/features/MobileHome/SessionListContent/List/Item/Actions.tsx
index 837e740c203..b2115f0aa66 100644
--- a/src/features/MobileHome/SessionListContent/List/Item/Actions.tsx
+++ b/src/features/MobileHome/SessionListContent/List/Item/Actions.tsx
@@ -1,6 +1,6 @@
+import type { ItemType } from '@lobehub/ui';
import { DropdownMenu, Icon } from '@lobehub/ui';
import { ActionIcon, confirmModal, toast } from '@lobehub/ui/base-ui';
-import { type ItemType } from 'antd/es/menu/interface';
import isEqual from 'fast-deep-equal';
import {
Check,
diff --git a/src/features/ResourceManager/components/Explorer/ItemDropdown/DropdownMenu.tsx b/src/features/ResourceManager/components/Explorer/ItemDropdown/DropdownMenu.tsx
index dcd028ae4bb..82458430f51 100644
--- a/src/features/ResourceManager/components/Explorer/ItemDropdown/DropdownMenu.tsx
+++ b/src/features/ResourceManager/components/Explorer/ItemDropdown/DropdownMenu.tsx
@@ -1,6 +1,6 @@
+import type { ItemType } from '@lobehub/ui';
import { DropdownMenu as DropdownMenuUI } from '@lobehub/ui';
import { ActionIcon } from '@lobehub/ui/base-ui';
-import { type ItemType } from 'antd/es/menu/interface';
import { MoreHorizontalIcon } from 'lucide-react';
import { memo } from 'react';
diff --git a/src/features/ResourceManager/components/Explorer/ItemDropdown/useFileItemDropdown.tsx b/src/features/ResourceManager/components/Explorer/ItemDropdown/useFileItemDropdown.tsx
index 6784ba28888..d041c81c2e7 100644
--- a/src/features/ResourceManager/components/Explorer/ItemDropdown/useFileItemDropdown.tsx
+++ b/src/features/ResourceManager/components/Explorer/ItemDropdown/useFileItemDropdown.tsx
@@ -1,8 +1,8 @@
import { CUSTOM_FOLDER_FILE_TYPE, DERIVED_DOCUMENT_SOURCE_TYPE } from '@lobechat/const';
import type { SFSymbol } from '@lobechat/electron-client-ipc';
+import type { ItemType } from '@lobehub/ui';
import { copyToClipboard, Icon } from '@lobehub/ui';
import { confirmModal, toast } from '@lobehub/ui/base-ui';
-import { type ItemType } from 'antd/es/menu/interface';
import {
BookMinusIcon,
BookPlusIcon,
diff --git a/src/features/ResourceManager/components/Explorer/ListView/ListItem/FileListItemActions.test.ts b/src/features/ResourceManager/components/Explorer/ListView/ListItem/FileListItemActions.test.ts
index b75b2d547b4..db2b501b066 100644
--- a/src/features/ResourceManager/components/Explorer/ListView/ListItem/FileListItemActions.test.ts
+++ b/src/features/ResourceManager/components/Explorer/ListView/ListItem/FileListItemActions.test.ts
@@ -1,5 +1,5 @@
+import type { ItemType } from '@lobehub/ui';
import { fireEvent, render, screen } from '@testing-library/react';
-import type { ItemType } from 'antd/es/menu/interface';
import React from 'react';
import { beforeEach, describe, expect, it, vi } from 'vitest';
diff --git a/src/features/ResourceManager/components/Explorer/ListView/ListItem/FileListItemActions.tsx b/src/features/ResourceManager/components/Explorer/ListView/ListItem/FileListItemActions.tsx
index 0e2ca245bb2..b921f2f9085 100644
--- a/src/features/ResourceManager/components/Explorer/ListView/ListItem/FileListItemActions.tsx
+++ b/src/features/ResourceManager/components/Explorer/ListView/ListItem/FileListItemActions.tsx
@@ -1,7 +1,7 @@
import type { IAsyncTaskError } from '@lobechat/types';
+import type { ItemType } from '@lobehub/ui';
import { Flexbox, stopPropagation } from '@lobehub/ui';
import { Button } from '@lobehub/ui/base-ui';
-import type { ItemType } from 'antd/es/menu/interface';
import { isNull } from 'es-toolkit/compat';
import { FileBoxIcon } from 'lucide-react';
import { useMemo } from 'react';
diff --git a/src/features/ResourceManager/components/LibraryHierarchy/HierarchyNodeMenuButton.tsx b/src/features/ResourceManager/components/LibraryHierarchy/HierarchyNodeMenuButton.tsx
index bfbca2c9497..2e61a8eab5a 100644
--- a/src/features/ResourceManager/components/LibraryHierarchy/HierarchyNodeMenuButton.tsx
+++ b/src/features/ResourceManager/components/LibraryHierarchy/HierarchyNodeMenuButton.tsx
@@ -1,8 +1,8 @@
'use client';
+import type { ItemType } from '@lobehub/ui';
import { DropdownMenu, stopPropagation } from '@lobehub/ui';
import { ActionIcon } from '@lobehub/ui/base-ui';
-import type { ItemType } from 'antd/es/menu/interface';
import { MoreHorizontalIcon } from 'lucide-react';
import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
diff --git a/src/features/Settings/provider/features/ModelList/DisabledModels.tsx b/src/features/Settings/provider/features/ModelList/DisabledModels.tsx
index 9ffba58c4f3..dabf4327d6a 100644
--- a/src/features/Settings/provider/features/ModelList/DisabledModels.tsx
+++ b/src/features/Settings/provider/features/ModelList/DisabledModels.tsx
@@ -1,6 +1,6 @@
+import type { ItemType } from '@lobehub/ui';
import { DropdownMenu, Flexbox, Icon, TooltipGroup } from '@lobehub/ui';
import { ActionIcon, Text } from '@lobehub/ui/base-ui';
-import { type ItemType } from 'antd/es/menu/interface';
import isEqual from 'fast-deep-equal';
import { ArrowDownUpIcon, LucideCheck } from 'lucide-react';
import { type AiProviderModelListItem } from 'model-bank';
diff --git a/src/libs/contextMenu/types.ts b/src/libs/contextMenu/types.ts
index 7144e20ac65..89397f50959 100644
--- a/src/libs/contextMenu/types.ts
+++ b/src/libs/contextMenu/types.ts
@@ -1,6 +1,5 @@
import type { SFSymbol } from '@lobechat/electron-client-ipc';
-import type { ContextMenuItem, showContextMenu as showWebContextMenu } from '@lobehub/ui';
-import type { ItemType } from 'antd/es/menu/interface';
+import type { ContextMenuItem, ItemType, showContextMenu as showWebContextMenu } from '@lobehub/ui';
type NativeMenuIcon = {
sfSymbol?: SFSymbol;