From c5db091a9ae955a75035acdef3470589c98b38e6 Mon Sep 17 00:00:00 2001 From: Arvin Xu Date: Wed, 22 Jan 2025 22:07:57 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20move=20hooks?= =?UTF-8?q?=20and=20component=20(#5551)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/(workspace)/_layout/Desktop/ChatHeader/Tags.tsx | 2 +- src/app/(main)/chat/(workspace)/_layout/Mobile/TopicModal.tsx | 3 +-- src/app/(main)/chat/(workspace)/features/ShareButton/index.tsx | 3 +-- src/features/ChatInput/ActionBar/Tools/Dropdown.tsx | 2 +- .../chat/(workspace) => }/features/PluginTag/PluginStatus.tsx | 0 .../(main)/chat/(workspace) => }/features/PluginTag/index.tsx | 0 src/features/ShareModal/ShareImage/Preview.tsx | 2 +- .../chat/(workspace)/features => hooks}/useWorkspaceModal.tsx | 0 8 files changed, 5 insertions(+), 7 deletions(-) rename src/{app/(main)/chat/(workspace) => }/features/PluginTag/PluginStatus.tsx (100%) rename src/{app/(main)/chat/(workspace) => }/features/PluginTag/index.tsx (100%) rename src/{app/(main)/chat/(workspace)/features => hooks}/useWorkspaceModal.tsx (100%) diff --git a/src/app/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/Tags.tsx b/src/app/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/Tags.tsx index 0bbeb17fa72a..05de7c062cee 100644 --- a/src/app/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/Tags.tsx +++ b/src/app/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/Tags.tsx @@ -4,11 +4,11 @@ import { memo } from 'react'; import { Flexbox } from 'react-layout-kit'; import ModelSwitchPanel from '@/features/ModelSwitchPanel'; +import PluginTag from '@/features/PluginTag'; import { useModelSupportToolUse } from '@/hooks/useModelSupportToolUse'; import { useAgentStore } from '@/store/agent'; import { agentSelectors } from '@/store/agent/selectors'; -import PluginTag from '../../../features/PluginTag'; import KnowledgeTag from './KnowledgeTag'; const TitleTags = memo(() => { diff --git a/src/app/(main)/chat/(workspace)/_layout/Mobile/TopicModal.tsx b/src/app/(main)/chat/(workspace)/_layout/Mobile/TopicModal.tsx index 65fcf5a708f9..fcbd8a3f1a18 100644 --- a/src/app/(main)/chat/(workspace)/_layout/Mobile/TopicModal.tsx +++ b/src/app/(main)/chat/(workspace)/_layout/Mobile/TopicModal.tsx @@ -5,11 +5,10 @@ import { PropsWithChildren, memo } from 'react'; import { useTranslation } from 'react-i18next'; import { useFetchTopics } from '@/hooks/useFetchTopics'; +import { useWorkspaceModal } from '@/hooks/useWorkspaceModal'; import { useGlobalStore } from '@/store/global'; import { systemStatusSelectors } from '@/store/global/selectors'; -import { useWorkspaceModal } from '../../features/useWorkspaceModal'; - const Topics = memo(({ children }: PropsWithChildren) => { const [showAgentSettings, toggleConfig] = useGlobalStore((s) => [ systemStatusSelectors.mobileShowTopic(s), diff --git a/src/app/(main)/chat/(workspace)/features/ShareButton/index.tsx b/src/app/(main)/chat/(workspace)/features/ShareButton/index.tsx index 5ee4dedffc25..65b1b3d056b8 100644 --- a/src/app/(main)/chat/(workspace)/features/ShareButton/index.tsx +++ b/src/app/(main)/chat/(workspace)/features/ShareButton/index.tsx @@ -7,10 +7,9 @@ import { memo } from 'react'; import { useTranslation } from 'react-i18next'; import { DESKTOP_HEADER_ICON_SIZE, MOBILE_HEADER_ICON_SIZE } from '@/const/layoutTokens'; +import { useWorkspaceModal } from '@/hooks/useWorkspaceModal'; import { useChatStore } from '@/store/chat'; -import { useWorkspaceModal } from '../useWorkspaceModal'; - const ShareModal = dynamic(() => import('@/features/ShareModal')); interface ShareButtonProps { diff --git a/src/features/ChatInput/ActionBar/Tools/Dropdown.tsx b/src/features/ChatInput/ActionBar/Tools/Dropdown.tsx index a40335248dce..31971ed914ad 100644 --- a/src/features/ChatInput/ActionBar/Tools/Dropdown.tsx +++ b/src/features/ChatInput/ActionBar/Tools/Dropdown.tsx @@ -8,10 +8,10 @@ import { PropsWithChildren, memo } from 'react'; import { useTranslation } from 'react-i18next'; import { Flexbox } from 'react-layout-kit'; -import { useWorkspaceModal } from '@/app/(main)/chat/(workspace)/features/useWorkspaceModal'; import PluginStore from '@/features/PluginStore'; import { useCheckPluginsIsInstalled } from '@/hooks/useCheckPluginsIsInstalled'; import { useFetchInstalledPlugins } from '@/hooks/useFetchInstalledPlugins'; +import { useWorkspaceModal } from '@/hooks/useWorkspaceModal'; import { useAgentStore } from '@/store/agent'; import { agentSelectors } from '@/store/agent/selectors'; import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig'; diff --git a/src/app/(main)/chat/(workspace)/features/PluginTag/PluginStatus.tsx b/src/features/PluginTag/PluginStatus.tsx similarity index 100% rename from src/app/(main)/chat/(workspace)/features/PluginTag/PluginStatus.tsx rename to src/features/PluginTag/PluginStatus.tsx diff --git a/src/app/(main)/chat/(workspace)/features/PluginTag/index.tsx b/src/features/PluginTag/index.tsx similarity index 100% rename from src/app/(main)/chat/(workspace)/features/PluginTag/index.tsx rename to src/features/PluginTag/index.tsx diff --git a/src/features/ShareModal/ShareImage/Preview.tsx b/src/features/ShareModal/ShareImage/Preview.tsx index 070b9f74af12..ac41c98d31ea 100644 --- a/src/features/ShareModal/ShareImage/Preview.tsx +++ b/src/features/ShareModal/ShareImage/Preview.tsx @@ -4,8 +4,8 @@ import { memo } from 'react'; import { useTranslation } from 'react-i18next'; import { Flexbox } from 'react-layout-kit'; -import PluginTag from '@/app/(main)/chat/(workspace)/features/PluginTag'; import { ProductLogo } from '@/components/Branding'; +import PluginTag from '@/features/PluginTag'; import { useAgentStore } from '@/store/agent'; import { agentSelectors } from '@/store/agent/selectors'; import { useSessionStore } from '@/store/session'; diff --git a/src/app/(main)/chat/(workspace)/features/useWorkspaceModal.tsx b/src/hooks/useWorkspaceModal.tsx similarity index 100% rename from src/app/(main)/chat/(workspace)/features/useWorkspaceModal.tsx rename to src/hooks/useWorkspaceModal.tsx