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(routes): move six route domains into src/features (#17964)

Innei8de42d5c37af
diff --git a/eslint.config.mjs b/eslint.config.mjs
index 9b6de3b3d94..ff088adfdbe 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -228,11 +228,39 @@ export default eslint(
},
},
{
- files: ['src/features/Home/**/*.{ts,tsx}', 'src/routes/(main)/home/**/*.{ts,tsx}'],
- ignores: [
- 'src/routes/(main)/home/_layout/hooks/useCreateModal.tsx',
- 'src/features/Home/InputArea/EditorInput.tsx',
+ files: [
+ 'src/features/Home/**/*.{ts,tsx}',
+ 'src/features/HomeLayout/**/*.{ts,tsx}',
+ 'src/routes/(main)/home/**/*.{ts,tsx}',
],
+ ignores: ['src/features/Home/InputArea/EditorInput.tsx'],
+ rules: {
+ 'no-restricted-imports': createRestrictedImportRule({
+ paths: [
+ {
+ message:
+ 'Home cold-path modules must use stable Conversation subpaths instead of the root barrel that exports ChatInput.',
+ name: '@/features/Conversation',
+ },
+ ],
+ patterns: [
+ {
+ message:
+ 'Home cold-path modules must not statically import ChatInput. Load an isolated editor entry with import().',
+ regex:
+ '^@/features/ChatInput(?:$|/(?!(?:store/initialState|utils/contextSelections)$).+)',
+ },
+ ],
+ }),
+ },
+ },
+ {
+ // The home sidebar tree carries both sets of constraints: it is a shell tree
+ // rendered outside TabHost, and it is also a home cold path. Flat config
+ // replaces `no-restricted-imports` rather than merging it, so the shell paths
+ // have to be repeated here instead of relying on the shell block above.
+ files: ['src/features/HomeSidebar/**/*.{ts,tsx}'],
+ ignores: ['src/features/HomeSidebar/hooks/useCreateModal.tsx'],
rules: {
'no-restricted-imports': createRestrictedImportRule({
paths: [
@@ -241,6 +269,7 @@ export default eslint(
'Home cold-path modules must use stable Conversation subpaths instead of the root barrel that exports ChatInput.',
name: '@/features/Conversation',
},
+ ...shellRouterRestrictedPaths,
],
patterns: [
{
diff --git a/src/features/AgentSidebar/Header/Agent/SwitchPanel.tsx b/src/features/AgentSidebar/Header/Agent/SwitchPanel.tsx
index b74719f9bff..d52e0bb5e7b 100644
--- a/src/features/AgentSidebar/Header/Agent/SwitchPanel.tsx
+++ b/src/features/AgentSidebar/Header/Agent/SwitchPanel.tsx
@@ -5,12 +5,12 @@ import { memo, Suspense, useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';
+import AgentListContent from '@/features/HomeSidebar/Body/Agent/List/AgentListContent';
+import { AgentModalProvider } from '@/features/HomeSidebar/Body/Agent/ModalProvider';
+import PrivateList from '@/features/HomeSidebar/Body/Private/List';
import SkeletonList from '@/features/NavPanel/components/SkeletonList';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import { useFetchAgentList } from '@/hooks/useFetchAgentList';
-import AgentListContent from '@/routes/(main)/home/_layout/Body/Agent/List/AgentListContent';
-import { AgentModalProvider } from '@/routes/(main)/home/_layout/Body/Agent/ModalProvider';
-import PrivateList from '@/routes/(main)/home/_layout/Body/Private/List';
import { useHomeStore } from '@/store/home';
import { homeAgentListSelectors } from '@/store/home/selectors';
diff --git a/src/features/AgentTaskManager/AgentSelectorAction.test.tsx b/src/features/AgentTaskManager/AgentSelectorAction.test.tsx
index d88b9bbcfab..ed1490e6686 100644
--- a/src/features/AgentTaskManager/AgentSelectorAction.test.tsx
+++ b/src/features/AgentTaskManager/AgentSelectorAction.test.tsx
@@ -113,11 +113,11 @@ vi.mock('@/hooks/useFetchAgentList', () => ({
useFetchAgentList: () => mocks.fetchAgentList(),
}));
-vi.mock('@/routes/(main)/home/_layout/Body/Agent/List/AgentItem/Avatar', () => ({
+vi.mock('@/features/HomeSidebar/Body/Agent/List/AgentItem/Avatar', () => ({
default: ({ avatar }: { avatar?: string }) => <span data-avatar={avatar} data-testid="avatar" />,
}));
-vi.mock('@/routes/(main)/home/_layout/Body/Agent/ModalProvider', () => ({
+vi.mock('@/features/HomeSidebar/Body/Agent/ModalProvider', () => ({
AgentModalProvider: ({ children }: { children: ReactNode }) => <>{children}</>,
}));
diff --git a/src/features/AgentTaskManager/AgentSelectorAction.tsx b/src/features/AgentTaskManager/AgentSelectorAction.tsx
index 8103833fc90..eb534172573 100644
--- a/src/features/AgentTaskManager/AgentSelectorAction.tsx
+++ b/src/features/AgentTaskManager/AgentSelectorAction.tsx
@@ -8,11 +8,11 @@ import { useTranslation } from 'react-i18next';
import { type SidebarAgentItem } from '@/database/repositories/home';
import { conversationSelectors, useConversationStore } from '@/features/Conversation';
+import AgentAvatar from '@/features/HomeSidebar/Body/Agent/List/AgentItem/Avatar';
+import { AgentModalProvider } from '@/features/HomeSidebar/Body/Agent/ModalProvider';
import SkeletonList from '@/features/NavPanel/components/SkeletonList';
import AgentItem from '@/features/PageEditor/Copilot/AgentSelector/AgentItem';
import { useFetchAgentList } from '@/hooks/useFetchAgentList';
-import AgentAvatar from '@/routes/(main)/home/_layout/Body/Agent/List/AgentItem/Avatar';
-import { AgentModalProvider } from '@/routes/(main)/home/_layout/Body/Agent/ModalProvider';
import { useAgentStore } from '@/store/agent';
import { builtinAgentSelectors } from '@/store/agent/selectors';
import { useHomeStore } from '@/store/home';
diff --git a/src/features/AgentViewAll/AgentViewAllPage.tsx b/src/features/AgentViewAll/AgentViewAllPage.tsx
index 8a3afa97e96..d2abb14a5c1 100644
--- a/src/features/AgentViewAll/AgentViewAllPage.tsx
+++ b/src/features/AgentViewAll/AgentViewAllPage.tsx
@@ -14,16 +14,16 @@ import { useSearchParams } from 'react-router';
import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';
import { useWorkspaceMembers } from '@/business/client/hooks/useWorkspaceMembers';
+import { useKeepSidebarGroupsListed } from '@/features/HomeSidebar/Body/Agent/List/useAgentList';
+import { AgentModalProvider } from '@/features/HomeSidebar/Body/Agent/ModalProvider';
+import { useSidebarItemVisibility } from '@/features/HomeSidebar/Body/Agent/useSidebarItemVisibility';
+import { useCreateMenuItems } from '@/features/HomeSidebar/hooks';
import NavHeader from '@/features/NavHeader';
import SkeletonList from '@/features/NavPanel/components/SkeletonList';
import WideScreenContainer from '@/features/WideScreenContainer';
import { useFetchAgentLabels } from '@/hooks/useFetchAgentLabels';
import { useFetchAgentList } from '@/hooks/useFetchAgentList';
import { usePermission } from '@/hooks/usePermission';
-import { useKeepSidebarGroupsListed } from '@/routes/(main)/home/_layout/Body/Agent/List/useAgentList';
-import { AgentModalProvider } from '@/routes/(main)/home/_layout/Body/Agent/ModalProvider';
-import { useSidebarItemVisibility } from '@/routes/(main)/home/_layout/Body/Agent/useSidebarItemVisibility';
-import { useCreateMenuItems } from '@/routes/(main)/home/_layout/hooks';
import { useGlobalStore } from '@/store/global';
import { systemStatusSelectors } from '@/store/global/selectors';
import { useHomeStore } from '@/store/home';
diff --git a/src/features/AgentViewAll/ItemActions.tsx b/src/features/AgentViewAll/ItemActions.tsx
index 9a646997d49..ded12e5a5b2 100644
--- a/src/features/AgentViewAll/ItemActions.tsx
+++ b/src/features/AgentViewAll/ItemActions.tsx
@@ -8,9 +8,9 @@ import { EllipsisIcon, EyeIcon, EyeOffIcon } from 'lucide-react';
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
-import { useGroupDropdownMenu } from '@/routes/(main)/home/_layout/Body/Agent/List/AgentGroupItem/useDropdownMenu';
-import { useAgentDropdownMenu } from '@/routes/(main)/home/_layout/Body/Agent/List/AgentItem/useDropdownMenu';
-import { useAgentModal } from '@/routes/(main)/home/_layout/Body/Agent/ModalProvider';
+import { useGroupDropdownMenu } from '@/features/HomeSidebar/Body/Agent/List/AgentGroupItem/useDropdownMenu';
+import { useAgentDropdownMenu } from '@/features/HomeSidebar/Body/Agent/List/AgentItem/useDropdownMenu';
+import { useAgentModal } from '@/features/HomeSidebar/Body/Agent/ModalProvider';
type MenuItems = NonNullable<MenuProps['items']>;
diff --git a/src/features/CommandMenu/useCommandMenu.ts b/src/features/CommandMenu/useCommandMenu.ts
index 5cf1ca34c5d..0d696e7e2e9 100644
--- a/src/features/CommandMenu/useCommandMenu.ts
+++ b/src/features/CommandMenu/useCommandMenu.ts
@@ -5,12 +5,12 @@ import useSWR from 'swr';
import { isDesktop } from '@/const/version';
import { type SearchResult } from '@/database/repositories/search';
+import { useCreateMenuItems } from '@/features/HomeSidebar/hooks';
import { useCreateNewModal } from '@/features/LibraryModal';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import { usePermission } from '@/hooks/usePermission';
import { useGroupWizard } from '@/layout/GlobalProvider/GroupWizardProvider';
import { lambdaClient } from '@/libs/trpc/client';
-import { useCreateMenuItems } from '@/routes/(main)/home/_layout/hooks';
import { electronSystemService } from '@/services/electron/system';
import { useAgentStore } from '@/store/agent';
import { builtinAgentSelectors } from '@/store/agent/selectors/builtinAgentSelectors';
diff --git a/src/features/Conversation/MessageForward/ForwardModal.tsx b/src/features/Conversation/MessageForward/ForwardModal.tsx
index 7bc8cbe2950..c00f9e7e69e 100644
--- a/src/features/Conversation/MessageForward/ForwardModal.tsx
+++ b/src/features/Conversation/MessageForward/ForwardModal.tsx
@@ -9,8 +9,8 @@ import { t as translate } from 'i18next';
import { memo, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import AgentAvatar from '@/features/HomeSidebar/Body/Agent/List/AgentItem/Avatar';
import { useFetchAgentList } from '@/hooks/useFetchAgentList';
-import AgentAvatar from '@/routes/(main)/home/_layout/Body/Agent/List/AgentItem/Avatar';
import { useHomeStore } from '@/store/home';
import { homeAgentListSelectors } from '@/store/home/selectors';
diff --git a/src/features/Conversation/MessageForward/TopicForwardModal/Content.tsx b/src/features/Conversation/MessageForward/TopicForwardModal/Content.tsx
index 48461c97242..87d50f82cce 100644
--- a/src/features/Conversation/MessageForward/TopicForwardModal/Content.tsx
+++ b/src/features/Conversation/MessageForward/TopicForwardModal/Content.tsx
@@ -6,8 +6,8 @@ import { createStaticStyles, cssVar, cx } from 'antd-style';
import { useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import AgentAvatar from '@/features/HomeSidebar/Body/Agent/List/AgentItem/Avatar';
import { useFetchAgentList } from '@/hooks/useFetchAgentList';
-import AgentAvatar from '@/routes/(main)/home/_layout/Body/Agent/List/AgentItem/Avatar';
import { useHomeStore } from '@/store/home';
import { homeAgentListSelectors } from '@/store/home/selectors';
diff --git a/src/features/DesktopFileMenuBridge/index.tsx b/src/features/DesktopFileMenuBridge/index.tsx
index 5e6569dc042..02459eab511 100644
--- a/src/features/DesktopFileMenuBridge/index.tsx
+++ b/src/features/DesktopFileMenuBridge/index.tsx
@@ -4,8 +4,8 @@ import { AGENT_CHAT_URL } from '@lobechat/const';
import { useWatchBroadcast } from '@lobechat/electron-client-ipc';
import { useCallback } from 'react';
+import { useCreateMenuItems } from '@/features/HomeSidebar/hooks/useCreateMenuItems';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-import { useCreateMenuItems } from '@/routes/(main)/home/_layout/hooks/useCreateMenuItems';
import { useAgentStore } from '@/store/agent';
import { builtinAgentSelectors } from '@/store/agent/selectors';
import { useChatStore } from '@/store/chat';
diff --git a/src/routes/(desktop)/desktop-onboarding/_layout/index.tsx b/src/features/DesktopOnboarding/Layout/index.tsx
similarity index 100%
rename from src/routes/(desktop)/desktop-onboarding/_layout/index.tsx
rename to src/features/DesktopOnboarding/Layout/index.tsx
diff --git a/src/routes/(desktop)/desktop-onboarding/_layout/style.ts b/src/features/DesktopOnboarding/Layout/style.ts
similarity index 68%
rename from src/routes/(desktop)/desktop-onboarding/_layout/style.ts
rename to src/features/DesktopOnboarding/Layout/style.ts
index ca867a507cc..f7375f39a63 100644
--- a/src/routes/(desktop)/desktop-onboarding/_layout/style.ts
+++ b/src/features/DesktopOnboarding/Layout/style.ts
@@ -15,9 +15,11 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({
overflow: hidden;
border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${!isMacOSWithLargeWindowBorders()
- ? cssVar.borderRadius
- : `${cssVar.borderRadius} 12px ${cssVar.borderRadius} 12px`};
+ border-radius: ${
+ !isMacOSWithLargeWindowBorders()
+ ? cssVar.borderRadius
+ : `${cssVar.borderRadius} 12px ${cssVar.borderRadius} 12px`
+ };
background: ${cssVar.colorBgContainer};
`,
@@ -29,9 +31,11 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({
overflow: hidden;
border: 1px solid ${cssVar.colorBorder};
- border-radius: ${!isMacOSWithLargeWindowBorders()
- ? cssVar.borderRadius
- : `${cssVar.borderRadius} 12px ${cssVar.borderRadius} 12px`};
+ border-radius: ${
+ !isMacOSWithLargeWindowBorders()
+ ? cssVar.borderRadius
+ : `${cssVar.borderRadius} 12px ${cssVar.borderRadius} 12px`
+ };
background: ${cssVar.colorBgContainer};
`,
diff --git a/src/routes/(desktop)/desktop-onboarding/components/LobeMessage.tsx b/src/features/DesktopOnboarding/components/LobeMessage.tsx
similarity index 100%
rename from src/routes/(desktop)/desktop-onboarding/components/LobeMessage.tsx
rename to src/features/DesktopOnboarding/components/LobeMessage.tsx
diff --git a/src/routes/(desktop)/desktop-onboarding/components/OnboardingFooterActions.tsx b/src/features/DesktopOnboarding/components/OnboardingFooterActions.tsx
similarity index 100%
rename from src/routes/(desktop)/desktop-onboarding/components/OnboardingFooterActions.tsx
rename to src/features/DesktopOnboarding/components/OnboardingFooterActions.tsx
diff --git a/src/routes/(desktop)/desktop-onboarding/flow.test.ts b/src/features/DesktopOnboarding/flow.test.ts
similarity index 100%
rename from src/routes/(desktop)/desktop-onboarding/flow.test.ts
rename to src/features/DesktopOnboarding/flow.test.ts
diff --git a/src/routes/(desktop)/desktop-onboarding/flow.ts b/src/features/DesktopOnboarding/flow.ts
similarity index 100%
rename from src/routes/(desktop)/desktop-onboarding/flow.ts
rename to src/features/DesktopOnboarding/flow.ts
diff --git a/src/features/DesktopOnboarding/index.tsx b/src/features/DesktopOnboarding/index.tsx
new file mode 100644
index 00000000000..89622f6e433
--- /dev/null
+++ b/src/features/DesktopOnboarding/index.tsx
@@ -0,0 +1,245 @@
+'use client';
+
+import { APP_WINDOW_MIN_SIZE } from '@lobechat/desktop-bridge';
+import { Flexbox, Skeleton } from '@lobehub/ui';
+import { memo, Suspense, useCallback, useEffect, useState } from 'react';
+import { useSearchParams } from 'react-router';
+
+import Loading from '@/components/Loading/BrandTextLoading';
+import { remoteServerService } from '@/services/electron/remoteServer';
+import { electronSystemService } from '@/services/electron/system';
+
+import { resolveNextScreen, resolvePreviousScreen } from './flow';
+import OnboardingContainer from './Layout';
+import { resolveInitialScreen } from './resolveInitialScreen';
+import DataModeStep from './steps/DataModeStep';
+import LoginStep from './steps/LoginStep';
+import PermissionsStep from './steps/PermissionsStep';
+import WelcomeStep from './steps/WelcomeStep';
+import {
+ clearDesktopOnboardingScreen,
+ getDesktopOnboardingEverCompleted,
+ getDesktopOnboardingScreen,
+ setDesktopOnboardingCompleted,
+ setDesktopOnboardingEverCompleted,
+ setDesktopOnboardingScreen,
+} from './storage';
+import { DesktopOnboardingScreen, isDesktopOnboardingScreen } from './types';
+
+const DesktopOnboardingPage = memo(() => {
+ const [searchParams, setSearchParams] = useSearchParams();
+ const [isMac, setIsMac] = useState(true);
+ const [isLoading, setIsLoading] = useState(true);
+ const [everCompleted] = useState(getDesktopOnboardingEverCompleted);
+
+ const resolveScreenForPlatform = useCallback(
+ (screen: DesktopOnboardingScreen) =>
+ resolveInitialScreen({
+ everCompleted,
+ isMac,
+ requested: screen,
+ saved: null,
+ }),
+ [everCompleted, isMac],
+ );
+
+ const getRequestedScreenFromUrl = useCallback((): DesktopOnboardingScreen | null => {
+ const screenParam = searchParams.get('screen');
+ if (isDesktopOnboardingScreen(screenParam)) return screenParam;
+
+ return null;
+ }, [searchParams]);
+
+ const [currentScreen, setCurrentScreen] = useState<DesktopOnboardingScreen>(
+ DesktopOnboardingScreen.Welcome,
+ );
+
+ useEffect(() => {
+ electronSystemService.setDesktopOnboardingCompleted(false).catch((error) => {
+ console.error('[DesktopOnboarding] Failed to mark onboarding as in progress:', error);
+ });
+ }, []);
+
+ useEffect(() => {
+ if (isLoading) return;
+
+ const initial = resolveInitialScreen({
+ everCompleted,
+ isMac,
+ requested: getRequestedScreenFromUrl(),
+ saved: getDesktopOnboardingScreen(),
+ });
+
+ setCurrentScreen(initial);
+
+ // Canonicalize URL to `?screen=...`
+ const currentUrlScreen = searchParams.get('screen');
+ if (currentUrlScreen !== initial) {
+ setSearchParams({ screen: initial });
+ }
+ }, [everCompleted, getRequestedScreenFromUrl, isLoading, isMac, searchParams, setSearchParams]);
+
+ // Persist current screen to localStorage.
+ useEffect(() => {
+ if (isLoading) return;
+ setDesktopOnboardingScreen(currentScreen);
+ }, [currentScreen, isLoading]);
+
+ // Set window size and resizability
+ useEffect(() => {
+ const minimumSize = { height: 900, width: 1200 };
+
+ const applyWindowSettings = async () => {
+ try {
+ await electronSystemService.setWindowMinimumSize(minimumSize);
+ } catch (error) {
+ console.error('[DesktopOnboarding] Failed to apply window settings:', error);
+ }
+ };
+
+ applyWindowSettings();
+
+ return () => {
+ // Restore to app-level default minimum size preset
+ electronSystemService.setWindowMinimumSize(APP_WINDOW_MIN_SIZE).catch((error) => {
+ console.error('[DesktopOnboarding] Failed to restore window settings:', error);
+ });
+ };
+ }, []);
+
+ // Detect platform: skip permissions page on non-macOS
+ useEffect(() => {
+ let mounted = true;
+ const detectPlatform = async () => {
+ try {
+ const state = await electronSystemService.getAppState();
+ if (!mounted) return;
+ setIsMac(state.platform === 'darwin');
+ } catch {
+ // Fallback: keep default (true)
+ } finally {
+ setIsLoading(false);
+ }
+ };
+ void detectPlatform();
+ return () => {
+ mounted = false;
+ };
+ }, []);
+
+ // Listen URL changes: allow deep-linking between screens.
+ useEffect(() => {
+ if (isLoading) return;
+ const requested = getRequestedScreenFromUrl();
+ if (!requested) return;
+ const resolved = resolveScreenForPlatform(requested);
+ if (resolved !== currentScreen) setCurrentScreen(resolved);
+ }, [currentScreen, getRequestedScreenFromUrl, isLoading, resolveScreenForPlatform]);
+
+ const completeOnboarding = useCallback(async () => {
+ setDesktopOnboardingCompleted();
+ setDesktopOnboardingEverCompleted();
+ clearDesktopOnboardingScreen();
+
+ try {
+ await Promise.all([
+ electronSystemService.setDesktopOnboardingCompleted(true),
+ electronSystemService.setWindowMinimumSize(APP_WINDOW_MIN_SIZE),
+ ]);
+ } catch (error) {
+ console.error('[DesktopOnboarding] Failed to finalize onboarding:', error);
+ }
+
+ // Use hard reload instead of SPA navigation to ensure the app boots with the new desktop state.
+ window.location.replace('/');
+ }, []);
+
+ const goToNextStep = useCallback(async () => {
+ let isAuthenticated = false;
+ try {
+ isAuthenticated = await remoteServerService.isRemoteServerConfigured();
+ } catch (error) {
+ console.error('[DesktopOnboarding] Failed to verify authentication:', error);
+ }
+
+ const next = resolveNextScreen({
+ current: currentScreen,
+ everCompleted,
+ isAuthenticated,
+ isMac,
+ });
+
+ if (!next) {
+ await completeOnboarding();
+ return;
+ }
+
+ setSearchParams({ screen: next });
+ setCurrentScreen(next);
+ }, [completeOnboarding, currentScreen, everCompleted, isMac, setSearchParams]);
+
+ const goToPreviousStep = useCallback(() => {
+ setCurrentScreen((prev) => {
+ const prevScreen = resolvePreviousScreen({ current: prev, isMac });
+ setSearchParams({ screen: prevScreen });
+ return prevScreen;
+ });
+ }, [isMac, setSearchParams]);
+
+ if (isLoading) {
+ return <Loading debugId="DesktopOnboarding" />;
+ }
+
+ const renderStep = () => {
+ switch (currentScreen) {
+ case DesktopOnboardingScreen.Welcome: {
+ return <WelcomeStep onNext={goToNextStep} />;
+ }
+ case DesktopOnboardingScreen.Permissions: {
+ // macOS-only screen; fallback to DataMode if platform doesn't support.
+ if (!isMac) {
+ setCurrentScreen(DesktopOnboardingScreen.DataMode);
+ return null;
+ }
+ return <PermissionsStep onBack={goToPreviousStep} onNext={goToNextStep} />;
+ }
+ case DesktopOnboardingScreen.DataMode: {
+ return <DataModeStep onBack={goToPreviousStep} onNext={goToNextStep} />;
+ }
+ case DesktopOnboardingScreen.Login: {
+ return <LoginStep onBack={goToPreviousStep} onNext={goToNextStep} />;
+ }
+ default: {
+ return null;
+ }
+ }
+ };
+
+ return (
+ <OnboardingContainer>
+ <Flexbox gap={24} style={{ maxWidth: 560, minHeight: '100%', width: '100%' }}>
+ <Suspense
+ fallback={
+ <Flexbox gap={8}>
+ <Skeleton.Avatar size={48} />
+ <Skeleton
+ paragraph={{
+ rows: 8,
+ }}
+ title={{
+ fontSize: 24,
+ }}
+ />
+ </Flexbox>
+ }
+ >
+ {renderStep()}
+ </Suspense>
+ </Flexbox>
+ </OnboardingContainer>
+ );
+});
+
+DesktopOnboardingPage.displayName = 'DesktopOnboardingPage';
+
+export default DesktopOnboardingPage;
diff --git a/src/routes/(desktop)/desktop-onboarding/navigation.ts b/src/features/DesktopOnboarding/navigation.ts
similarity index 100%
rename from src/routes/(desktop)/desktop-onboarding/navigation.ts
rename to src/features/DesktopOnboarding/navigation.ts
diff --git a/src/routes/(desktop)/desktop-onboarding/resolveInitialScreen.test.ts b/src/features/DesktopOnboarding/resolveInitialScreen.test.ts
similarity index 100%
rename from src/routes/(desktop)/desktop-onboarding/resolveInitialScreen.test.ts
rename to src/features/DesktopOnboarding/resolveInitialScreen.test.ts
diff --git a/src/routes/(desktop)/desktop-onboarding/resolveInitialScreen.ts b/src/features/DesktopOnboarding/resolveInitialScreen.ts
similarity index 100%
rename from src/routes/(desktop)/desktop-onboarding/resolveInitialScreen.ts
rename to src/features/DesktopOnboarding/resolveInitialScreen.ts
diff --git a/src/routes/(desktop)/desktop-onboarding/features/DataModeStep.tsx b/src/features/DesktopOnboarding/steps/DataModeStep.tsx
similarity index 100%
rename from src/routes/(desktop)/desktop-onboarding/features/DataModeStep.tsx
rename to src/features/DesktopOnboarding/steps/DataModeStep.tsx
diff --git a/src/routes/(desktop)/desktop-onboarding/features/LoginStep.test.tsx b/src/features/DesktopOnboarding/steps/LoginStep.test.tsx
similarity index 100%
rename from src/routes/(desktop)/desktop-onboarding/features/LoginStep.test.tsx
rename to src/features/DesktopOnboarding/steps/LoginStep.test.tsx
diff --git a/src/routes/(desktop)/desktop-onboarding/features/LoginStep.tsx b/src/features/DesktopOnboarding/steps/LoginStep.tsx
similarity index 100%
rename from src/routes/(desktop)/desktop-onboarding/features/LoginStep.tsx
rename to src/features/DesktopOnboarding/steps/LoginStep.tsx
diff --git a/src/routes/(desktop)/desktop-onboarding/features/PermissionsStep.tsx b/src/features/DesktopOnboarding/steps/PermissionsStep.tsx
similarity index 100%
rename from src/routes/(desktop)/desktop-onboarding/features/PermissionsStep.tsx
rename to src/features/DesktopOnboarding/steps/PermissionsStep.tsx
diff --git a/src/routes/(desktop)/desktop-onboarding/features/WelcomeStep.tsx b/src/features/DesktopOnboarding/steps/WelcomeStep.tsx
similarity index 100%
rename from src/routes/(desktop)/desktop-onboarding/features/WelcomeStep.tsx
rename to src/features/DesktopOnboarding/steps/WelcomeStep.tsx
diff --git a/src/routes/(desktop)/desktop-onboarding/storage.test.ts b/src/features/DesktopOnboarding/storage.test.ts
similarity index 100%
rename from src/routes/(desktop)/desktop-onboarding/storage.test.ts
rename to src/features/DesktopOnboarding/storage.test.ts
diff --git a/src/routes/(desktop)/desktop-onboarding/storage.ts b/src/features/DesktopOnboarding/storage.ts
similarity index 100%
rename from src/routes/(desktop)/desktop-onboarding/storage.ts
rename to src/features/DesktopOnboarding/storage.ts
diff --git a/src/routes/(desktop)/desktop-onboarding/types.ts b/src/features/DesktopOnboarding/types.ts
similarity index 100%
rename from src/routes/(desktop)/desktop-onboarding/types.ts
rename to src/features/DesktopOnboarding/types.ts
diff --git a/src/features/Electron/connection/Connection.tsx b/src/features/Electron/connection/Connection.tsx
index 016ae0b9aa8..47bced2358f 100644
--- a/src/features/Electron/connection/Connection.tsx
+++ b/src/features/Electron/connection/Connection.tsx
@@ -4,7 +4,7 @@ import { cssVar } from 'antd-style';
import { Suspense, useCallback } from 'react';
import { BrandTextLoading } from '@/components/Loading';
-import LoginStep from '@/routes/(desktop)/desktop-onboarding/features/LoginStep';
+import LoginStep from '@/features/DesktopOnboarding/steps/LoginStep';
import { useElectronStore } from '@/store/electron';
import { isMacOS } from '@/utils/platform';
diff --git a/src/features/Home/AgentSelect/useHomeAgentRows.ts b/src/features/Home/AgentSelect/useHomeAgentRows.ts
index 492a2af0691..34155082551 100644
--- a/src/features/Home/AgentSelect/useHomeAgentRows.ts
+++ b/src/features/Home/AgentSelect/useHomeAgentRows.ts
@@ -10,7 +10,7 @@ import { DEFAULT_INBOX_AVATAR } from '@/const/meta';
import {
useKeepSidebarGroupsListed,
useKeepSidebarListed,
-} from '@/routes/(main)/home/_layout/Body/Agent/List/useAgentList';
+} from '@/features/HomeSidebar/Body/Agent/List/useAgentList';
import { useAgentStore } from '@/store/agent';
import { agentSelectors, builtinAgentSelectors } from '@/store/agent/selectors';
import { useHomeStore } from '@/store/home';
diff --git a/src/features/Home/Recents/index.tsx b/src/features/Home/Recents/index.tsx
index 0b14f074aad..3646401b48f 100644
--- a/src/features/Home/Recents/index.tsx
+++ b/src/features/Home/Recents/index.tsx
@@ -22,9 +22,9 @@ import { useTranslation } from 'react-i18next';
import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';
import NeuralNetworkLoading from '@/components/NeuralNetworkLoading';
+import { openCustomizeSidebarModal } from '@/features/HomeSidebar/Body/CustomizeSidebarModal';
import SkeletonList from '@/features/NavPanel/components/SkeletonList';
import { useInitRecents } from '@/hooks/useInitRecents';
-import { openCustomizeSidebarModal } from '@/routes/(main)/home/_layout/Body/CustomizeSidebarModal';
import { useGlobalStore } from '@/store/global';
import { systemStatusSelectors } from '@/store/global/selectors';
import { reorderSidebarItems } from '@/store/global/selectors/systemStatus';
diff --git a/src/routes/(main)/home/_layout/HomeAgentIdSync.tsx b/src/features/HomeLayout/HomeAgentIdSync.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/HomeAgentIdSync.tsx
rename to src/features/HomeLayout/HomeAgentIdSync.tsx
diff --git a/src/routes/(main)/home/_layout/RecentHydration.tsx b/src/features/HomeLayout/RecentHydration.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/RecentHydration.tsx
rename to src/features/HomeLayout/RecentHydration.tsx
diff --git a/src/features/HomeLayout/index.tsx b/src/features/HomeLayout/index.tsx
new file mode 100644
index 00000000000..019e896c649
--- /dev/null
+++ b/src/features/HomeLayout/index.tsx
@@ -0,0 +1,71 @@
+import { Flexbox } from '@lobehub/ui';
+import { useTheme } from 'antd-style';
+import { Activity, type FC, type ReactNode, useEffect, useMemo, useState } from 'react';
+import { Outlet, useLocation } from 'react-router';
+
+import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaceSlug';
+import { useIsDark } from '@/hooks/useIsDark';
+
+import HomeAgentIdSync from './HomeAgentIdSync';
+import RecentHydration from './RecentHydration';
+import { styles } from './style';
+
+interface LayoutProps {
+ children?: ReactNode;
+}
+
+const Layout: FC<LayoutProps> = ({ children }) => {
+ const isDarkMode = useIsDark();
+ const theme = useTheme(); // Keep for colorBgContainerSecondary (not in cssVar)
+ const { pathname } = useLocation();
+ const activeSlug = useActiveWorkspaceSlug();
+ const isHomeRoute =
+ pathname === '/' ||
+ (!!activeSlug && (pathname === `/${activeSlug}` || pathname === `/${activeSlug}/`));
+ const [hasActivated, setHasActivated] = useState(isHomeRoute);
+ const content = children ?? <Outlet />;
+
+ useEffect(() => {
+ if (isHomeRoute) setHasActivated(true);
+ }, [isHomeRoute]);
+
+ // CSS variable for dynamic background color (colorBgContainerSecondary is not in cssVar)
+ const cssVariables = useMemo<Record<string, string>>(
+ () => ({
+ '--content-bg-secondary': theme.colorBgContainerSecondary,
+ }),
+ [theme.colorBgContainerSecondary],
+ );
+
+ if (!hasActivated) return null;
+
+ // Keep the Home layout alive and render it offscreen when inactive. The nav
+ // panel entry is owned by `NavPanelShell`, not by this layout — see the note
+ // there for why it cannot be registered from inside the route tree.
+ return (
+ <Activity mode={isHomeRoute ? 'visible' : 'hidden'} name="DesktopHomeLayout">
+ {/* `position: absolute; inset: 0` keeps overlaying the outlet when Activity is hidden,
+ because Activity preserves state but doesn't visually hide the DOM. Force-hide here. */}
+ <Flexbox
+ className={styles.absoluteContainer}
+ height={'100%'}
+ style={isHomeRoute ? undefined : { display: 'none' }}
+ width={'100%'}
+ >
+ <Flexbox
+ className={isDarkMode ? styles.contentDark : styles.contentLight}
+ flex={1}
+ height={'100%'}
+ style={cssVariables}
+ >
+ {content}
+ </Flexbox>
+
+ <HomeAgentIdSync />
+ <RecentHydration />
+ </Flexbox>
+ </Activity>
+ );
+};
+
+export default Layout;
diff --git a/src/routes/(main)/home/_layout/style.ts b/src/features/HomeLayout/style.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/style.ts
rename to src/features/HomeLayout/style.ts
diff --git a/src/routes/(main)/home/_layout/Body/Agent/Actions.tsx b/src/features/HomeSidebar/Body/Agent/Actions.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/Actions.tsx
rename to src/features/HomeSidebar/Body/Agent/Actions.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Agent/AllAgentsDrawer/Content.tsx b/src/features/HomeSidebar/Body/Agent/AllAgentsDrawer/Content.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/AllAgentsDrawer/Content.tsx
rename to src/features/HomeSidebar/Body/Agent/AllAgentsDrawer/Content.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Agent/AllAgentsDrawer/index.tsx b/src/features/HomeSidebar/Body/Agent/AllAgentsDrawer/index.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/AllAgentsDrawer/index.tsx
rename to src/features/HomeSidebar/Body/Agent/AllAgentsDrawer/index.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Agent/CreateAgentButton.tsx b/src/features/HomeSidebar/Body/Agent/CreateAgentButton.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/CreateAgentButton.tsx
rename to src/features/HomeSidebar/Body/Agent/CreateAgentButton.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Agent/List/AgentGroupItem/index.tsx b/src/features/HomeSidebar/Body/Agent/List/AgentGroupItem/index.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/List/AgentGroupItem/index.tsx
rename to src/features/HomeSidebar/Body/Agent/List/AgentGroupItem/index.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Agent/List/AgentGroupItem/useDropdownMenu.tsx b/src/features/HomeSidebar/Body/Agent/List/AgentGroupItem/useDropdownMenu.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/List/AgentGroupItem/useDropdownMenu.tsx
rename to src/features/HomeSidebar/Body/Agent/List/AgentGroupItem/useDropdownMenu.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Agent/List/AgentItem/Avatar.tsx b/src/features/HomeSidebar/Body/Agent/List/AgentItem/Avatar.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/List/AgentItem/Avatar.tsx
rename to src/features/HomeSidebar/Body/Agent/List/AgentItem/Avatar.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Agent/List/AgentItem/agentMenuVisibility.test.ts b/src/features/HomeSidebar/Body/Agent/List/AgentItem/agentMenuVisibility.test.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/List/AgentItem/agentMenuVisibility.test.ts
rename to src/features/HomeSidebar/Body/Agent/List/AgentItem/agentMenuVisibility.test.ts
diff --git a/src/routes/(main)/home/_layout/Body/Agent/List/AgentItem/agentMenuVisibility.ts b/src/features/HomeSidebar/Body/Agent/List/AgentItem/agentMenuVisibility.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/List/AgentItem/agentMenuVisibility.ts
rename to src/features/HomeSidebar/Body/Agent/List/AgentItem/agentMenuVisibility.ts
diff --git a/src/routes/(main)/home/_layout/Body/Agent/List/AgentItem/index.tsx b/src/features/HomeSidebar/Body/Agent/List/AgentItem/index.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/List/AgentItem/index.tsx
rename to src/features/HomeSidebar/Body/Agent/List/AgentItem/index.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Agent/List/AgentItem/useDropdownMenu.test.tsx b/src/features/HomeSidebar/Body/Agent/List/AgentItem/useDropdownMenu.test.tsx
similarity index 99%
rename from src/routes/(main)/home/_layout/Body/Agent/List/AgentItem/useDropdownMenu.test.tsx
rename to src/features/HomeSidebar/Body/Agent/List/AgentItem/useDropdownMenu.test.tsx
index 8bb2b96e906..ae5f1414319 100644
--- a/src/routes/(main)/home/_layout/Body/Agent/List/AgentItem/useDropdownMenu.test.tsx
+++ b/src/features/HomeSidebar/Body/Agent/List/AgentItem/useDropdownMenu.test.tsx
@@ -85,7 +85,7 @@ vi.mock('@/hooks/useResourceManageable', () => ({
vi.mock('@/services/agent', () => ({ agentService: {} }));
-vi.mock('@/routes/(main)/home/_layout/Body/Agent/ModalProvider', () => ({
+vi.mock('@/features/HomeSidebar/Body/Agent/ModalProvider', () => ({
useOptionalAgentModal: () => null,
}));
diff --git a/src/routes/(main)/home/_layout/Body/Agent/List/AgentItem/useDropdownMenu.tsx b/src/features/HomeSidebar/Body/Agent/List/AgentItem/useDropdownMenu.tsx
similarity index 99%
rename from src/routes/(main)/home/_layout/Body/Agent/List/AgentItem/useDropdownMenu.tsx
rename to src/features/HomeSidebar/Body/Agent/List/AgentItem/useDropdownMenu.tsx
index 52308b2f868..f1edee6d4db 100644
--- a/src/routes/(main)/home/_layout/Body/Agent/List/AgentItem/useDropdownMenu.tsx
+++ b/src/features/HomeSidebar/Body/Agent/List/AgentItem/useDropdownMenu.tsx
@@ -30,12 +30,12 @@ import { useTranslation } from 'react-i18next';
import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';
import { useAgentTransferMenuItem } from '@/business/client/hooks/useAgentTransferMenuItem';
import { openEditingPopover } from '@/features/EditingPopover/store';
+import { useOptionalAgentModal } from '@/features/HomeSidebar/Body/Agent/ModalProvider';
import { useResourceAccess } from '@/features/ResourcePermission/useResourceAccess';
import VisibilityConfirmContent from '@/features/VisibilityConfirmContent';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import { usePermission } from '@/hooks/usePermission';
import { useResourceManageable } from '@/hooks/useResourceManageable';
-import { useOptionalAgentModal } from '@/routes/(main)/home/_layout/Body/Agent/ModalProvider';
import { agentService } from '@/services/agent';
import { useGlobalStore } from '@/store/global';
import { useHomeStore } from '@/store/home';
diff --git a/src/routes/(main)/home/_layout/Body/Agent/List/AgentListContent.tsx b/src/features/HomeSidebar/Body/Agent/List/AgentListContent.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/List/AgentListContent.tsx
rename to src/features/HomeSidebar/Body/Agent/List/AgentListContent.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Agent/List/Group/Actions.tsx b/src/features/HomeSidebar/Body/Agent/List/Group/Actions.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/List/Group/Actions.tsx
rename to src/features/HomeSidebar/Body/Agent/List/Group/Actions.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Agent/List/Group/Item.tsx b/src/features/HomeSidebar/Body/Agent/List/Group/Item.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/List/Group/Item.tsx
rename to src/features/HomeSidebar/Body/Agent/List/Group/Item.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Agent/List/Group/index.tsx b/src/features/HomeSidebar/Body/Agent/List/Group/index.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/List/Group/index.tsx
rename to src/features/HomeSidebar/Body/Agent/List/Group/index.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Agent/List/Group/useDropdownMenu.test.ts b/src/features/HomeSidebar/Body/Agent/List/Group/useDropdownMenu.test.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/List/Group/useDropdownMenu.test.ts
rename to src/features/HomeSidebar/Body/Agent/List/Group/useDropdownMenu.test.ts
diff --git a/src/routes/(main)/home/_layout/Body/Agent/List/Group/useDropdownMenu.tsx b/src/features/HomeSidebar/Body/Agent/List/Group/useDropdownMenu.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/List/Group/useDropdownMenu.tsx
rename to src/features/HomeSidebar/Body/Agent/List/Group/useDropdownMenu.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Agent/List/InboxItem.tsx b/src/features/HomeSidebar/Body/Agent/List/InboxItem.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/List/InboxItem.tsx
rename to src/features/HomeSidebar/Body/Agent/List/InboxItem.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Agent/List/Item/Actions.tsx b/src/features/HomeSidebar/Body/Agent/List/Item/Actions.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/List/Item/Actions.tsx
rename to src/features/HomeSidebar/Body/Agent/List/Item/Actions.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Agent/List/List.tsx b/src/features/HomeSidebar/Body/Agent/List/List.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/List/List.tsx
rename to src/features/HomeSidebar/Body/Agent/List/List.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Agent/List/agentListContentState.test.ts b/src/features/HomeSidebar/Body/Agent/List/agentListContentState.test.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/List/agentListContentState.test.ts
rename to src/features/HomeSidebar/Body/Agent/List/agentListContentState.test.ts
diff --git a/src/routes/(main)/home/_layout/Body/Agent/List/agentListContentState.ts b/src/features/HomeSidebar/Body/Agent/List/agentListContentState.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/List/agentListContentState.ts
rename to src/features/HomeSidebar/Body/Agent/List/agentListContentState.ts
diff --git a/src/routes/(main)/home/_layout/Body/Agent/List/index.tsx b/src/features/HomeSidebar/Body/Agent/List/index.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/List/index.tsx
rename to src/features/HomeSidebar/Body/Agent/List/index.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Agent/List/useAgentList.tsx b/src/features/HomeSidebar/Body/Agent/List/useAgentList.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/List/useAgentList.tsx
rename to src/features/HomeSidebar/Body/Agent/List/useAgentList.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Agent/List/usePreservedAgentUrl.ts b/src/features/HomeSidebar/Body/Agent/List/usePreservedAgentUrl.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/List/usePreservedAgentUrl.ts
rename to src/features/HomeSidebar/Body/Agent/List/usePreservedAgentUrl.ts
diff --git a/src/routes/(main)/home/_layout/Body/Agent/ModalProvider.test.tsx b/src/features/HomeSidebar/Body/Agent/ModalProvider.test.tsx
similarity index 98%
rename from src/routes/(main)/home/_layout/Body/Agent/ModalProvider.test.tsx
rename to src/features/HomeSidebar/Body/Agent/ModalProvider.test.tsx
index 7c85d6d406f..61aaf9207f6 100644
--- a/src/routes/(main)/home/_layout/Body/Agent/ModalProvider.test.tsx
+++ b/src/features/HomeSidebar/Body/Agent/ModalProvider.test.tsx
@@ -45,7 +45,7 @@ vi.mock('@/features/EditingPopover', () => ({
default: () => null,
}));
-vi.mock('@/routes/(main)/home/_layout/hooks/useCreateModal', () => ({
+vi.mock('@/features/HomeSidebar/hooks/useCreateModal', () => ({
openCreateAgentModal: (props: {
onCreateBlank: () => Promise<void> | void;
onOpenSkills?: (identifier: string) => void;
diff --git a/src/routes/(main)/home/_layout/Body/Agent/ModalProvider.tsx b/src/features/HomeSidebar/Body/Agent/ModalProvider.tsx
similarity index 98%
rename from src/routes/(main)/home/_layout/Body/Agent/ModalProvider.tsx
rename to src/features/HomeSidebar/Body/Agent/ModalProvider.tsx
index 12f31734441..6fef152d3d0 100644
--- a/src/routes/(main)/home/_layout/Body/Agent/ModalProvider.tsx
+++ b/src/features/HomeSidebar/Body/Agent/ModalProvider.tsx
@@ -17,9 +17,9 @@ import {
} from 'react';
import EditingPopover from '@/features/EditingPopover';
+import type { OpenCreateAgentModalOptions } from '@/features/HomeSidebar/hooks/useCreateModal';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import { openLabelFormModal } from '@/features/WorkspaceSetting/Labels/LabelFormModal';
-import type { OpenCreateAgentModalOptions } from '@/routes/(main)/home/_layout/hooks/useCreateModal';
import { useAgentStore } from '@/store/agent';
import { builtinAgentSelectors } from '@/store/agent/selectors';
import { useGlobalStore } from '@/store/global';
@@ -168,7 +168,7 @@ const CreateModalRenderer = memo<CreateModalRendererProps>(
let cancelled = false;
let instance: ModalInstance | undefined;
- void import('@/routes/(main)/home/_layout/hooks/useCreateModal').then(
+ void import('@/features/HomeSidebar/hooks/useCreateModal').then(
({ openCreateAgentModal }) => {
if (cancelled) return;
instance = openCreateAgentModal(openArgsRef.current!);
diff --git a/src/routes/(main)/home/_layout/Body/Agent/Modals/ConfigGroupModal/GroupItem.tsx b/src/features/HomeSidebar/Body/Agent/Modals/ConfigGroupModal/GroupItem.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/Modals/ConfigGroupModal/GroupItem.tsx
rename to src/features/HomeSidebar/Body/Agent/Modals/ConfigGroupModal/GroupItem.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Agent/Modals/ConfigGroupModal/index.tsx b/src/features/HomeSidebar/Body/Agent/Modals/ConfigGroupModal/index.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/Modals/ConfigGroupModal/index.tsx
rename to src/features/HomeSidebar/Body/Agent/Modals/ConfigGroupModal/index.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Agent/Modals/CreateGroupModal.tsx b/src/features/HomeSidebar/Body/Agent/Modals/CreateGroupModal.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/Modals/CreateGroupModal.tsx
rename to src/features/HomeSidebar/Body/Agent/Modals/CreateGroupModal.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Agent/index.tsx b/src/features/HomeSidebar/Body/Agent/index.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/index.tsx
rename to src/features/HomeSidebar/Body/Agent/index.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Agent/useDropdownMenu.test.tsx b/src/features/HomeSidebar/Body/Agent/useDropdownMenu.test.tsx
similarity index 95%
rename from src/routes/(main)/home/_layout/Body/Agent/useDropdownMenu.test.tsx
rename to src/features/HomeSidebar/Body/Agent/useDropdownMenu.test.tsx
index 2ada94afba8..7b498921a8e 100644
--- a/src/routes/(main)/home/_layout/Body/Agent/useDropdownMenu.test.tsx
+++ b/src/features/HomeSidebar/Body/Agent/useDropdownMenu.test.tsx
@@ -18,7 +18,7 @@ vi.mock('react-i18next', () => ({
}),
}));
-vi.mock('@/routes/(main)/home/_layout/Body/CustomizeSidebarModal', () => ({
+vi.mock('@/features/HomeSidebar/Body/CustomizeSidebarModal', () => ({
openCustomizeSidebarModal: vi.fn(),
}));
diff --git a/src/routes/(main)/home/_layout/Body/Agent/useDropdownMenu.tsx b/src/features/HomeSidebar/Body/Agent/useDropdownMenu.tsx
similarity index 95%
rename from src/routes/(main)/home/_layout/Body/Agent/useDropdownMenu.tsx
rename to src/features/HomeSidebar/Body/Agent/useDropdownMenu.tsx
index 5688889e870..3ee0eadd822 100644
--- a/src/routes/(main)/home/_layout/Body/Agent/useDropdownMenu.tsx
+++ b/src/features/HomeSidebar/Body/Agent/useDropdownMenu.tsx
@@ -4,7 +4,7 @@ import { Hash, LucideCheck, SlidersHorizontalIcon } from 'lucide-react';
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
-import { openCustomizeSidebarModal } from '@/routes/(main)/home/_layout/Body/CustomizeSidebarModal';
+import { openCustomizeSidebarModal } from '@/features/HomeSidebar/Body/CustomizeSidebarModal';
import { useGlobalStore } from '@/store/global';
import { systemStatusSelectors } from '@/store/global/selectors';
diff --git a/src/routes/(main)/home/_layout/Body/Agent/useSidebarGroupVisibility.test.ts b/src/features/HomeSidebar/Body/Agent/useSidebarGroupVisibility.test.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/useSidebarGroupVisibility.test.ts
rename to src/features/HomeSidebar/Body/Agent/useSidebarGroupVisibility.test.ts
diff --git a/src/routes/(main)/home/_layout/Body/Agent/useSidebarGroupVisibility.ts b/src/features/HomeSidebar/Body/Agent/useSidebarGroupVisibility.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/useSidebarGroupVisibility.ts
rename to src/features/HomeSidebar/Body/Agent/useSidebarGroupVisibility.ts
diff --git a/src/routes/(main)/home/_layout/Body/Agent/useSidebarItemVisibility.test.ts b/src/features/HomeSidebar/Body/Agent/useSidebarItemVisibility.test.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/useSidebarItemVisibility.test.ts
rename to src/features/HomeSidebar/Body/Agent/useSidebarItemVisibility.test.ts
diff --git a/src/routes/(main)/home/_layout/Body/Agent/useSidebarItemVisibility.ts b/src/features/HomeSidebar/Body/Agent/useSidebarItemVisibility.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Agent/useSidebarItemVisibility.ts
rename to src/features/HomeSidebar/Body/Agent/useSidebarItemVisibility.ts
diff --git a/src/routes/(main)/home/_layout/Body/CustomizeSidebarModal.test.ts b/src/features/HomeSidebar/Body/CustomizeSidebarModal.test.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/CustomizeSidebarModal.test.ts
rename to src/features/HomeSidebar/Body/CustomizeSidebarModal.test.ts
diff --git a/src/routes/(main)/home/_layout/Body/CustomizeSidebarModal.tsx b/src/features/HomeSidebar/Body/CustomizeSidebarModal.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/CustomizeSidebarModal.tsx
rename to src/features/HomeSidebar/Body/CustomizeSidebarModal.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Private/List.tsx b/src/features/HomeSidebar/Body/Private/List.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Private/List.tsx
rename to src/features/HomeSidebar/Body/Private/List.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Private/index.tsx b/src/features/HomeSidebar/Body/Private/index.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/Private/index.tsx
rename to src/features/HomeSidebar/Body/Private/index.tsx
diff --git a/src/routes/(main)/home/_layout/Body/Private/useDropdownMenu.tsx b/src/features/HomeSidebar/Body/Private/useDropdownMenu.tsx
similarity index 97%
rename from src/routes/(main)/home/_layout/Body/Private/useDropdownMenu.tsx
rename to src/features/HomeSidebar/Body/Private/useDropdownMenu.tsx
index 3775da6db2f..0e8b107bf3b 100644
--- a/src/routes/(main)/home/_layout/Body/Private/useDropdownMenu.tsx
+++ b/src/features/HomeSidebar/Body/Private/useDropdownMenu.tsx
@@ -5,7 +5,7 @@ import { useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';
-import { openCustomizeSidebarModal } from '@/routes/(main)/home/_layout/Body/CustomizeSidebarModal';
+import { openCustomizeSidebarModal } from '@/features/HomeSidebar/Body/CustomizeSidebarModal';
import { useGlobalStore } from '@/store/global';
import { systemStatusSelectors } from '@/store/global/selectors';
import { reorderSidebarItems } from '@/store/global/selectors/systemStatus';
diff --git a/src/routes/(main)/home/_layout/Body/index.test.tsx b/src/features/HomeSidebar/Body/index.test.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/index.test.tsx
rename to src/features/HomeSidebar/Body/index.test.tsx
diff --git a/src/routes/(main)/home/_layout/Body/index.tsx b/src/features/HomeSidebar/Body/index.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/index.tsx
rename to src/features/HomeSidebar/Body/index.tsx
diff --git a/src/routes/(main)/home/_layout/Body/useSyncWorkspaceSidebarPreference.test.tsx b/src/features/HomeSidebar/Body/useSyncWorkspaceSidebarPreference.test.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/useSyncWorkspaceSidebarPreference.test.tsx
rename to src/features/HomeSidebar/Body/useSyncWorkspaceSidebarPreference.test.tsx
diff --git a/src/routes/(main)/home/_layout/Body/useSyncWorkspaceSidebarPreference.ts b/src/features/HomeSidebar/Body/useSyncWorkspaceSidebarPreference.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/Body/useSyncWorkspaceSidebarPreference.ts
rename to src/features/HomeSidebar/Body/useSyncWorkspaceSidebarPreference.ts
diff --git a/src/features/HomeSidebar/Content.tsx b/src/features/HomeSidebar/Content.tsx
index 3630619c1fd..ea1f7b6b338 100644
--- a/src/features/HomeSidebar/Content.tsx
+++ b/src/features/HomeSidebar/Content.tsx
@@ -1,9 +1,10 @@
import { memo } from 'react';
import SideBarLayout from '@/features/NavPanel/SideBarLayout';
-import Body from '@/routes/(main)/home/_layout/Body';
-import { AgentModalProvider } from '@/routes/(main)/home/_layout/Body/Agent/ModalProvider';
-import Header from '@/routes/(main)/home/_layout/Header';
+
+import Body from './Body';
+import { AgentModalProvider } from './Body/Agent/ModalProvider';
+import Header from './Header';
const HomeSidebarContent = memo(() => {
return (
diff --git a/src/routes/(main)/home/_layout/Footer/index.test.tsx b/src/features/HomeSidebar/Footer/index.test.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Footer/index.test.tsx
rename to src/features/HomeSidebar/Footer/index.test.tsx
diff --git a/src/routes/(main)/home/_layout/Footer/index.tsx b/src/features/HomeSidebar/Footer/index.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Footer/index.tsx
rename to src/features/HomeSidebar/Footer/index.tsx
diff --git a/src/routes/(main)/home/_layout/Footer/promotionPipeline.test.ts b/src/features/HomeSidebar/Footer/promotionPipeline.test.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/Footer/promotionPipeline.test.ts
rename to src/features/HomeSidebar/Footer/promotionPipeline.test.ts
diff --git a/src/routes/(main)/home/_layout/Footer/promotionPipeline.ts b/src/features/HomeSidebar/Footer/promotionPipeline.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/Footer/promotionPipeline.ts
rename to src/features/HomeSidebar/Footer/promotionPipeline.ts
diff --git a/src/routes/(main)/home/_layout/Header/components/InboxButton.tsx b/src/features/HomeSidebar/Header/components/InboxButton.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Header/components/InboxButton.tsx
rename to src/features/HomeSidebar/Header/components/InboxButton.tsx
diff --git a/src/routes/(main)/home/_layout/Header/components/InboxDrawer/Content.tsx b/src/features/HomeSidebar/Header/components/InboxDrawer/Content.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Header/components/InboxDrawer/Content.tsx
rename to src/features/HomeSidebar/Header/components/InboxDrawer/Content.tsx
diff --git a/src/routes/(main)/home/_layout/Header/components/InboxDrawer/NotificationDetailModal.tsx b/src/features/HomeSidebar/Header/components/InboxDrawer/NotificationDetailModal.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Header/components/InboxDrawer/NotificationDetailModal.tsx
rename to src/features/HomeSidebar/Header/components/InboxDrawer/NotificationDetailModal.tsx
diff --git a/src/routes/(main)/home/_layout/Header/components/InboxDrawer/NotificationItem.tsx b/src/features/HomeSidebar/Header/components/InboxDrawer/NotificationItem.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Header/components/InboxDrawer/NotificationItem.tsx
rename to src/features/HomeSidebar/Header/components/InboxDrawer/NotificationItem.tsx
diff --git a/src/routes/(main)/home/_layout/Header/components/InboxDrawer/formatNotificationRelativeTime.test.ts b/src/features/HomeSidebar/Header/components/InboxDrawer/formatNotificationRelativeTime.test.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/Header/components/InboxDrawer/formatNotificationRelativeTime.test.ts
rename to src/features/HomeSidebar/Header/components/InboxDrawer/formatNotificationRelativeTime.test.ts
diff --git a/src/routes/(main)/home/_layout/Header/components/InboxDrawer/formatNotificationRelativeTime.ts b/src/features/HomeSidebar/Header/components/InboxDrawer/formatNotificationRelativeTime.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/Header/components/InboxDrawer/formatNotificationRelativeTime.ts
rename to src/features/HomeSidebar/Header/components/InboxDrawer/formatNotificationRelativeTime.ts
diff --git a/src/routes/(main)/home/_layout/Header/components/InboxDrawer/index.tsx b/src/features/HomeSidebar/Header/components/InboxDrawer/index.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Header/components/InboxDrawer/index.tsx
rename to src/features/HomeSidebar/Header/components/InboxDrawer/index.tsx
diff --git a/src/routes/(main)/home/_layout/Header/components/Nav.tsx b/src/features/HomeSidebar/Header/components/Nav.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Header/components/Nav.tsx
rename to src/features/HomeSidebar/Header/components/Nav.tsx
diff --git a/src/routes/(main)/home/_layout/Header/components/User.tsx b/src/features/HomeSidebar/Header/components/User.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Header/components/User.tsx
rename to src/features/HomeSidebar/Header/components/User.tsx
diff --git a/src/routes/(main)/home/_layout/Header/components/useInboxUnreadCount.test.ts b/src/features/HomeSidebar/Header/components/useInboxUnreadCount.test.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/Header/components/useInboxUnreadCount.test.ts
rename to src/features/HomeSidebar/Header/components/useInboxUnreadCount.test.ts
diff --git a/src/routes/(main)/home/_layout/Header/components/useInboxUnreadCount.ts b/src/features/HomeSidebar/Header/components/useInboxUnreadCount.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/Header/components/useInboxUnreadCount.ts
rename to src/features/HomeSidebar/Header/components/useInboxUnreadCount.ts
diff --git a/src/routes/(main)/home/_layout/Header/index.tsx b/src/features/HomeSidebar/Header/index.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/Header/index.tsx
rename to src/features/HomeSidebar/Header/index.tsx
diff --git a/src/routes/(main)/home/_layout/hooks/agentSkillSuggestion.test.ts b/src/features/HomeSidebar/hooks/agentSkillSuggestion.test.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/hooks/agentSkillSuggestion.test.ts
rename to src/features/HomeSidebar/hooks/agentSkillSuggestion.test.ts
diff --git a/src/routes/(main)/home/_layout/hooks/agentSkillSuggestion.ts b/src/features/HomeSidebar/hooks/agentSkillSuggestion.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/hooks/agentSkillSuggestion.ts
rename to src/features/HomeSidebar/hooks/agentSkillSuggestion.ts
diff --git a/src/routes/(main)/home/_layout/hooks/createAgentModalAnalytics.test.ts b/src/features/HomeSidebar/hooks/createAgentModalAnalytics.test.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/hooks/createAgentModalAnalytics.test.ts
rename to src/features/HomeSidebar/hooks/createAgentModalAnalytics.test.ts
diff --git a/src/routes/(main)/home/_layout/hooks/createAgentModalAnalytics.ts b/src/features/HomeSidebar/hooks/createAgentModalAnalytics.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/hooks/createAgentModalAnalytics.ts
rename to src/features/HomeSidebar/hooks/createAgentModalAnalytics.ts
diff --git a/src/routes/(main)/home/_layout/hooks/index.ts b/src/features/HomeSidebar/hooks/index.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/hooks/index.ts
rename to src/features/HomeSidebar/hooks/index.ts
diff --git a/src/routes/(main)/home/_layout/hooks/useCreateMenuItems.test.tsx b/src/features/HomeSidebar/hooks/useCreateMenuItems.test.tsx
similarity index 99%
rename from src/routes/(main)/home/_layout/hooks/useCreateMenuItems.test.tsx
rename to src/features/HomeSidebar/hooks/useCreateMenuItems.test.tsx
index 18aef887506..79220ce585e 100644
--- a/src/routes/(main)/home/_layout/hooks/useCreateMenuItems.test.tsx
+++ b/src/features/HomeSidebar/hooks/useCreateMenuItems.test.tsx
@@ -69,7 +69,7 @@ vi.mock('@/features/ConnectAgent', () => ({
openConnectAgentModal: openConnectAgentModalMock,
}));
-vi.mock('@/routes/(main)/home/_layout/Body/Agent/ModalProvider', () => ({
+vi.mock('@/features/HomeSidebar/Body/Agent/ModalProvider', () => ({
useOptionalAgentModal: () => agentModalMock.current,
}));
diff --git a/src/routes/(main)/home/_layout/hooks/useCreateMenuItems.tsx b/src/features/HomeSidebar/hooks/useCreateMenuItems.tsx
similarity index 99%
rename from src/routes/(main)/home/_layout/hooks/useCreateMenuItems.tsx
rename to src/features/HomeSidebar/hooks/useCreateMenuItems.tsx
index 8e61631c6d9..280c59e60ec 100644
--- a/src/routes/(main)/home/_layout/hooks/useCreateMenuItems.tsx
+++ b/src/features/HomeSidebar/hooks/useCreateMenuItems.tsx
@@ -20,9 +20,9 @@ import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspace
import { useGroupTemplates } from '@/components/ChatGroupWizard/templates';
import { DEFAULT_CHAT_GROUP_CHAT_CONFIG } from '@/const/settings';
import { openConnectAgentModal } from '@/features/ConnectAgent';
+import { useOptionalAgentModal } from '@/features/HomeSidebar/Body/Agent/ModalProvider';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import { usePermission } from '@/hooks/usePermission';
-import { useOptionalAgentModal } from '@/routes/(main)/home/_layout/Body/Agent/ModalProvider';
import type { CreateAgentParams } from '@/services/agent';
import type { GroupMemberConfig } from '@/services/chatGroup';
import { chatGroupService } from '@/services/chatGroup';
diff --git a/src/routes/(main)/home/_layout/hooks/useCreateModal.test.tsx b/src/features/HomeSidebar/hooks/useCreateModal.test.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/hooks/useCreateModal.test.tsx
rename to src/features/HomeSidebar/hooks/useCreateModal.test.tsx
diff --git a/src/routes/(main)/home/_layout/hooks/useCreateModal.tsx b/src/features/HomeSidebar/hooks/useCreateModal.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/hooks/useCreateModal.tsx
rename to src/features/HomeSidebar/hooks/useCreateModal.tsx
diff --git a/src/routes/(main)/home/_layout/hooks/useProjectMenuItems.tsx b/src/features/HomeSidebar/hooks/useProjectMenuItems.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/hooks/useProjectMenuItems.tsx
rename to src/features/HomeSidebar/hooks/useProjectMenuItems.tsx
diff --git a/src/routes/(main)/home/_layout/hooks/useRevealSidebarSection.test.ts b/src/features/HomeSidebar/hooks/useRevealSidebarSection.test.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/hooks/useRevealSidebarSection.test.ts
rename to src/features/HomeSidebar/hooks/useRevealSidebarSection.test.ts
diff --git a/src/routes/(main)/home/_layout/hooks/useRevealSidebarSection.ts b/src/features/HomeSidebar/hooks/useRevealSidebarSection.ts
similarity index 100%
rename from src/routes/(main)/home/_layout/hooks/useRevealSidebarSection.ts
rename to src/features/HomeSidebar/hooks/useRevealSidebarSection.ts
diff --git a/src/routes/(main)/home/_layout/hooks/useSessionGroupMenuItems.tsx b/src/features/HomeSidebar/hooks/useSessionGroupMenuItems.tsx
similarity index 100%
rename from src/routes/(main)/home/_layout/hooks/useSessionGroupMenuItems.tsx
rename to src/features/HomeSidebar/hooks/useSessionGroupMenuItems.tsx
diff --git a/src/features/LibraryModal/CreateNew/CreateForm.tsx b/src/features/LibraryModal/CreateNew/CreateForm.tsx
index 254cd96291e..c2dc211a998 100644
--- a/src/features/LibraryModal/CreateNew/CreateForm.tsx
+++ b/src/features/LibraryModal/CreateNew/CreateForm.tsx
@@ -3,7 +3,7 @@ import { Button } from '@lobehub/ui/base-ui';
import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
import { useKnowledgeBaseStore } from '@/store/library';
interface CreateFormProps {
diff --git a/src/routes/(mobile)/(home)/_layout/MobileLayout.tsx b/src/features/MobileHome/Layout/MobileLayout.tsx
similarity index 100%
rename from src/routes/(mobile)/(home)/_layout/MobileLayout.tsx
rename to src/features/MobileHome/Layout/MobileLayout.tsx
diff --git a/src/routes/(mobile)/(home)/_layout/MobileLayout/style.ts b/src/features/MobileHome/Layout/MobileLayout/style.ts
similarity index 100%
rename from src/routes/(mobile)/(home)/_layout/MobileLayout/style.ts
rename to src/features/MobileHome/Layout/MobileLayout/style.ts
diff --git a/src/routes/(mobile)/(home)/_layout/SessionHeader.tsx b/src/features/MobileHome/Layout/SessionHeader.tsx
similarity index 100%
rename from src/routes/(mobile)/(home)/_layout/SessionHeader.tsx
rename to src/features/MobileHome/Layout/SessionHeader.tsx
diff --git a/src/routes/(mobile)/(home)/_layout/SessionHeader/style.ts b/src/features/MobileHome/Layout/SessionHeader/style.ts
similarity index 100%
rename from src/routes/(mobile)/(home)/_layout/SessionHeader/style.ts
rename to src/features/MobileHome/Layout/SessionHeader/style.ts
diff --git a/src/routes/(mobile)/(home)/_layout/SessionHydration.tsx b/src/features/MobileHome/Layout/SessionHydration.tsx
similarity index 100%
rename from src/routes/(mobile)/(home)/_layout/SessionHydration.tsx
rename to src/features/MobileHome/Layout/SessionHydration.tsx
diff --git a/src/routes/(mobile)/(home)/_layout/SessionSearchBar.tsx b/src/features/MobileHome/Layout/SessionSearchBar.tsx
similarity index 100%
rename from src/routes/(mobile)/(home)/_layout/SessionSearchBar.tsx
rename to src/features/MobileHome/Layout/SessionSearchBar.tsx
diff --git a/src/features/MobileHome/Layout/index.tsx b/src/features/MobileHome/Layout/index.tsx
new file mode 100644
index 00000000000..05f81a780c1
--- /dev/null
+++ b/src/features/MobileHome/Layout/index.tsx
@@ -0,0 +1,18 @@
+import { type FC } from 'react';
+import { Outlet } from 'react-router';
+
+import MobileLayout from '@/features/MobileHome/Layout/MobileLayout';
+import SessionHydration from '@/features/MobileHome/Layout/SessionHydration';
+
+const Layout: FC = () => {
+ return (
+ <>
+ <MobileLayout>
+ <Outlet />
+ </MobileLayout>
+ <SessionHydration />
+ </>
+ );
+};
+
+export default Layout;
diff --git a/src/routes/(mobile)/(home)/features/SessionListContent/CollapseGroup/Actions.tsx b/src/features/MobileHome/SessionListContent/CollapseGroup/Actions.tsx
similarity index 100%
rename from src/routes/(mobile)/(home)/features/SessionListContent/CollapseGroup/Actions.tsx
rename to src/features/MobileHome/SessionListContent/CollapseGroup/Actions.tsx
diff --git a/src/routes/(mobile)/(home)/features/SessionListContent/CollapseGroup/index.tsx b/src/features/MobileHome/SessionListContent/CollapseGroup/index.tsx
similarity index 100%
rename from src/routes/(mobile)/(home)/features/SessionListContent/CollapseGroup/index.tsx
rename to src/features/MobileHome/SessionListContent/CollapseGroup/index.tsx
diff --git a/src/routes/(mobile)/(home)/features/SessionListContent/DefaultMode.tsx b/src/features/MobileHome/SessionListContent/DefaultMode.tsx
similarity index 100%
rename from src/routes/(mobile)/(home)/features/SessionListContent/DefaultMode.tsx
rename to src/features/MobileHome/SessionListContent/DefaultMode.tsx
diff --git a/src/routes/(mobile)/(home)/features/SessionListContent/Inbox/index.tsx b/src/features/MobileHome/SessionListContent/Inbox/index.tsx
similarity index 100%
rename from src/routes/(mobile)/(home)/features/SessionListContent/Inbox/index.tsx
rename to src/features/MobileHome/SessionListContent/Inbox/index.tsx
diff --git a/src/routes/(mobile)/(home)/features/SessionListContent/List/AddButton.tsx b/src/features/MobileHome/SessionListContent/List/AddButton.tsx
similarity index 100%
rename from src/routes/(mobile)/(home)/features/SessionListContent/List/AddButton.tsx
rename to src/features/MobileHome/SessionListContent/List/AddButton.tsx
diff --git a/src/routes/(mobile)/(home)/features/SessionListContent/List/Item/Actions.tsx b/src/features/MobileHome/SessionListContent/List/Item/Actions.tsx
similarity index 100%
rename from src/routes/(mobile)/(home)/features/SessionListContent/List/Item/Actions.tsx
rename to src/features/MobileHome/SessionListContent/List/Item/Actions.tsx
diff --git a/src/routes/(mobile)/(home)/features/SessionListContent/List/Item/index.tsx b/src/features/MobileHome/SessionListContent/List/Item/index.tsx
similarity index 100%
rename from src/routes/(mobile)/(home)/features/SessionListContent/List/Item/index.tsx
rename to src/features/MobileHome/SessionListContent/List/Item/index.tsx
diff --git a/src/routes/(mobile)/(home)/features/SessionListContent/List/index.tsx b/src/features/MobileHome/SessionListContent/List/index.tsx
similarity index 100%
rename from src/routes/(mobile)/(home)/features/SessionListContent/List/index.tsx
rename to src/features/MobileHome/SessionListContent/List/index.tsx
diff --git a/src/routes/(mobile)/(home)/features/SessionListContent/ListItem/index.tsx b/src/features/MobileHome/SessionListContent/ListItem/index.tsx
similarity index 100%
rename from src/routes/(mobile)/(home)/features/SessionListContent/ListItem/index.tsx
rename to src/features/MobileHome/SessionListContent/ListItem/index.tsx
diff --git a/src/routes/(mobile)/(home)/features/SessionListContent/Modals/ConfigGroupModal/GroupItem.tsx b/src/features/MobileHome/SessionListContent/Modals/ConfigGroupModal/GroupItem.tsx
similarity index 100%
rename from src/routes/(mobile)/(home)/features/SessionListContent/Modals/ConfigGroupModal/GroupItem.tsx
rename to src/features/MobileHome/SessionListContent/Modals/ConfigGroupModal/GroupItem.tsx
diff --git a/src/routes/(mobile)/(home)/features/SessionListContent/Modals/ConfigGroupModal/index.tsx b/src/features/MobileHome/SessionListContent/Modals/ConfigGroupModal/index.tsx
similarity index 100%
rename from src/routes/(mobile)/(home)/features/SessionListContent/Modals/ConfigGroupModal/index.tsx
rename to src/features/MobileHome/SessionListContent/Modals/ConfigGroupModal/index.tsx
diff --git a/src/routes/(mobile)/(home)/features/SessionListContent/Modals/CreateGroupModal.tsx b/src/features/MobileHome/SessionListContent/Modals/CreateGroupModal.tsx
similarity index 100%
rename from src/routes/(mobile)/(home)/features/SessionListContent/Modals/CreateGroupModal.tsx
rename to src/features/MobileHome/SessionListContent/Modals/CreateGroupModal.tsx
diff --git a/src/routes/(mobile)/(home)/features/SessionListContent/Modals/RenameGroupModal.tsx b/src/features/MobileHome/SessionListContent/Modals/RenameGroupModal.tsx
similarity index 100%
rename from src/routes/(mobile)/(home)/features/SessionListContent/Modals/RenameGroupModal.tsx
rename to src/features/MobileHome/SessionListContent/Modals/RenameGroupModal.tsx
diff --git a/src/routes/(mobile)/(home)/features/SessionListContent/SearchMode.tsx b/src/features/MobileHome/SessionListContent/SearchMode.tsx
similarity index 100%
rename from src/routes/(mobile)/(home)/features/SessionListContent/SearchMode.tsx
rename to src/features/MobileHome/SessionListContent/SearchMode.tsx
diff --git a/src/routes/(mobile)/(home)/features/SessionListContent/index.tsx b/src/features/MobileHome/SessionListContent/index.tsx
similarity index 100%
rename from src/routes/(mobile)/(home)/features/SessionListContent/index.tsx
rename to src/features/MobileHome/SessionListContent/index.tsx
diff --git a/src/routes/(mobile)/(home)/features/SkeletonList.tsx b/src/features/MobileHome/SkeletonList.tsx
similarity index 100%
rename from src/routes/(mobile)/(home)/features/SkeletonList.tsx
rename to src/features/MobileHome/SkeletonList.tsx
diff --git a/src/features/MobileHome/index.tsx b/src/features/MobileHome/index.tsx
new file mode 100644
index 00000000000..799f00b0884
--- /dev/null
+++ b/src/features/MobileHome/index.tsx
@@ -0,0 +1,16 @@
+import { memo, Suspense } from 'react';
+
+import SessionListContent from './SessionListContent';
+import SkeletonList from './SkeletonList';
+
+const Home = memo(() => {
+ return (
+ <Suspense fallback={<SkeletonList />}>
+ <SessionListContent />
+ </Suspense>
+ );
+});
+
+Home.displayName = 'MobileHome';
+
+export default Home;
diff --git a/src/features/NavPanel/components/NavPanelDraggable.tsx b/src/features/NavPanel/components/NavPanelDraggable.tsx
index 428adc1fa06..e314ae8fe8d 100644
--- a/src/features/NavPanel/components/NavPanelDraggable.tsx
+++ b/src/features/NavPanel/components/NavPanelDraggable.tsx
@@ -7,9 +7,9 @@ import { memo, Suspense, useMemo, useRef } from 'react';
import NavPanelUpgradeEntry from '@/business/client/features/NavPanelUpgradeEntry';
import { isDesktop } from '@/const/version';
+import Footer from '@/features/HomeSidebar/Footer';
import { USER_DROPDOWN_ICON_ID } from '@/features/NavPanel/constants';
import { TOGGLE_BUTTON_ID } from '@/features/NavPanel/ToggleLeftPanelButton';
-import Footer from '@/routes/(main)/home/_layout/Footer';
import { useGlobalStore } from '@/store/global';
import {
NAV_PANEL_MAX_WIDTH,
diff --git a/src/features/Onboarding/Classic/index.test.tsx b/src/features/Onboarding/Classic/index.test.tsx
index 74dcc2f48c8..8765adfacfd 100644
--- a/src/features/Onboarding/Classic/index.test.tsx
+++ b/src/features/Onboarding/Classic/index.test.tsx
@@ -34,11 +34,11 @@ vi.mock('@/hooks/useOnboardingAgentTemplates', () => ({
useOnboardingAgentTemplates: vi.fn(),
}));
-vi.mock('@/routes/onboarding/_layout', () => ({
+vi.mock('@/features/Onboarding/Layout', () => ({
default: ({ children }: { children: ReactNode }) => <div>{children}</div>,
}));
-vi.mock('@/routes/onboarding/features/AgentPickerStep', () => ({
+vi.mock('@/features/Onboarding/steps/AgentPickerStep', () => ({
default: ({ onBack }: { onBack: () => void }) => (
<div>
AgentPickerStep
@@ -49,7 +49,7 @@ vi.mock('@/routes/onboarding/features/AgentPickerStep', () => ({
),
}));
-vi.mock('@/routes/onboarding/features/FullNameStep', () => ({
+vi.mock('@/features/Onboarding/steps/FullNameStep', () => ({
default: ({ onBack, onNext }: { onBack: () => void; onNext: () => void }) => (
<div>
FullNameStep
@@ -63,7 +63,7 @@ vi.mock('@/routes/onboarding/features/FullNameStep', () => ({
),
}));
-vi.mock('@/routes/onboarding/features/InterestsStep', () => ({
+vi.mock('@/features/Onboarding/steps/InterestsStep', () => ({
default: ({ onBack, onNext }: { onBack: () => void; onNext: () => void }) => (
<div>
InterestsStep
@@ -77,7 +77,7 @@ vi.mock('@/routes/onboarding/features/InterestsStep', () => ({
),
}));
-vi.mock('@/routes/onboarding/features/ProSettingsStep', () => ({
+vi.mock('@/features/Onboarding/steps/ProSettingsStep', () => ({
default: ({ onBack, onNext }: { onBack: () => void; onNext: () => void }) => (
<div>
ProSettingsStep
diff --git a/src/features/Onboarding/Classic/index.tsx b/src/features/Onboarding/Classic/index.tsx
index 204643d6839..f33229d0fa8 100644
--- a/src/features/Onboarding/Classic/index.tsx
+++ b/src/features/Onboarding/Classic/index.tsx
@@ -6,13 +6,13 @@ import { memo, useCallback, useEffect, useRef } from 'react';
import { Navigate, useNavigate } from 'react-router';
import Loading from '@/components/Loading/BrandTextLoading';
+import OnboardingContainer from '@/features/Onboarding/Layout';
+import AgentPickerStep from '@/features/Onboarding/steps/AgentPickerStep';
+import FullNameStep from '@/features/Onboarding/steps/FullNameStep';
+import InterestsStep from '@/features/Onboarding/steps/InterestsStep';
+import ProSettingsStep from '@/features/Onboarding/steps/ProSettingsStep';
import { useIsMobile } from '@/hooks/useIsMobile';
import { useOnboardingAgentTemplates } from '@/hooks/useOnboardingAgentTemplates';
-import OnboardingContainer from '@/routes/onboarding/_layout';
-import AgentPickerStep from '@/routes/onboarding/features/AgentPickerStep';
-import FullNameStep from '@/routes/onboarding/features/FullNameStep';
-import InterestsStep from '@/routes/onboarding/features/InterestsStep';
-import ProSettingsStep from '@/routes/onboarding/features/ProSettingsStep';
import {
trackOnboardingStepCompleted,
trackOnboardingStepViewed,
diff --git a/src/routes/onboarding/_layout/index.tsx b/src/features/Onboarding/Layout/index.tsx
similarity index 100%
rename from src/routes/onboarding/_layout/index.tsx
rename to src/features/Onboarding/Layout/index.tsx
diff --git a/src/routes/onboarding/_layout/style.ts b/src/features/Onboarding/Layout/style.ts
similarity index 100%
rename from src/routes/onboarding/_layout/style.ts
rename to src/features/Onboarding/Layout/style.ts
diff --git a/src/routes/onboarding/components/ComposioServerList/components/ComposioServerItem.tsx b/src/features/Onboarding/components/ComposioServerList/components/ComposioServerItem.tsx
similarity index 100%
rename from src/routes/onboarding/components/ComposioServerList/components/ComposioServerItem.tsx
rename to src/features/Onboarding/components/ComposioServerList/components/ComposioServerItem.tsx
diff --git a/src/routes/onboarding/components/ComposioServerList/components/ServerIcon.tsx b/src/features/Onboarding/components/ComposioServerList/components/ServerIcon.tsx
similarity index 100%
rename from src/routes/onboarding/components/ComposioServerList/components/ServerIcon.tsx
rename to src/features/Onboarding/components/ComposioServerList/components/ServerIcon.tsx
diff --git a/src/routes/onboarding/components/ComposioServerList/components/ServerStatusControl.tsx b/src/features/Onboarding/components/ComposioServerList/components/ServerStatusControl.tsx
similarity index 100%
rename from src/routes/onboarding/components/ComposioServerList/components/ServerStatusControl.tsx
rename to src/features/Onboarding/components/ComposioServerList/components/ServerStatusControl.tsx
diff --git a/src/routes/onboarding/components/ComposioServerList/hooks/useComposioOAuth.ts b/src/features/Onboarding/components/ComposioServerList/hooks/useComposioOAuth.ts
similarity index 100%
rename from src/routes/onboarding/components/ComposioServerList/hooks/useComposioOAuth.ts
rename to src/features/Onboarding/components/ComposioServerList/hooks/useComposioOAuth.ts
diff --git a/src/routes/onboarding/components/ComposioServerList/hooks/useComposioServerActions.ts b/src/features/Onboarding/components/ComposioServerList/hooks/useComposioServerActions.ts
similarity index 100%
rename from src/routes/onboarding/components/ComposioServerList/hooks/useComposioServerActions.ts
rename to src/features/Onboarding/components/ComposioServerList/hooks/useComposioServerActions.ts
diff --git a/src/routes/onboarding/components/ComposioServerList/index.tsx b/src/features/Onboarding/components/ComposioServerList/index.tsx
similarity index 100%
rename from src/routes/onboarding/components/ComposioServerList/index.tsx
rename to src/features/Onboarding/components/ComposioServerList/index.tsx
diff --git a/src/routes/onboarding/components/LobeMessage.tsx b/src/features/Onboarding/components/LobeMessage.tsx
similarity index 100%
rename from src/routes/onboarding/components/LobeMessage.tsx
rename to src/features/Onboarding/components/LobeMessage.tsx
diff --git a/src/routes/onboarding/config.ts b/src/features/Onboarding/config.ts
similarity index 100%
rename from src/routes/onboarding/config.ts
rename to src/features/Onboarding/config.ts
diff --git a/src/features/Onboarding/index.tsx b/src/features/Onboarding/index.tsx
new file mode 100644
index 00000000000..9738bfd4a4d
--- /dev/null
+++ b/src/features/Onboarding/index.tsx
@@ -0,0 +1,96 @@
+'use client';
+
+import { Flexbox } from '@lobehub/ui';
+import { memo, useCallback, useEffect, useRef } from 'react';
+import { useSearchParams } from 'react-router';
+
+import Loading from '@/components/Loading/BrandTextLoading';
+import ClassicOnboardingPage from '@/features/Onboarding/Classic';
+import OnboardingContainer from '@/features/Onboarding/Layout';
+import ResponseLanguageStep from '@/features/Onboarding/steps/ResponseLanguageStep';
+import TelemetryStep from '@/features/Onboarding/steps/TelemetryStep';
+import { useOnboardingAgentTemplates } from '@/hooks/useOnboardingAgentTemplates';
+import {
+ trackOnboardingStepCompleted,
+ trackOnboardingStepViewed,
+} from '@/services/onboardingMetrics';
+import { useUserStore } from '@/store/user';
+import { onboardingSelectors } from '@/store/user/selectors';
+import { clearStaleOnboardingCallbackUrl } from '@/utils/onboardingRedirect';
+
+const COMMON_STEP_TRACKING = {
+ 1: { flow: 'common', step: 'telemetry', stepIndex: 1 },
+ 2: { flow: 'common', step: 'response_language', stepIndex: 2 },
+} as const;
+
+const OnboardingPage = memo(() => {
+ const isUserStateInit = useUserStore((s) => s.isUserStateInit);
+ const commonStepsCompleted = useUserStore(onboardingSelectors.commonStepsCompleted);
+
+ const [searchParams, setSearchParams] = useSearchParams();
+ const step: 1 | 2 = searchParams.get('step') === '2' ? 2 : 1;
+ const hasStepParam = searchParams.has('step');
+ const viewedStepKeysRef = useRef<Set<string>>(new Set());
+
+ useOnboardingAgentTemplates(isUserStateInit && (!commonStepsCompleted || hasStepParam));
+
+ // This component only mounts on top-level entries to `/onboarding` (fresh
+ // signup landings and `?step` re-entries from the classic back button), so
+ // mount is the one safe point to drop a stale callback stashed by a
+ // previously abandoned attempt — later search changes are internal step
+ // navigations that must keep the stash.
+ useEffect(() => {
+ clearStaleOnboardingCallbackUrl(window.location.pathname, window.location.search);
+ }, []);
+
+ useEffect(() => {
+ if (!isUserStateInit || (commonStepsCompleted && !hasStepParam)) return;
+
+ const payload = COMMON_STEP_TRACKING[step];
+ if (viewedStepKeysRef.current.has(payload.step)) return;
+
+ viewedStepKeysRef.current.add(payload.step);
+ trackOnboardingStepViewed(payload);
+ }, [commonStepsCompleted, hasStepParam, isUserStateInit, step]);
+
+ const goNextFromTelemetry = useCallback(() => {
+ trackOnboardingStepCompleted(COMMON_STEP_TRACKING[1]);
+ setSearchParams({ step: '2' }, { replace: true });
+ }, [setSearchParams]);
+
+ const goBackFromLanguage = useCallback(() => {
+ setSearchParams({ step: '1' }, { replace: true });
+ }, [setSearchParams]);
+
+ const finishCommon = useCallback(() => {
+ trackOnboardingStepCompleted(COMMON_STEP_TRACKING[2]);
+ setSearchParams({}, { replace: true });
+ }, [setSearchParams]);
+
+ if (!isUserStateInit) {
+ return <Loading debugId="Onboarding/userState" />;
+ }
+
+ // With the shared prefix complete, `/onboarding` renders the classic branch
+ // inline — but an explicit `?step` (classic FullName back button) re-enters
+ // the prefix.
+ if (commonStepsCompleted && !hasStepParam) {
+ return <ClassicOnboardingPage />;
+ }
+
+ return (
+ <OnboardingContainer>
+ <Flexbox gap={24} style={{ maxWidth: 600, width: '100%' }}>
+ {step === 1 ? (
+ <TelemetryStep onNext={goNextFromTelemetry} />
+ ) : (
+ <ResponseLanguageStep onBack={goBackFromLanguage} onNext={finishCommon} />
+ )}
+ </Flexbox>
+ </OnboardingContainer>
+ );
+});
+
+OnboardingPage.displayName = 'OnboardingPage';
+
+export default OnboardingPage;
diff --git a/src/routes/onboarding/interestCategoryMap.test.ts b/src/features/Onboarding/interestCategoryMap.test.ts
similarity index 100%
rename from src/routes/onboarding/interestCategoryMap.test.ts
rename to src/features/Onboarding/interestCategoryMap.test.ts
diff --git a/src/routes/onboarding/interestCategoryMap.ts b/src/features/Onboarding/interestCategoryMap.ts
similarity index 100%
rename from src/routes/onboarding/interestCategoryMap.ts
rename to src/features/Onboarding/interestCategoryMap.ts
diff --git a/src/routes/onboarding/features/AgentPickerStep/AgentCard.tsx b/src/features/Onboarding/steps/AgentPickerStep/AgentCard.tsx
similarity index 100%
rename from src/routes/onboarding/features/AgentPickerStep/AgentCard.tsx
rename to src/features/Onboarding/steps/AgentPickerStep/AgentCard.tsx
diff --git a/src/routes/onboarding/features/AgentPickerStep/CategoryFilter.tsx b/src/features/Onboarding/steps/AgentPickerStep/CategoryFilter.tsx
similarity index 100%
rename from src/routes/onboarding/features/AgentPickerStep/CategoryFilter.tsx
rename to src/features/Onboarding/steps/AgentPickerStep/CategoryFilter.tsx
diff --git a/src/routes/onboarding/features/AgentPickerStep/Skeleton.tsx b/src/features/Onboarding/steps/AgentPickerStep/Skeleton.tsx
similarity index 100%
rename from src/routes/onboarding/features/AgentPickerStep/Skeleton.tsx
rename to src/features/Onboarding/steps/AgentPickerStep/Skeleton.tsx
diff --git a/src/routes/onboarding/features/AgentPickerStep/categoryLabels.ts b/src/features/Onboarding/steps/AgentPickerStep/categoryLabels.ts
similarity index 100%
rename from src/routes/onboarding/features/AgentPickerStep/categoryLabels.ts
rename to src/features/Onboarding/steps/AgentPickerStep/categoryLabels.ts
diff --git a/src/routes/onboarding/features/AgentPickerStep/index.test.tsx b/src/features/Onboarding/steps/AgentPickerStep/index.test.tsx
similarity index 100%
rename from src/routes/onboarding/features/AgentPickerStep/index.test.tsx
rename to src/features/Onboarding/steps/AgentPickerStep/index.test.tsx
diff --git a/src/routes/onboarding/features/AgentPickerStep/index.tsx b/src/features/Onboarding/steps/AgentPickerStep/index.tsx
similarity index 100%
rename from src/routes/onboarding/features/AgentPickerStep/index.tsx
rename to src/features/Onboarding/steps/AgentPickerStep/index.tsx
diff --git a/src/routes/onboarding/features/AgentPickerStep/style.ts b/src/features/Onboarding/steps/AgentPickerStep/style.ts
similarity index 100%
rename from src/routes/onboarding/features/AgentPickerStep/style.ts
rename to src/features/Onboarding/steps/AgentPickerStep/style.ts
diff --git a/src/routes/onboarding/features/FullNameStep.tsx b/src/features/Onboarding/steps/FullNameStep.tsx
similarity index 100%
rename from src/routes/onboarding/features/FullNameStep.tsx
rename to src/features/Onboarding/steps/FullNameStep.tsx
diff --git a/src/routes/onboarding/features/InterestsStep.test.tsx b/src/features/Onboarding/steps/InterestsStep.test.tsx
similarity index 100%
rename from src/routes/onboarding/features/InterestsStep.test.tsx
rename to src/features/Onboarding/steps/InterestsStep.test.tsx
diff --git a/src/routes/onboarding/features/InterestsStep.tsx b/src/features/Onboarding/steps/InterestsStep.tsx
similarity index 100%
rename from src/routes/onboarding/features/InterestsStep.tsx
rename to src/features/Onboarding/steps/InterestsStep.tsx
diff --git a/src/routes/onboarding/features/ProSettingsStep.test.tsx b/src/features/Onboarding/steps/ProSettingsStep.test.tsx
similarity index 97%
rename from src/routes/onboarding/features/ProSettingsStep.test.tsx
rename to src/features/Onboarding/steps/ProSettingsStep.test.tsx
index 2cd476b76ae..da793af386e 100644
--- a/src/routes/onboarding/features/ProSettingsStep.test.tsx
+++ b/src/features/Onboarding/steps/ProSettingsStep.test.tsx
@@ -44,7 +44,7 @@ vi.mock('react-i18next', () => ({
}),
}));
-vi.mock('@/routes/onboarding/components/LobeMessage', () => ({
+vi.mock('@/features/Onboarding/components/LobeMessage', () => ({
default: ({ sentences }: { sentences: string[] }) => <div>{sentences.join(' / ')}</div>,
}));
diff --git a/src/routes/onboarding/features/ProSettingsStep.tsx b/src/features/Onboarding/steps/ProSettingsStep.tsx
similarity index 96%
rename from src/routes/onboarding/features/ProSettingsStep.tsx
rename to src/features/Onboarding/steps/ProSettingsStep.tsx
index 64af6900c13..75911408072 100644
--- a/src/routes/onboarding/features/ProSettingsStep.tsx
+++ b/src/features/Onboarding/steps/ProSettingsStep.tsx
@@ -7,7 +7,7 @@ import { Undo2Icon } from 'lucide-react';
import { memo, useCallback, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
-import LobeMessage from '@/routes/onboarding/components/LobeMessage';
+import LobeMessage from '@/features/Onboarding/components/LobeMessage';
import ComposioServerList from '../components/ComposioServerList';
diff --git a/src/routes/onboarding/features/ResponseLanguageStep.tsx b/src/features/Onboarding/steps/ResponseLanguageStep.tsx
similarity index 100%
rename from src/routes/onboarding/features/ResponseLanguageStep.tsx
rename to src/features/Onboarding/steps/ResponseLanguageStep.tsx
diff --git a/src/routes/onboarding/features/TelemetryStep.tsx b/src/features/Onboarding/steps/TelemetryStep.tsx
similarity index 100%
rename from src/routes/onboarding/features/TelemetryStep.tsx
rename to src/features/Onboarding/steps/TelemetryStep.tsx
diff --git a/src/features/PageEditor/Copilot/AgentSelector/AgentItem.tsx b/src/features/PageEditor/Copilot/AgentSelector/AgentItem.tsx
index 2ca8ad2687e..539e325079f 100644
--- a/src/features/PageEditor/Copilot/AgentSelector/AgentItem.tsx
+++ b/src/features/PageEditor/Copilot/AgentSelector/AgentItem.tsx
@@ -4,8 +4,8 @@ import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import HeterogeneousTag from '@/features/HeterogeneousTag';
+import AgentAvatar from '@/features/HomeSidebar/Body/Agent/List/AgentItem/Avatar';
import NavItem from '@/features/NavPanel/components/NavItem';
-import AgentAvatar from '@/routes/(main)/home/_layout/Body/Agent/List/AgentItem/Avatar';
interface AgentItemProps {
active: boolean;
diff --git a/src/features/PageEditor/Copilot/AgentSelector/AgentSelectorAction.tsx b/src/features/PageEditor/Copilot/AgentSelector/AgentSelectorAction.tsx
index 515ebafb978..238aa9c4029 100644
--- a/src/features/PageEditor/Copilot/AgentSelector/AgentSelectorAction.tsx
+++ b/src/features/PageEditor/Copilot/AgentSelector/AgentSelectorAction.tsx
@@ -6,10 +6,10 @@ import { memo, Suspense, useCallback, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { conversationSelectors, useConversationStore } from '@/features/Conversation';
+import AgentAvatar from '@/features/HomeSidebar/Body/Agent/List/AgentItem/Avatar';
+import { AgentModalProvider } from '@/features/HomeSidebar/Body/Agent/ModalProvider';
import SkeletonList from '@/features/NavPanel/components/SkeletonList';
import { useFetchAgentList } from '@/hooks/useFetchAgentList';
-import AgentAvatar from '@/routes/(main)/home/_layout/Body/Agent/List/AgentItem/Avatar';
-import { AgentModalProvider } from '@/routes/(main)/home/_layout/Body/Agent/ModalProvider';
import { useAgentStore } from '@/store/agent';
import { useHomeStore } from '@/store/home';
import { homeAgentListSelectors } from '@/store/home/selectors';
diff --git a/src/features/RecommendTaskTemplates/TemplateBriefIcon.tsx b/src/features/RecommendTaskTemplates/TemplateBriefIcon.tsx
index bd1d64796a2..5ebcba32b13 100644
--- a/src/features/RecommendTaskTemplates/TemplateBriefIcon.tsx
+++ b/src/features/RecommendTaskTemplates/TemplateBriefIcon.tsx
@@ -3,7 +3,7 @@ import { cssVar } from 'antd-style';
import type { LucideIcon } from 'lucide-react';
import { memo } from 'react';
-import { INTEREST_AREAS } from '@/routes/onboarding/config';
+import { INTEREST_AREAS } from '@/features/Onboarding/config';
import type { TemplateIconSpec } from './resolveTemplateIcon';
diff --git a/src/routes/(main)/resource/(home)/_layout/Body/LibraryList/Item/Actions.tsx b/src/features/ResourceHome/Layout/Body/LibraryList/Item/Actions.tsx
similarity index 100%
rename from src/routes/(main)/resource/(home)/_layout/Body/LibraryList/Item/Actions.tsx
rename to src/features/ResourceHome/Layout/Body/LibraryList/Item/Actions.tsx
diff --git a/src/routes/(main)/resource/(home)/_layout/Body/LibraryList/Item/Editing.test.tsx b/src/features/ResourceHome/Layout/Body/LibraryList/Item/Editing.test.tsx
similarity index 100%
rename from src/routes/(main)/resource/(home)/_layout/Body/LibraryList/Item/Editing.test.tsx
rename to src/features/ResourceHome/Layout/Body/LibraryList/Item/Editing.test.tsx
diff --git a/src/routes/(main)/resource/(home)/_layout/Body/LibraryList/Item/Editing.tsx b/src/features/ResourceHome/Layout/Body/LibraryList/Item/Editing.tsx
similarity index 100%
rename from src/routes/(main)/resource/(home)/_layout/Body/LibraryList/Item/Editing.tsx
rename to src/features/ResourceHome/Layout/Body/LibraryList/Item/Editing.tsx
diff --git a/src/routes/(main)/resource/(home)/_layout/Body/LibraryList/Item/index.test.tsx b/src/features/ResourceHome/Layout/Body/LibraryList/Item/index.test.tsx
similarity index 97%
rename from src/routes/(main)/resource/(home)/_layout/Body/LibraryList/Item/index.test.tsx
rename to src/features/ResourceHome/Layout/Body/LibraryList/Item/index.test.tsx
index 68a96e7ab21..4efd690fa1f 100644
--- a/src/routes/(main)/resource/(home)/_layout/Body/LibraryList/Item/index.test.tsx
+++ b/src/features/ResourceHome/Layout/Body/LibraryList/Item/index.test.tsx
@@ -38,7 +38,7 @@ vi.mock('@/hooks/usePermission', () => ({
usePermission: () => ({ allowed: true }),
}));
-vi.mock('@/routes/(main)/resource/features/store', () => ({
+vi.mock('@/features/ResourceManager/store', () => ({
useResourceManagerStore: (selector: (state: { setLibraryId: () => void }) => unknown) =>
selector({ setLibraryId: vi.fn() }),
}));
diff --git a/src/routes/(main)/resource/(home)/_layout/Body/LibraryList/Item/index.tsx b/src/features/ResourceHome/Layout/Body/LibraryList/Item/index.tsx
similarity index 97%
rename from src/routes/(main)/resource/(home)/_layout/Body/LibraryList/Item/index.tsx
rename to src/features/ResourceHome/Layout/Body/LibraryList/Item/index.tsx
index 2d267e7f19c..98be4fade07 100644
--- a/src/routes/(main)/resource/(home)/_layout/Body/LibraryList/Item/index.tsx
+++ b/src/features/ResourceHome/Layout/Body/LibraryList/Item/index.tsx
@@ -6,9 +6,9 @@ import React, { memo, useCallback, useMemo } from 'react';
import RepoIcon from '@/components/LibIcon';
import NavItem from '@/features/NavPanel/components/NavItem';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import { usePermission } from '@/hooks/usePermission';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
import { useKnowledgeBaseStore } from '@/store/library';
import Actions from './Actions';
diff --git a/src/routes/(main)/resource/(home)/_layout/Body/LibraryList/Item/useDropdownMenu.tsx b/src/features/ResourceHome/Layout/Body/LibraryList/Item/useDropdownMenu.tsx
similarity index 100%
rename from src/routes/(main)/resource/(home)/_layout/Body/LibraryList/Item/useDropdownMenu.tsx
rename to src/features/ResourceHome/Layout/Body/LibraryList/Item/useDropdownMenu.tsx
diff --git a/src/routes/(main)/resource/(home)/_layout/Body/LibraryList/index.tsx b/src/features/ResourceHome/Layout/Body/LibraryList/index.tsx
similarity index 97%
rename from src/routes/(main)/resource/(home)/_layout/Body/LibraryList/index.tsx
rename to src/features/ResourceHome/Layout/Body/LibraryList/index.tsx
index 9b3af4a9f08..10961ac30e7 100644
--- a/src/routes/(main)/resource/(home)/_layout/Body/LibraryList/index.tsx
+++ b/src/features/ResourceHome/Layout/Body/LibraryList/index.tsx
@@ -8,9 +8,9 @@ import AsyncBoundary from '@/components/AsyncBoundary';
import { useCreateNewModal } from '@/features/LibraryModal';
import EmptyNavItem from '@/features/NavPanel/components/EmptyNavItem';
import SkeletonList from '@/features/NavPanel/components/SkeletonList';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import { usePermission } from '@/hooks/usePermission';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
import { useKnowledgeBaseStore } from '@/store/library';
import Item from './Item';
diff --git a/src/routes/(main)/resource/(home)/_layout/Body/LibraryList/state.test.ts b/src/features/ResourceHome/Layout/Body/LibraryList/state.test.ts
similarity index 100%
rename from src/routes/(main)/resource/(home)/_layout/Body/LibraryList/state.test.ts
rename to src/features/ResourceHome/Layout/Body/LibraryList/state.test.ts
diff --git a/src/routes/(main)/resource/(home)/_layout/Body/LibraryList/state.ts b/src/features/ResourceHome/Layout/Body/LibraryList/state.ts
similarity index 100%
rename from src/routes/(main)/resource/(home)/_layout/Body/LibraryList/state.ts
rename to src/features/ResourceHome/Layout/Body/LibraryList/state.ts
diff --git a/src/routes/(main)/resource/(home)/_layout/Body/index.tsx b/src/features/ResourceHome/Layout/Body/index.tsx
similarity index 100%
rename from src/routes/(main)/resource/(home)/_layout/Body/index.tsx
rename to src/features/ResourceHome/Layout/Body/index.tsx
diff --git a/src/routes/(main)/resource/(home)/_layout/Header/CategoryMenu.tsx b/src/features/ResourceHome/Layout/Header/CategoryMenu.tsx
similarity index 97%
rename from src/routes/(main)/resource/(home)/_layout/Header/CategoryMenu.tsx
rename to src/features/ResourceHome/Layout/Header/CategoryMenu.tsx
index 33dd3c961ee..97e894c6ecf 100644
--- a/src/routes/(main)/resource/(home)/_layout/Header/CategoryMenu.tsx
+++ b/src/features/ResourceHome/Layout/Header/CategoryMenu.tsx
@@ -15,12 +15,11 @@ import { Link } from 'react-router';
import { useBusinessResourceCategories } from '@/business/client/features/ResourceCategories';
import NavItem from '@/features/NavPanel/components/NavItem';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import { useActiveLocation } from '@/hooks/useActiveLocation';
import { FilesTabs } from '@/types/files';
-import { useResourceManagerStore } from '../../../features/store';
-
const CategoryMenu = memo(() => {
const { t } = useTranslation('file');
const [activeKey, setMode] = useResourceManagerStore((s) => [s.category, s.setMode]);
diff --git a/src/routes/(main)/resource/(home)/_layout/Header/index.tsx b/src/features/ResourceHome/Layout/Header/index.tsx
similarity index 100%
rename from src/routes/(main)/resource/(home)/_layout/Header/index.tsx
rename to src/features/ResourceHome/Layout/Header/index.tsx
diff --git a/src/routes/(main)/resource/(home)/_layout/Sidebar.tsx b/src/features/ResourceHome/Layout/Sidebar.tsx
similarity index 100%
rename from src/routes/(main)/resource/(home)/_layout/Sidebar.tsx
rename to src/features/ResourceHome/Layout/Sidebar.tsx
diff --git a/src/routes/(main)/resource/(home)/_layout/SidebarContent.tsx b/src/features/ResourceHome/Layout/SidebarContent.tsx
similarity index 100%
rename from src/routes/(main)/resource/(home)/_layout/SidebarContent.tsx
rename to src/features/ResourceHome/Layout/SidebarContent.tsx
diff --git a/src/features/ResourceHome/Layout/index.tsx b/src/features/ResourceHome/Layout/index.tsx
new file mode 100644
index 00000000000..a45b05f274c
--- /dev/null
+++ b/src/features/ResourceHome/Layout/index.tsx
@@ -0,0 +1,21 @@
+'use client';
+
+import { Flexbox } from '@lobehub/ui';
+import { type FC } from 'react';
+import { Outlet } from 'react-router';
+
+import Sidebar from './Sidebar';
+import { styles } from './style';
+
+const HomeLayout: FC = () => {
+ return (
+ <>
+ <Sidebar />
+ <Flexbox className={styles.mainContainer} flex={1} height={'100%'}>
+ <Outlet />
+ </Flexbox>
+ </>
+ );
+};
+
+export default HomeLayout;
diff --git a/src/routes/(main)/resource/(home)/_layout/style.ts b/src/features/ResourceHome/Layout/style.ts
similarity index 100%
rename from src/routes/(main)/resource/(home)/_layout/style.ts
rename to src/features/ResourceHome/Layout/style.ts
diff --git a/src/features/ResourceHome/index.tsx b/src/features/ResourceHome/index.tsx
new file mode 100644
index 00000000000..6b2f9e65ceb
--- /dev/null
+++ b/src/features/ResourceHome/index.tsx
@@ -0,0 +1,60 @@
+'use client';
+
+import { memo, useLayoutEffect } from 'react';
+import { useLocation, useSearchParams } from 'react-router';
+
+import ResourceManager from '@/features/ResourceManager';
+import { useInitFileCheck } from '@/features/ResourceManager/hooks/useInitFileCheck';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
+import WorkGallery from '@/features/WorkGallery';
+import { parseWorkGalleryKey } from '@/features/WorkGallery/const';
+import { FilesTabs } from '@/types/files';
+
+const ResourceHomePage = memo(() => {
+ const [searchParams] = useSearchParams();
+ const location = useLocation();
+ const [setCategory, setLibraryId] = useResourceManagerStore((s) => [
+ s.setCategory,
+ s.setLibraryId,
+ ]);
+
+ const categoryParam = (searchParams.get('category') as FilesTabs) || FilesTabs.All;
+ // `?works=<type>` switches the content area to the cross-topic Work gallery,
+ // independent of the file explorer (which stays keyed on `?category=`).
+ const worksKey = parseWorkGalleryKey(searchParams.get('works'));
+
+ // Clear libraryId when on home route using useLayoutEffect
+ // useLayoutEffect runs synchronously before browser paint, ensuring state is cleared
+ // before child components' useEffects run, while avoiding React's setState-in-render error
+ // IMPORTANT: Only depend on location.pathname, NOT currentLibraryId to avoid feedback loop
+ // When location changes to /resource, clear libraryId
+ // Don't clear when location is /library/* (even if this component is still mounted)
+ useLayoutEffect(() => {
+ const isOnHomeRoute =
+ location.pathname === '/resource' || !location.pathname.includes('/library/');
+ if (isOnHomeRoute) {
+ setLibraryId(undefined);
+ }
+ }, [setLibraryId, location.pathname]);
+
+ // Sync category from URL using useLayoutEffect
+ // IMPORTANT: Only sync if we're actually on the home route (not transitioning to library)
+ useLayoutEffect(() => {
+ const isOnHomeRoute =
+ location.pathname === '/resource' || !location.pathname.includes('/library/');
+ if (isOnHomeRoute) {
+ setCategory(categoryParam);
+ }
+ }, [categoryParam, setCategory, location.pathname]);
+
+ // Sync file view mode from URL
+ useInitFileCheck();
+
+ if (worksKey) return <WorkGallery galleryKey={worksKey} />;
+
+ return <ResourceManager />;
+});
+
+ResourceHomePage.displayName = 'ResourceHomePage';
+
+export default ResourceHomePage;
diff --git a/src/routes/(main)/resource/library/features/Container.tsx b/src/features/ResourceLibrary/Container.tsx
similarity index 100%
rename from src/routes/(main)/resource/library/features/Container.tsx
rename to src/features/ResourceLibrary/Container.tsx
diff --git a/src/routes/(main)/resource/library/_layout/Header/LibraryHead.tsx b/src/features/ResourceLibrary/Layout/Header/LibraryHead.tsx
similarity index 96%
rename from src/routes/(main)/resource/library/_layout/Header/LibraryHead.tsx
rename to src/features/ResourceLibrary/Layout/Header/LibraryHead.tsx
index 168d53d43e8..77cb9e8be9e 100644
--- a/src/routes/(main)/resource/library/_layout/Header/LibraryHead.tsx
+++ b/src/features/ResourceLibrary/Layout/Header/LibraryHead.tsx
@@ -17,9 +17,9 @@ import { memo, useCallback, useMemo, useState } from 'react';
import BusinessKnowledgeBaseImportAction from '@/business/client/BusinessKnowledgeBaseImportAction';
import RepoIcon from '@/components/LibIcon';
+import { useDragActive } from '@/features/ResourceManager/DndContextWrapper';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-import { useDragActive } from '@/routes/(main)/resource/features/DndContextWrapper';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
import { knowledgeBaseSelectors, useKnowledgeBaseStore } from '@/store/library';
const styles = createStaticStyles(({ css, cssVar }) => ({
diff --git a/src/routes/(main)/resource/library/_layout/Header/index.tsx b/src/features/ResourceLibrary/Layout/Header/index.tsx
similarity index 100%
rename from src/routes/(main)/resource/library/_layout/Header/index.tsx
rename to src/features/ResourceLibrary/Layout/Header/index.tsx
diff --git a/src/routes/(main)/resource/library/_layout/Header/useActiveLibraryId.desktop.test.ts b/src/features/ResourceLibrary/Layout/Header/useActiveLibraryId.desktop.test.ts
similarity index 100%
rename from src/routes/(main)/resource/library/_layout/Header/useActiveLibraryId.desktop.test.ts
rename to src/features/ResourceLibrary/Layout/Header/useActiveLibraryId.desktop.test.ts
diff --git a/src/routes/(main)/resource/library/_layout/Header/useActiveLibraryId.ts b/src/features/ResourceLibrary/Layout/Header/useActiveLibraryId.ts
similarity index 100%
rename from src/routes/(main)/resource/library/_layout/Header/useActiveLibraryId.ts
rename to src/features/ResourceLibrary/Layout/Header/useActiveLibraryId.ts
diff --git a/src/routes/(main)/resource/library/_layout/Sidebar.tsx b/src/features/ResourceLibrary/Layout/Sidebar.tsx
similarity index 100%
rename from src/routes/(main)/resource/library/_layout/Sidebar.tsx
rename to src/features/ResourceLibrary/Layout/Sidebar.tsx
diff --git a/src/features/ResourceLibrary/Layout/index.tsx b/src/features/ResourceLibrary/Layout/index.tsx
new file mode 100644
index 00000000000..f3a8a34091e
--- /dev/null
+++ b/src/features/ResourceLibrary/Layout/index.tsx
@@ -0,0 +1,24 @@
+'use client';
+
+import { Flexbox } from '@lobehub/ui';
+import { type FC } from 'react';
+import { Outlet } from 'react-router';
+
+import RegisterHotkeys from '@/features/ResourceLibrary/RegisterHotkeys';
+
+import Sidebar from './Sidebar';
+import { styles } from './style';
+
+const LibraryLayout: FC = () => {
+ return (
+ <>
+ <Sidebar />
+ <Flexbox className={styles.mainContainer} flex={1} height={'100%'}>
+ <Outlet />
+ </Flexbox>
+ <RegisterHotkeys />
+ </>
+ );
+};
+
+export default LibraryLayout;
diff --git a/src/routes/(main)/resource/library/_layout/style.ts b/src/features/ResourceLibrary/Layout/style.ts
similarity index 100%
rename from src/routes/(main)/resource/library/_layout/style.ts
rename to src/features/ResourceLibrary/Layout/style.ts
diff --git a/src/routes/(main)/resource/_layout/RegisterHotkeys.tsx b/src/features/ResourceLibrary/RegisterHotkeys.tsx
similarity index 100%
rename from src/routes/(main)/resource/_layout/RegisterHotkeys.tsx
rename to src/features/ResourceLibrary/RegisterHotkeys.tsx
diff --git a/src/features/ResourceLibrary/index.tsx b/src/features/ResourceLibrary/index.tsx
new file mode 100644
index 00000000000..7df9d61032e
--- /dev/null
+++ b/src/features/ResourceLibrary/index.tsx
@@ -0,0 +1,62 @@
+'use client';
+
+import { memo, useLayoutEffect } from 'react';
+import { useLocation, useParams } from 'react-router';
+
+import NotFound from '@/components/404';
+import AsyncError from '@/components/AsyncError';
+import NProgress from '@/components/NProgress';
+import Container from '@/features/ResourceLibrary/Container';
+import ResourceManager from '@/features/ResourceManager';
+import { useInitFileCheck } from '@/features/ResourceManager/hooks/useInitFileCheck';
+import { useKnowledgeBaseItem } from '@/features/ResourceManager/hooks/useKnowledgeItem';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
+
+const MainContent = memo(() => {
+ const { id: knowledgeBaseId } = useParams<{ id: string }>();
+ const location = useLocation();
+ const setLibraryId = useResourceManagerStore((s) => s.setLibraryId);
+
+ // Load knowledge base data
+ const { data, isLoading, error, mutate } = useKnowledgeBaseItem(knowledgeBaseId || '');
+
+ // Sync libraryId from URL params using useLayoutEffect
+ // useLayoutEffect runs synchronously before browser paint, ensuring state is set
+ // before Explorer component renders and computes query parameters
+ // IMPORTANT: Only depend on knowledgeBaseId and location.pathname, NOT currentLibraryId to avoid feedback loop
+ useLayoutEffect(() => {
+ const isOnLibraryRoute = location.pathname.includes('/library/');
+ if (isOnLibraryRoute) {
+ setLibraryId(knowledgeBaseId);
+ }
+ }, [knowledgeBaseId, setLibraryId, location.pathname]);
+
+ // Sync file view mode from URL
+ useInitFileCheck();
+
+ // A network / 500 on the KB fetch is NOT "this library doesn't exist" (Read §1.1):
+ // branch a transient error to a reload state that keeps the URL, and reserve the
+ // terminal 404 for a genuinely resolved-null (deleted / never-existed) record.
+ if (error && !data) return <AsyncError error={error} variant={'page'} onRetry={() => mutate()} />;
+
+ if (!isLoading && !data) return <NotFound />;
+
+ return <ResourceManager />;
+});
+
+MainContent.displayName = 'LibraryMainContent';
+
+const LibraryPage = memo(() => {
+ return (
+ <>
+ <NProgress />
+ <Container>
+ <MainContent />
+ </Container>
+ </>
+ );
+});
+
+LibraryPage.displayName = 'LibraryPage';
+
+export default LibraryPage;
diff --git a/src/routes/(main)/resource/features/DndContextWrapper.tsx b/src/features/ResourceManager/DndContextWrapper.tsx
similarity index 100%
rename from src/routes/(main)/resource/features/DndContextWrapper.tsx
rename to src/features/ResourceManager/DndContextWrapper.tsx
diff --git a/src/routes/(main)/resource/features/FileDetail.tsx b/src/features/ResourceManager/FileDetail.tsx
similarity index 100%
rename from src/routes/(main)/resource/features/FileDetail.tsx
rename to src/features/ResourceManager/FileDetail.tsx
diff --git a/src/routes/(main)/resource/library/features/RegisterHotkeys.tsx b/src/features/ResourceManager/Layout/RegisterHotkeys.tsx
similarity index 100%
rename from src/routes/(main)/resource/library/features/RegisterHotkeys.tsx
rename to src/features/ResourceManager/Layout/RegisterHotkeys.tsx
diff --git a/src/features/ResourceManager/Layout/index.tsx b/src/features/ResourceManager/Layout/index.tsx
new file mode 100644
index 00000000000..e169f43b1f2
--- /dev/null
+++ b/src/features/ResourceManager/Layout/index.tsx
@@ -0,0 +1,17 @@
+'use client';
+
+import { type FC } from 'react';
+import { Outlet } from 'react-router';
+
+import RegisterHotkeys from './RegisterHotkeys';
+
+const ResourceLayout: FC = () => {
+ return (
+ <>
+ <Outlet />
+ <RegisterHotkeys />
+ </>
+ );
+};
+
+export default ResourceLayout;
diff --git a/src/features/ResourceManager/components/Editor/index.tsx b/src/features/ResourceManager/components/Editor/index.tsx
index 2023b5eb44a..9f2b332e77f 100644
--- a/src/features/ResourceManager/components/Editor/index.tsx
+++ b/src/features/ResourceManager/components/Editor/index.tsx
@@ -10,8 +10,8 @@ import { useTranslation } from 'react-i18next';
import NavHeader from '@/features/NavHeader';
import { PageAgentProvider } from '@/features/PageEditor/PageAgentProvider';
-import FileDetailComponent from '@/routes/(main)/resource/features/FileDetail';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
+import FileDetailComponent from '@/features/ResourceManager/FileDetail';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
import { fileManagerSelectors, useFileStore } from '@/store/file';
import { downloadFile } from '@/utils/client/downloadFile';
diff --git a/src/features/ResourceManager/components/Explorer/EmptyPlaceholder.test.tsx b/src/features/ResourceManager/components/Explorer/EmptyPlaceholder.test.tsx
index 9052e05f7ae..7275ae95cd7 100644
--- a/src/features/ResourceManager/components/Explorer/EmptyPlaceholder.test.tsx
+++ b/src/features/ResourceManager/components/Explorer/EmptyPlaceholder.test.tsx
@@ -22,11 +22,11 @@ vi.mock('@/hooks/usePermission', () => ({
usePermission: () => ({ allowed: canCreate, reason: '' }),
}));
-vi.mock('@/routes/(main)/resource/features/hooks/useCurrentFolderId', () => ({
+vi.mock('@/features/ResourceManager/hooks/useCurrentFolderId', () => ({
useCurrentFolderId: () => undefined,
}));
-vi.mock('@/routes/(main)/resource/features/store', () => ({
+vi.mock('@/features/ResourceManager/store', () => ({
useResourceManagerStore: (selector: (state: { libraryId?: string }) => unknown) =>
selector({ libraryId }),
}));
diff --git a/src/features/ResourceManager/components/Explorer/EmptyPlaceholder.tsx b/src/features/ResourceManager/components/Explorer/EmptyPlaceholder.tsx
index 6f342309b2d..07d4370f2e6 100644
--- a/src/features/ResourceManager/components/Explorer/EmptyPlaceholder.tsx
+++ b/src/features/ResourceManager/components/Explorer/EmptyPlaceholder.tsx
@@ -5,10 +5,10 @@ import { ArrowUpIcon, PlusIcon } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { useCreateNewModal } from '@/features/LibraryModal';
+import { useCurrentFolderId } from '@/features/ResourceManager/hooks/useCurrentFolderId';
import { useTopLevelFileUpload } from '@/features/ResourceManager/hooks/useTopLevelFileUpload';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
import { usePermission } from '@/hooks/usePermission';
-import { useCurrentFolderId } from '@/routes/(main)/resource/features/hooks/useCurrentFolderId';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
import { useFileStore } from '@/store/file';
const ICON_SIZE = 80;
diff --git a/src/features/ResourceManager/components/Explorer/Header/Breadcrumb.tsx b/src/features/ResourceManager/components/Explorer/Header/Breadcrumb.tsx
index 1b47d67f64f..276b0019179 100644
--- a/src/features/ResourceManager/components/Explorer/Header/Breadcrumb.tsx
+++ b/src/features/ResourceManager/components/Explorer/Header/Breadcrumb.tsx
@@ -4,9 +4,9 @@ import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import { useSearchParams } from 'react-router';
+import { useFolderPath } from '@/features/ResourceManager/hooks/useFolderPath';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-import { useFolderPath } from '@/routes/(main)/resource/features/hooks/useFolderPath';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
import { useFileStore } from '@/store/file';
import { knowledgeBaseSelectors, useKnowledgeBaseStore } from '@/store/library';
import { FilesTabs } from '@/types/files';
diff --git a/src/features/ResourceManager/components/Explorer/Header/SearchInput.tsx b/src/features/ResourceManager/components/Explorer/Header/SearchInput.tsx
index eb0bd6fe87e..e68e289dc2b 100644
--- a/src/features/ResourceManager/components/Explorer/Header/SearchInput.tsx
+++ b/src/features/ResourceManager/components/Explorer/Header/SearchInput.tsx
@@ -7,7 +7,7 @@ import { SearchIcon, XIcon } from 'lucide-react';
import { memo, useCallback, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
const SearchInput = memo(() => {
const { t } = useTranslation('components');
diff --git a/src/features/ResourceManager/components/Explorer/Header/index.tsx b/src/features/ResourceManager/components/Explorer/Header/index.tsx
index 5fefa266884..bc89dfd8ff6 100644
--- a/src/features/ResourceManager/components/Explorer/Header/index.tsx
+++ b/src/features/ResourceManager/components/Explorer/Header/index.tsx
@@ -11,10 +11,10 @@ import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspace
import { useFileBatchTransferActions } from '@/business/client/hooks/useFileBatchTransferActions';
import { useIsWorkspaceOwner } from '@/business/client/hooks/useIsWorkspaceOwner';
import NavHeader from '@/features/NavHeader';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
+import { getExplorerSelectedCount } from '@/features/ResourceManager/store/selectors';
import { openWorkspaceDeleteAllModal } from '@/features/WorkspaceDeleteAllModal';
import { usePermission } from '@/hooks/usePermission';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
-import { getExplorerSelectedCount } from '@/routes/(main)/resource/features/store/selectors';
import { useFileStore } from '@/store/file';
import { FilesTabs } from '@/types/files';
diff --git a/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.test.tsx b/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.test.tsx
index 26d40e866b3..2d080fcbc80 100644
--- a/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.test.tsx
+++ b/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.test.tsx
@@ -36,7 +36,7 @@ vi.mock('react-i18next', () => ({
}),
}));
-vi.mock('@/routes/(main)/resource/features/store', () => ({
+vi.mock('@/features/ResourceManager/store', () => ({
useResourceManagerStore: (selector: (state: any) => unknown) =>
selector({
libraryId: undefined,
@@ -47,7 +47,7 @@ vi.mock('@/routes/(main)/resource/features/store', () => ({
}),
}));
-vi.mock('@/routes/(main)/resource/features/store/selectors', () => ({
+vi.mock('@/features/ResourceManager/store/selectors', () => ({
isExplorerItemSelected: () => false,
}));
diff --git a/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.tsx b/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.tsx
index 26840cb110c..269a18098ce 100644
--- a/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.tsx
+++ b/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.tsx
@@ -5,8 +5,8 @@ import { memo, useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { shallow } from 'zustand/shallow';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
-import { isExplorerItemSelected } from '@/routes/(main)/resource/features/store/selectors';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
+import { isExplorerItemSelected } from '@/features/ResourceManager/store/selectors';
import { fileManagerSelectors, getChunkTargetId, useFileStore } from '@/store/file';
import type { FileListItem as FileListItemType } from '@/types/files';
import { formatSize } from '@/utils/format';
diff --git a/src/features/ResourceManager/components/Explorer/ListView/ListItem/useFileListItemDrag.ts b/src/features/ResourceManager/components/Explorer/ListView/ListItem/useFileListItemDrag.ts
index 1750732cd6e..1aaf31fdcba 100644
--- a/src/features/ResourceManager/components/Explorer/ListView/ListItem/useFileListItemDrag.ts
+++ b/src/features/ResourceManager/components/Explorer/ListView/ListItem/useFileListItemDrag.ts
@@ -5,7 +5,7 @@ import {
getTransparentDragImage,
useDragActive,
useSetCurrentDrag,
-} from '@/routes/(main)/resource/features/DndContextWrapper';
+} from '@/features/ResourceManager/DndContextWrapper';
import { useFileStore } from '@/store/file';
interface UseFileListItemDragOptions {
diff --git a/src/features/ResourceManager/components/Explorer/ListView/ListViewSelectAllHint.tsx b/src/features/ResourceManager/components/Explorer/ListView/ListViewSelectAllHint.tsx
index 6c6a1bc5337..2efaaf37373 100644
--- a/src/features/ResourceManager/components/Explorer/ListView/ListViewSelectAllHint.tsx
+++ b/src/features/ResourceManager/components/Explorer/ListView/ListViewSelectAllHint.tsx
@@ -2,7 +2,7 @@ import { Flexbox } from '@lobehub/ui';
import { Button } from '@lobehub/ui/base-ui';
import { useTranslation } from 'react-i18next';
-import type { SelectAllState } from '@/routes/(main)/resource/features/store/initialState';
+import type { SelectAllState } from '@/features/ResourceManager/store/initialState';
import { getListViewMinWidth } from './ListItem/constants';
import { styles } from './styles';
diff --git a/src/features/ResourceManager/components/Explorer/ListView/VirtualizedFileList.tsx b/src/features/ResourceManager/components/Explorer/ListView/VirtualizedFileList.tsx
index 0a1c7a2e030..69ace31af40 100644
--- a/src/features/ResourceManager/components/Explorer/ListView/VirtualizedFileList.tsx
+++ b/src/features/ResourceManager/components/Explorer/ListView/VirtualizedFileList.tsx
@@ -3,8 +3,8 @@ import { useCallback, useEffect, useRef } from 'react';
import type { VirtuosoHandle } from 'react-virtuoso';
import { Virtuoso } from 'react-virtuoso';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
-import { isExplorerItemSelected } from '@/routes/(main)/resource/features/store/selectors';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
+import { isExplorerItemSelected } from '@/features/ResourceManager/store/selectors';
import type { FileListItem } from '@/types/files';
import { useExplorerSelectionActions } from '../hooks/useExplorerSelection';
diff --git a/src/features/ResourceManager/components/Explorer/ListView/useExplorerDropZone.ts b/src/features/ResourceManager/components/Explorer/ListView/useExplorerDropZone.ts
index 50892ebd20d..df20858619f 100644
--- a/src/features/ResourceManager/components/Explorer/ListView/useExplorerDropZone.ts
+++ b/src/features/ResourceManager/components/Explorer/ListView/useExplorerDropZone.ts
@@ -2,7 +2,7 @@ import type { DragEvent, RefObject } from 'react';
import { useCallback, useEffect, useRef, useState } from 'react';
import type { VirtuosoHandle } from 'react-virtuoso';
-import { useDragActive } from '@/routes/(main)/resource/features/DndContextWrapper';
+import { useDragActive } from '@/features/ResourceManager/DndContextWrapper';
export const useExplorerDropZone = (virtuosoRef: RefObject<VirtuosoHandle | null>) => {
const isDragActive = useDragActive();
diff --git a/src/features/ResourceManager/components/Explorer/ListView/useExplorerListData.test.ts b/src/features/ResourceManager/components/Explorer/ListView/useExplorerListData.test.ts
index 532e01c292f..a963cd92d63 100644
--- a/src/features/ResourceManager/components/Explorer/ListView/useExplorerListData.test.ts
+++ b/src/features/ResourceManager/components/Explorer/ListView/useExplorerListData.test.ts
@@ -20,16 +20,16 @@ const mocks = vi.hoisted(() => ({
},
}));
-vi.mock('@/routes/(main)/resource/features/hooks/useCurrentFolderId', () => ({
+vi.mock('@/features/ResourceManager/hooks/useCurrentFolderId', () => ({
useCurrentFolderId: () => null,
}));
-vi.mock('@/routes/(main)/resource/features/store', () => ({
+vi.mock('@/features/ResourceManager/store', () => ({
useResourceManagerStore: (selector: (state: typeof mocks.resourceManagerState) => unknown) =>
selector(mocks.resourceManagerState),
}));
-vi.mock('@/routes/(main)/resource/features/store/selectors', () => ({
+vi.mock('@/features/ResourceManager/store/selectors', () => ({
sortFileList: (items: unknown[]) => items,
}));
diff --git a/src/features/ResourceManager/components/Explorer/ListView/useExplorerListData.ts b/src/features/ResourceManager/components/Explorer/ListView/useExplorerListData.ts
index 9814beee886..0a471e07238 100644
--- a/src/features/ResourceManager/components/Explorer/ListView/useExplorerListData.ts
+++ b/src/features/ResourceManager/components/Explorer/ListView/useExplorerListData.ts
@@ -1,8 +1,8 @@
import { useMemo } from 'react';
-import { useCurrentFolderId } from '@/routes/(main)/resource/features/hooks/useCurrentFolderId';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
-import { sortFileList } from '@/routes/(main)/resource/features/store/selectors';
+import { useCurrentFolderId } from '@/features/ResourceManager/hooks/useCurrentFolderId';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
+import { sortFileList } from '@/features/ResourceManager/store/selectors';
import { useFileStore } from '@/store/file';
import { useGlobalStore } from '@/store/global';
import {
diff --git a/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/MasonryItemWrapper.tsx b/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/MasonryItemWrapper.tsx
index 333ee9a7903..7ef9d1d4224 100644
--- a/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/MasonryItemWrapper.tsx
+++ b/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/MasonryItemWrapper.tsx
@@ -1,6 +1,6 @@
import { memo } from 'react';
-import { isExplorerItemSelected } from '@/routes/(main)/resource/features/store/selectors';
+import { isExplorerItemSelected } from '@/features/ResourceManager/store/selectors';
import { type FileListItem } from '@/types/files';
import MasonryFileItem from '.';
diff --git a/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/index.tsx b/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/index.tsx
index 99aba66a239..ebb9d634e98 100644
--- a/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/index.tsx
+++ b/src/features/ResourceManager/components/Explorer/MasonryView/MasonryItem/index.tsx
@@ -8,12 +8,12 @@ import { createStaticStyles, cssVar, cx } from 'antd-style';
import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
-import { showContextMenu } from '@/libs/contextMenu';
import {
getTransparentDragImage,
useDragActive,
useSetCurrentDrag,
-} from '@/routes/(main)/resource/features/DndContextWrapper';
+} from '@/features/ResourceManager/DndContextWrapper';
+import { showContextMenu } from '@/libs/contextMenu';
import { documentService } from '@/services/document';
import { getChunkTargetId, useFileStore } from '@/store/file';
import { type FileListItem } from '@/types/files';
diff --git a/src/features/ResourceManager/components/Explorer/MasonryView/index.tsx b/src/features/ResourceManager/components/Explorer/MasonryView/index.tsx
index 26ee9f312a6..7f383c08b08 100644
--- a/src/features/ResourceManager/components/Explorer/MasonryView/index.tsx
+++ b/src/features/ResourceManager/components/Explorer/MasonryView/index.tsx
@@ -8,8 +8,8 @@ import { type UIEvent } from 'react';
import { memo, useCallback, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
-import { sortFileList } from '@/routes/(main)/resource/features/store/selectors';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
+import { sortFileList } from '@/features/ResourceManager/store/selectors';
import { useFileStore } from '@/store/file';
import { type FileListItem } from '@/types/files';
import type { ResourceQueryParams } from '@/types/resource';
diff --git a/src/features/ResourceManager/components/Explorer/MasonryView/useMasonryViewState.ts b/src/features/ResourceManager/components/Explorer/MasonryView/useMasonryViewState.ts
index 10114b8530f..71ef552d652 100644
--- a/src/features/ResourceManager/components/Explorer/MasonryView/useMasonryViewState.ts
+++ b/src/features/ResourceManager/components/Explorer/MasonryView/useMasonryViewState.ts
@@ -1,6 +1,6 @@
import { useMemo } from 'react';
-import type { ViewMode } from '@/routes/(main)/resource/features/store/initialState';
+import type { ViewMode } from '@/features/ResourceManager/store/initialState';
interface UseMasonryViewStateOptions {
dataLength: number;
diff --git a/src/features/ResourceManager/components/Explorer/SearchResultsOverlay.tsx b/src/features/ResourceManager/components/Explorer/SearchResultsOverlay.tsx
index 6252d8c34bb..a1b0bc568e0 100644
--- a/src/features/ResourceManager/components/Explorer/SearchResultsOverlay.tsx
+++ b/src/features/ResourceManager/components/Explorer/SearchResultsOverlay.tsx
@@ -11,10 +11,10 @@ import { Virtuoso } from 'react-virtuoso';
import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';
import AsyncError from '@/components/AsyncError';
import NeuralNetworkLoading from '@/components/NeuralNetworkLoading';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
+import { getResourceQueryVisibility } from '@/features/ResourceManager/store/selectors';
import { useClientDataSWR } from '@/libs/swr';
import { resourceKeys } from '@/libs/swr/keys';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
-import { getResourceQueryVisibility } from '@/routes/(main)/resource/features/store/selectors';
import { resourceService } from '@/services/resource';
import { useGlobalStore } from '@/store/global';
import {
diff --git a/src/features/ResourceManager/components/Explorer/ToolBar/BatchActionsDropdown.tsx b/src/features/ResourceManager/components/Explorer/ToolBar/BatchActionsDropdown.tsx
index bbb06a34681..6b1decb85fe 100644
--- a/src/features/ResourceManager/components/Explorer/ToolBar/BatchActionsDropdown.tsx
+++ b/src/features/ResourceManager/components/Explorer/ToolBar/BatchActionsDropdown.tsx
@@ -15,9 +15,9 @@ import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspace
import { useIsWorkspaceOwner } from '@/business/client/hooks/useIsWorkspaceOwner';
import RepoIcon from '@/components/LibIcon';
import { useKnowledgeBaseListContext } from '@/features/ResourceManager/components/KnowledgeBaseListProvider';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
import { openWorkspaceDeleteAllModal } from '@/features/WorkspaceDeleteAllModal';
import { usePermission } from '@/hooks/usePermission';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
import { useKnowledgeBaseStore } from '@/store/library';
import ActionIconWithChevron from './ActionIconWithChevron';
diff --git a/src/features/ResourceManager/components/Explorer/ToolBar/SortDropdown.tsx b/src/features/ResourceManager/components/Explorer/ToolBar/SortDropdown.tsx
index b41f0e23bd6..c9dd2df1f8e 100644
--- a/src/features/ResourceManager/components/Explorer/ToolBar/SortDropdown.tsx
+++ b/src/features/ResourceManager/components/Explorer/ToolBar/SortDropdown.tsx
@@ -5,7 +5,7 @@ import { memo, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { type MenuProps } from '@/components/Menu';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
import ActionIconWithChevron from './ActionIconWithChevron';
diff --git a/src/features/ResourceManager/components/Explorer/hooks/useExplorerSelection.test.tsx b/src/features/ResourceManager/components/Explorer/hooks/useExplorerSelection.test.tsx
index 82792bd8924..3dadb2e7cfa 100644
--- a/src/features/ResourceManager/components/Explorer/hooks/useExplorerSelection.test.tsx
+++ b/src/features/ResourceManager/components/Explorer/hooks/useExplorerSelection.test.tsx
@@ -1,8 +1,8 @@
import { act, renderHook } from '@testing-library/react';
import { beforeEach, describe, expect, it } from 'vitest';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
-import { initialState } from '@/routes/(main)/resource/features/store/initialState';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
+import { initialState } from '@/features/ResourceManager/store/initialState';
import { isExplorerItemSelectable, useExplorerSelectionActions } from './useExplorerSelection';
diff --git a/src/features/ResourceManager/components/Explorer/hooks/useExplorerSelection.ts b/src/features/ResourceManager/components/Explorer/hooks/useExplorerSelection.ts
index 26fc9aa89fb..14085fdac61 100644
--- a/src/features/ResourceManager/components/Explorer/hooks/useExplorerSelection.ts
+++ b/src/features/ResourceManager/components/Explorer/hooks/useExplorerSelection.ts
@@ -2,13 +2,13 @@ import { useCallback, useMemo } from 'react';
import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';
import { useIsWorkspaceOwner } from '@/business/client/hooks/useIsWorkspaceOwner';
-import { useEventCallback } from '@/hooks/useEventCallback';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
import {
getExplorerSelectAllUiState,
getExplorerSelectedCount,
isExplorerItemSelected,
-} from '@/routes/(main)/resource/features/store/selectors';
+} from '@/features/ResourceManager/store/selectors';
+import { useEventCallback } from '@/hooks/useEventCallback';
import { useFileStore } from '@/store/file';
import { useUserStore } from '@/store/user';
import { userProfileSelectors } from '@/store/user/selectors';
diff --git a/src/features/ResourceManager/components/Explorer/hooks/useFileItemClick.ts b/src/features/ResourceManager/components/Explorer/hooks/useFileItemClick.ts
index 2f46b5fc73f..92a188223a0 100644
--- a/src/features/ResourceManager/components/Explorer/hooks/useFileItemClick.ts
+++ b/src/features/ResourceManager/components/Explorer/hooks/useFileItemClick.ts
@@ -1,8 +1,8 @@
import { useCallback } from 'react';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import { useActiveLocation } from '@/hooks/useActiveLocation';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
export interface UseFileItemClickOptions {
id: string;
diff --git a/src/features/ResourceManager/components/Explorer/hooks/useResetSelectionOnQueryChange.test.tsx b/src/features/ResourceManager/components/Explorer/hooks/useResetSelectionOnQueryChange.test.tsx
index 49eff21860e..abb0ad79a3b 100644
--- a/src/features/ResourceManager/components/Explorer/hooks/useResetSelectionOnQueryChange.test.tsx
+++ b/src/features/ResourceManager/components/Explorer/hooks/useResetSelectionOnQueryChange.test.tsx
@@ -1,8 +1,8 @@
import { act, renderHook } from '@testing-library/react';
import { beforeEach, describe, expect, it } from 'vitest';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
-import { initialState } from '@/routes/(main)/resource/features/store/initialState';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
+import { initialState } from '@/features/ResourceManager/store/initialState';
import { FilesTabs } from '@/types/files';
import { useResetSelectionOnQueryChange } from './useResetSelectionOnQueryChange';
diff --git a/src/features/ResourceManager/components/Explorer/hooks/useResetSelectionOnQueryChange.ts b/src/features/ResourceManager/components/Explorer/hooks/useResetSelectionOnQueryChange.ts
index 922cdbc3e69..ed3869b6767 100644
--- a/src/features/ResourceManager/components/Explorer/hooks/useResetSelectionOnQueryChange.ts
+++ b/src/features/ResourceManager/components/Explorer/hooks/useResetSelectionOnQueryChange.ts
@@ -1,6 +1,6 @@
import { useEffect } from 'react';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
import type { FilesTabs } from '@/types/files';
interface ResetSelectionOnQueryChangeOptions {
diff --git a/src/features/ResourceManager/components/Explorer/hooks/useViewMode.ts b/src/features/ResourceManager/components/Explorer/hooks/useViewMode.ts
index be05c0dff94..f42bc01f97c 100644
--- a/src/features/ResourceManager/components/Explorer/hooks/useViewMode.ts
+++ b/src/features/ResourceManager/components/Explorer/hooks/useViewMode.ts
@@ -1,8 +1,8 @@
import { useCallback, useEffect } from 'react';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
+import { type ViewMode } from '@/features/ResourceManager/store/initialState';
import { parseAsStringEnum, useQueryState } from '@/hooks/useQueryParam';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
-import { type ViewMode } from '@/routes/(main)/resource/features/store/initialState';
/**
* Hook to manage view mode with URL query sync
diff --git a/src/features/ResourceManager/components/Explorer/index.test.tsx b/src/features/ResourceManager/components/Explorer/index.test.tsx
index 6df41116bd4..0aea1bea15c 100644
--- a/src/features/ResourceManager/components/Explorer/index.test.tsx
+++ b/src/features/ResourceManager/components/Explorer/index.test.tsx
@@ -19,20 +19,20 @@ const mocks = vi.hoisted(() => ({
useFetchResources: vi.fn(),
}));
-vi.mock('@/routes/(main)/resource/features/hooks/useFolderPath', () => ({
+vi.mock('@/features/ResourceManager/hooks/useFolderPath', () => ({
useFolderPath: () => ({ currentFolderSlug: null }),
}));
-vi.mock('@/routes/(main)/resource/features/hooks/useResourceManagerUrlSync', () => ({
+vi.mock('@/features/ResourceManager/hooks/useResourceManagerUrlSync', () => ({
useResourceManagerUrlSync: vi.fn(),
}));
-vi.mock('@/routes/(main)/resource/features/store', () => ({
+vi.mock('@/features/ResourceManager/store', () => ({
useResourceManagerStore: (selector: (state: typeof mocks.resourceManagerState) => unknown) =>
selector(mocks.resourceManagerState),
}));
-vi.mock('@/routes/(main)/resource/features/store/selectors', () => ({
+vi.mock('@/features/ResourceManager/store/selectors', () => ({
getResourceQueryVisibility: (
libraryId: string | undefined,
visibility: 'private' | 'workspace',
diff --git a/src/features/ResourceManager/components/Explorer/index.tsx b/src/features/ResourceManager/components/Explorer/index.tsx
index f48296b2d6f..14b3c5fc47e 100644
--- a/src/features/ResourceManager/components/Explorer/index.tsx
+++ b/src/features/ResourceManager/components/Explorer/index.tsx
@@ -4,13 +4,13 @@ import { Flexbox } from '@lobehub/ui';
import { memo, useMemo } from 'react';
import AsyncBoundary from '@/components/AsyncBoundary';
-import { useFolderPath } from '@/routes/(main)/resource/features/hooks/useFolderPath';
-import { useResourceManagerUrlSync } from '@/routes/(main)/resource/features/hooks/useResourceManagerUrlSync';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
+import { useFolderPath } from '@/features/ResourceManager/hooks/useFolderPath';
+import { useResourceManagerUrlSync } from '@/features/ResourceManager/hooks/useResourceManagerUrlSync';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
import {
getResourceQueryVisibility,
sortFileList,
-} from '@/routes/(main)/resource/features/store/selectors';
+} from '@/features/ResourceManager/store/selectors';
import { useFetchResources, useResourceStore } from '@/store/file/slices/resource/hooks';
import { KnowledgeBaseListProvider } from '../KnowledgeBaseListProvider';
diff --git a/src/features/ResourceManager/components/Header/AddButton.tsx b/src/features/ResourceManager/components/Header/AddButton.tsx
index d29c0b44ac6..e5701afb454 100644
--- a/src/features/ResourceManager/components/Header/AddButton.tsx
+++ b/src/features/ResourceManager/components/Header/AddButton.tsx
@@ -15,10 +15,10 @@ import { type ChangeEvent } from 'react';
import { useCallback, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import { useCurrentFolderId } from '@/features/ResourceManager/hooks/useCurrentFolderId';
import { useTopLevelFileUpload } from '@/features/ResourceManager/hooks/useTopLevelFileUpload';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
import { usePermission } from '@/hooks/usePermission';
-import { useCurrentFolderId } from '@/routes/(main)/resource/features/hooks/useCurrentFolderId';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
import { useFileStore } from '@/store/file';
import { FilesTabs } from '@/types/files';
diff --git a/src/features/ResourceManager/components/LibraryHierarchy/HierarchyNode.tsx b/src/features/ResourceManager/components/LibraryHierarchy/HierarchyNode.tsx
index 2c60c02873c..dea3fea5612 100644
--- a/src/features/ResourceManager/components/LibraryHierarchy/HierarchyNode.tsx
+++ b/src/features/ResourceManager/components/LibraryHierarchy/HierarchyNode.tsx
@@ -12,14 +12,14 @@ import React, { memo, useCallback, useMemo, useRef, useState } from 'react';
import FileIcon from '@/components/FileIcon';
import { PAGE_FILE_TYPE } from '@/features/ResourceManager/constants';
-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-import { showContextMenu } from '@/libs/contextMenu';
import {
getTransparentDragImage,
useDragActive,
useSetCurrentDrag,
-} from '@/routes/(main)/resource/features/DndContextWrapper';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
+} from '@/features/ResourceManager/DndContextWrapper';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
+import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
+import { showContextMenu } from '@/libs/contextMenu';
import type { TreeItem } from '@/store/tree';
import { useTreeStore } from '@/store/tree';
diff --git a/src/features/ResourceManager/components/LibraryHierarchy/index.tsx b/src/features/ResourceManager/components/LibraryHierarchy/index.tsx
index 52cb2ee1282..fdb37996f5e 100644
--- a/src/features/ResourceManager/components/LibraryHierarchy/index.tsx
+++ b/src/features/ResourceManager/components/LibraryHierarchy/index.tsx
@@ -8,8 +8,8 @@ import { useTranslation } from 'react-i18next';
import { VList } from 'virtua';
import AsyncBoundary from '@/components/AsyncBoundary';
-import { useFolderPath } from '@/routes/(main)/resource/features/hooks/useFolderPath';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
+import { useFolderPath } from '@/features/ResourceManager/hooks/useFolderPath';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
import { useFileStore } from '@/store/file';
import type { TreeItem } from '@/store/tree';
import { useTreeStore } from '@/store/tree';
diff --git a/src/features/ResourceManager/components/ResourceModeToggle/index.tsx b/src/features/ResourceManager/components/ResourceModeToggle/index.tsx
index a07cb1251a6..4a1a7997941 100644
--- a/src/features/ResourceManager/components/ResourceModeToggle/index.tsx
+++ b/src/features/ResourceManager/components/ResourceModeToggle/index.tsx
@@ -7,8 +7,8 @@ import { memo, useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
-import type { ResourceListVisibilityFilter } from '@/routes/(main)/resource/features/store/initialState';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
+import type { ResourceListVisibilityFilter } from '@/features/ResourceManager/store/initialState';
const styles = createStaticStyles(({ css, cssVar }) => {
return {
diff --git a/src/routes/(main)/resource/features/hooks/useCurrentFolderId.ts b/src/features/ResourceManager/hooks/useCurrentFolderId.ts
similarity index 100%
rename from src/routes/(main)/resource/features/hooks/useCurrentFolderId.ts
rename to src/features/ResourceManager/hooks/useCurrentFolderId.ts
diff --git a/src/routes/(main)/resource/features/hooks/useFolderPath.ts b/src/features/ResourceManager/hooks/useFolderPath.ts
similarity index 100%
rename from src/routes/(main)/resource/features/hooks/useFolderPath.ts
rename to src/features/ResourceManager/hooks/useFolderPath.ts
diff --git a/src/routes/(main)/resource/features/hooks/useInitFileCheck.ts b/src/features/ResourceManager/hooks/useInitFileCheck.ts
similarity index 100%
rename from src/routes/(main)/resource/features/hooks/useInitFileCheck.ts
rename to src/features/ResourceManager/hooks/useInitFileCheck.ts
diff --git a/src/routes/(main)/resource/features/hooks/useKnowledgeItem.ts b/src/features/ResourceManager/hooks/useKnowledgeItem.ts
similarity index 100%
rename from src/routes/(main)/resource/features/hooks/useKnowledgeItem.ts
rename to src/features/ResourceManager/hooks/useKnowledgeItem.ts
diff --git a/src/routes/(main)/resource/features/hooks/useResourceManagerUrlSync.ts b/src/features/ResourceManager/hooks/useResourceManagerUrlSync.ts
similarity index 92%
rename from src/routes/(main)/resource/features/hooks/useResourceManagerUrlSync.ts
rename to src/features/ResourceManager/hooks/useResourceManagerUrlSync.ts
index 4d3c13e543a..36bcb368ac0 100644
--- a/src/routes/(main)/resource/features/hooks/useResourceManagerUrlSync.ts
+++ b/src/features/ResourceManager/hooks/useResourceManagerUrlSync.ts
@@ -1,7 +1,7 @@
import { useEffect } from 'react';
import { useSearchParams } from 'react-router';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
import { SortType } from '@/types/files';
/**
@@ -21,9 +21,7 @@ export const useResourceManagerUrlSync = () => {
// Initialize store from URL on mount (URL → Store)
useEffect(() => {
const sorterParam = (searchParams.get('sorter') || 'createdAt') as
- | 'name'
- | 'createdAt'
- | 'size';
+ 'name' | 'createdAt' | 'size';
const sortTypeParam = (searchParams.get('sortType') || SortType.Desc) as SortType;
setSorter(sorterParam);
diff --git a/src/features/ResourceManager/hooks/useTopLevelFileUpload.ts b/src/features/ResourceManager/hooks/useTopLevelFileUpload.ts
index 6767004966d..dfd90840af4 100644
--- a/src/features/ResourceManager/hooks/useTopLevelFileUpload.ts
+++ b/src/features/ResourceManager/hooks/useTopLevelFileUpload.ts
@@ -1,8 +1,8 @@
import { useCallback } from 'react';
import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';
-import { useCurrentFolderId } from '@/routes/(main)/resource/features/hooks/useCurrentFolderId';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
+import { useCurrentFolderId } from '@/features/ResourceManager/hooks/useCurrentFolderId';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
import { useFileStore } from '@/store/file';
/**
diff --git a/src/features/ResourceManager/index.tsx b/src/features/ResourceManager/index.tsx
index ef839166853..eea1cdaa87e 100644
--- a/src/features/ResourceManager/index.tsx
+++ b/src/features/ResourceManager/index.tsx
@@ -7,9 +7,9 @@ import { useSearchParams } from 'react-router';
import DragUploadZone from '@/components/DragUploadZone';
import { PageEditor } from '@/features/PageEditor';
+import { useResourceManagerStore } from '@/features/ResourceManager/store';
import { usePermission } from '@/hooks/usePermission';
import dynamic from '@/libs/next/dynamic';
-import { useResourceManagerStore } from '@/routes/(main)/resource/features/store';
import { documentService } from '@/services/document';
import { useFileStore } from '@/store/file';
import { documentSelectors } from '@/store/file/slices/document/selectors';
diff --git a/src/routes/(main)/resource/features/store/action.test.ts b/src/features/ResourceManager/store/action.test.ts
similarity index 100%
rename from src/routes/(main)/resource/features/store/action.test.ts
rename to src/features/ResourceManager/store/action.test.ts
diff --git a/src/routes/(main)/resource/features/store/action.ts b/src/features/ResourceManager/store/action.ts
similarity index 100%
rename from src/routes/(main)/resource/features/store/action.ts
rename to src/features/ResourceManager/store/action.ts
diff --git a/src/routes/(main)/resource/features/store/index.ts b/src/features/ResourceManager/store/index.ts
similarity index 100%
rename from src/routes/(main)/resource/features/store/index.ts
rename to src/features/ResourceManager/store/index.ts
diff --git a/src/routes/(main)/resource/features/store/initialState.ts b/src/features/ResourceManager/store/initialState.ts
similarity index 100%
rename from src/routes/(main)/resource/features/store/initialState.ts
rename to src/features/ResourceManager/store/initialState.ts
diff --git a/src/routes/(main)/resource/features/store/modePersistence.ts b/src/features/ResourceManager/store/modePersistence.ts
similarity index 100%
rename from src/routes/(main)/resource/features/store/modePersistence.ts
rename to src/features/ResourceManager/store/modePersistence.ts
diff --git a/src/routes/(main)/resource/features/store/selectors.test.ts b/src/features/ResourceManager/store/selectors.test.ts
similarity index 100%
rename from src/routes/(main)/resource/features/store/selectors.test.ts
rename to src/features/ResourceManager/store/selectors.test.ts
diff --git a/src/routes/(main)/resource/features/store/selectors.ts b/src/features/ResourceManager/store/selectors.ts
similarity index 100%
rename from src/routes/(main)/resource/features/store/selectors.ts
rename to src/features/ResourceManager/store/selectors.ts
diff --git a/src/routes/(main)/settings/_layout/Body/activeTab.desktop.test.ts b/src/features/Settings/Layout/Body/activeTab.desktop.test.ts
similarity index 100%
rename from src/routes/(main)/settings/_layout/Body/activeTab.desktop.test.ts
rename to src/features/Settings/Layout/Body/activeTab.desktop.test.ts
diff --git a/src/routes/(main)/settings/_layout/Body/index.tsx b/src/features/Settings/Layout/Body/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/_layout/Body/index.tsx
rename to src/features/Settings/Layout/Body/index.tsx
diff --git a/src/routes/(main)/settings/_layout/ContextProvider/index.tsx b/src/features/Settings/Layout/ContextProvider/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/_layout/ContextProvider/index.tsx
rename to src/features/Settings/Layout/ContextProvider/index.tsx
diff --git a/src/routes/(main)/settings/_layout/Header.tsx b/src/features/Settings/Layout/Header.tsx
similarity index 100%
rename from src/routes/(main)/settings/_layout/Header.tsx
rename to src/features/Settings/Layout/Header.tsx
diff --git a/src/routes/(main)/settings/_layout/SideBar.tsx b/src/features/Settings/Layout/SideBar.tsx
similarity index 100%
rename from src/routes/(main)/settings/_layout/SideBar.tsx
rename to src/features/Settings/Layout/SideBar.tsx
diff --git a/src/routes/(main)/settings/_layout/SidebarContent.tsx b/src/features/Settings/Layout/SidebarContent.tsx
similarity index 100%
rename from src/routes/(main)/settings/_layout/SidebarContent.tsx
rename to src/features/Settings/Layout/SidebarContent.tsx
diff --git a/src/features/Settings/Layout/index.tsx b/src/features/Settings/Layout/index.tsx
new file mode 100644
index 00000000000..f330cbff7bb
--- /dev/null
+++ b/src/features/Settings/Layout/index.tsx
@@ -0,0 +1,28 @@
+'use client';
+
+import { Flexbox } from '@lobehub/ui';
+import { type FC } from 'react';
+import { Outlet } from 'react-router';
+
+import SideBar from '@/features/Settings/Layout/SideBar';
+
+import SettingsContextProvider from './ContextProvider';
+import { styles } from './style';
+
+const Layout: FC = () => {
+ return (
+ <SettingsContextProvider
+ value={{
+ showOpenAIApiKey: true,
+ showOpenAIProxyUrl: true,
+ }}
+ >
+ <SideBar />
+ <Flexbox className={styles.mainContainer} flex={1} height={'100%'}>
+ <Outlet />
+ </Flexbox>
+ </SettingsContextProvider>
+ );
+};
+
+export default Layout;
diff --git a/src/routes/(main)/settings/_layout/style.ts b/src/features/Settings/Layout/style.ts
similarity index 100%
rename from src/routes/(main)/settings/_layout/style.ts
rename to src/features/Settings/Layout/style.ts
diff --git a/src/routes/(main)/settings/_layout/type.ts b/src/features/Settings/Layout/type.ts
similarity index 100%
rename from src/routes/(main)/settings/_layout/type.ts
rename to src/features/Settings/Layout/type.ts
diff --git a/src/routes/(main)/settings/about/features/About.tsx b/src/features/Settings/about/features/About.tsx
similarity index 100%
rename from src/routes/(main)/settings/about/features/About.tsx
rename to src/features/Settings/about/features/About.tsx
diff --git a/src/routes/(main)/settings/about/features/AboutList.tsx b/src/features/Settings/about/features/AboutList.tsx
similarity index 100%
rename from src/routes/(main)/settings/about/features/AboutList.tsx
rename to src/features/Settings/about/features/AboutList.tsx
diff --git a/src/routes/(main)/settings/about/features/Analytics.tsx b/src/features/Settings/about/features/Analytics.tsx
similarity index 100%
rename from src/routes/(main)/settings/about/features/Analytics.tsx
rename to src/features/Settings/about/features/Analytics.tsx
diff --git a/src/routes/(main)/settings/about/features/ItemCard.tsx b/src/features/Settings/about/features/ItemCard.tsx
similarity index 100%
rename from src/routes/(main)/settings/about/features/ItemCard.tsx
rename to src/features/Settings/about/features/ItemCard.tsx
diff --git a/src/routes/(main)/settings/about/features/ItemLink.tsx b/src/features/Settings/about/features/ItemLink.tsx
similarity index 100%
rename from src/routes/(main)/settings/about/features/ItemLink.tsx
rename to src/features/Settings/about/features/ItemLink.tsx
diff --git a/src/routes/(main)/settings/about/features/Version.tsx b/src/features/Settings/about/features/Version.tsx
similarity index 100%
rename from src/routes/(main)/settings/about/features/Version.tsx
rename to src/features/Settings/about/features/Version.tsx
diff --git a/src/routes/(main)/settings/about/features/appVersion.desktop.ts b/src/features/Settings/about/features/appVersion.desktop.ts
similarity index 100%
rename from src/routes/(main)/settings/about/features/appVersion.desktop.ts
rename to src/features/Settings/about/features/appVersion.desktop.ts
diff --git a/src/routes/(main)/settings/about/features/appVersion.ts b/src/features/Settings/about/features/appVersion.ts
similarity index 100%
rename from src/routes/(main)/settings/about/features/appVersion.ts
rename to src/features/Settings/about/features/appVersion.ts
diff --git a/src/routes/(main)/settings/about/index.tsx b/src/features/Settings/about/index.tsx
similarity index 86%
rename from src/routes/(main)/settings/about/index.tsx
rename to src/features/Settings/about/index.tsx
index 51570c9c214..cb60baaa40f 100644
--- a/src/routes/(main)/settings/about/index.tsx
+++ b/src/features/Settings/about/index.tsx
@@ -1,6 +1,6 @@
import { useTranslation } from 'react-i18next';
-import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
+import SettingHeader from '@/features/Settings/features/SettingHeader';
import About from './features/About';
import Analytics from './features/Analytics';
diff --git a/src/routes/(main)/settings/advanced/index.tsx b/src/features/Settings/advanced/index.tsx
similarity index 98%
rename from src/routes/(main)/settings/advanced/index.tsx
rename to src/features/Settings/advanced/index.tsx
index 0466e70e2c1..87cc6312b34 100644
--- a/src/routes/(main)/settings/advanced/index.tsx
+++ b/src/features/Settings/advanced/index.tsx
@@ -12,8 +12,8 @@ import { useTranslation } from 'react-i18next';
import AsyncError from '@/components/AsyncError';
import { FORM_STYLE } from '@/const/layoutTokens';
+import SettingHeader from '@/features/Settings/features/SettingHeader';
import { SettingsSearchAnchor } from '@/features/SettingsSearch/anchor';
-import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
import { autoUpdateService } from '@/services/electron/autoUpdate';
import { serverConfigSelectors, useServerConfigStore } from '@/store/serverConfig';
import { useUserStore } from '@/store/user';
diff --git a/src/routes/(main)/settings/advanced/settingsCopy.test.ts b/src/features/Settings/advanced/settingsCopy.test.ts
similarity index 100%
rename from src/routes/(main)/settings/advanced/settingsCopy.test.ts
rename to src/features/Settings/advanced/settingsCopy.test.ts
diff --git a/src/routes/(main)/settings/apikey/features/ApiKey.test.tsx b/src/features/Settings/apikey/features/ApiKey.test.tsx
similarity index 100%
rename from src/routes/(main)/settings/apikey/features/ApiKey.test.tsx
rename to src/features/Settings/apikey/features/ApiKey.test.tsx
diff --git a/src/routes/(main)/settings/apikey/features/ApiKey.tsx b/src/features/Settings/apikey/features/ApiKey.tsx
similarity index 100%
rename from src/routes/(main)/settings/apikey/features/ApiKey.tsx
rename to src/features/Settings/apikey/features/ApiKey.tsx
diff --git a/src/routes/(main)/settings/apikey/features/ApiKeyDatePicker/index.tsx b/src/features/Settings/apikey/features/ApiKeyDatePicker/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/apikey/features/ApiKeyDatePicker/index.tsx
rename to src/features/Settings/apikey/features/ApiKeyDatePicker/index.tsx
diff --git a/src/routes/(main)/settings/apikey/features/ApiKeyDisplay/index.tsx b/src/features/Settings/apikey/features/ApiKeyDisplay/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/apikey/features/ApiKeyDisplay/index.tsx
rename to src/features/Settings/apikey/features/ApiKeyDisplay/index.tsx
diff --git a/src/routes/(main)/settings/apikey/features/ApiKeyModal/Content.tsx b/src/features/Settings/apikey/features/ApiKeyModal/Content.tsx
similarity index 100%
rename from src/routes/(main)/settings/apikey/features/ApiKeyModal/Content.tsx
rename to src/features/Settings/apikey/features/ApiKeyModal/Content.tsx
diff --git a/src/routes/(main)/settings/apikey/features/ApiKeyModal/index.tsx b/src/features/Settings/apikey/features/ApiKeyModal/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/apikey/features/ApiKeyModal/index.tsx
rename to src/features/Settings/apikey/features/ApiKeyModal/index.tsx
diff --git a/src/routes/(main)/settings/apikey/features/EditableCell/index.tsx b/src/features/Settings/apikey/features/EditableCell/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/apikey/features/EditableCell/index.tsx
rename to src/features/Settings/apikey/features/EditableCell/index.tsx
diff --git a/src/routes/(main)/settings/apikey/features/index.ts b/src/features/Settings/apikey/features/index.ts
similarity index 100%
rename from src/routes/(main)/settings/apikey/features/index.ts
rename to src/features/Settings/apikey/features/index.ts
diff --git a/src/routes/(main)/settings/apikey/index.tsx b/src/features/Settings/apikey/index.tsx
similarity index 83%
rename from src/routes/(main)/settings/apikey/index.tsx
rename to src/features/Settings/apikey/index.tsx
index 51ebe19acb3..7ceaab16bf5 100644
--- a/src/routes/(main)/settings/apikey/index.tsx
+++ b/src/features/Settings/apikey/index.tsx
@@ -1,6 +1,6 @@
import { useTranslation } from 'react-i18next';
-import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
+import SettingHeader from '@/features/Settings/features/SettingHeader';
import ApiKey from './features/ApiKey';
diff --git a/src/routes/(main)/settings/appearance/features/Desktop.tsx b/src/features/Settings/appearance/features/Desktop.tsx
similarity index 100%
rename from src/routes/(main)/settings/appearance/features/Desktop.tsx
rename to src/features/Settings/appearance/features/Desktop.tsx
diff --git a/src/features/Settings/Appearance/Terminal/index.test.tsx b/src/features/Settings/appearance/features/Terminal/index.test.tsx
similarity index 100%
rename from src/features/Settings/Appearance/Terminal/index.test.tsx
rename to src/features/Settings/appearance/features/Terminal/index.test.tsx
diff --git a/src/features/Settings/Appearance/Terminal/index.tsx b/src/features/Settings/appearance/features/Terminal/index.tsx
similarity index 100%
rename from src/features/Settings/Appearance/Terminal/index.tsx
rename to src/features/Settings/appearance/features/Terminal/index.tsx
diff --git a/src/routes/(main)/settings/appearance/index.tsx b/src/features/Settings/appearance/index.tsx
similarity index 82%
rename from src/routes/(main)/settings/appearance/index.tsx
rename to src/features/Settings/appearance/index.tsx
index fc052d17c99..04fafe2d7c0 100644
--- a/src/routes/(main)/settings/appearance/index.tsx
+++ b/src/features/Settings/appearance/index.tsx
@@ -1,12 +1,12 @@
import { useTranslation } from 'react-i18next';
-import Terminal from '@/features/Settings/Appearance/Terminal';
-import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
+import SettingHeader from '@/features/Settings/features/SettingHeader';
import ChatAppearance from '../chat-appearance/features/ChatAppearance';
import Appearance from '../common/features/Appearance';
import Common from '../common/features/Common/Common';
import Desktop from './features/Desktop';
+import Terminal from './features/Terminal';
interface PageProps {
showSettingHeader?: boolean;
diff --git a/src/routes/(main)/settings/chat-appearance/features/ChatAppearance/ChatPreview.tsx b/src/features/Settings/chat-appearance/features/ChatAppearance/ChatPreview.tsx
similarity index 100%
rename from src/routes/(main)/settings/chat-appearance/features/ChatAppearance/ChatPreview.tsx
rename to src/features/Settings/chat-appearance/features/ChatAppearance/ChatPreview.tsx
diff --git a/src/routes/(main)/settings/chat-appearance/features/ChatAppearance/ChatTransitionPreview.tsx b/src/features/Settings/chat-appearance/features/ChatAppearance/ChatTransitionPreview.tsx
similarity index 100%
rename from src/routes/(main)/settings/chat-appearance/features/ChatAppearance/ChatTransitionPreview.tsx
rename to src/features/Settings/chat-appearance/features/ChatAppearance/ChatTransitionPreview.tsx
diff --git a/src/routes/(main)/settings/chat-appearance/features/ChatAppearance/HighlighterPreview.tsx b/src/features/Settings/chat-appearance/features/ChatAppearance/HighlighterPreview.tsx
similarity index 100%
rename from src/routes/(main)/settings/chat-appearance/features/ChatAppearance/HighlighterPreview.tsx
rename to src/features/Settings/chat-appearance/features/ChatAppearance/HighlighterPreview.tsx
diff --git a/src/routes/(main)/settings/chat-appearance/features/ChatAppearance/LinkIconPreview.tsx b/src/features/Settings/chat-appearance/features/ChatAppearance/LinkIconPreview.tsx
similarity index 100%
rename from src/routes/(main)/settings/chat-appearance/features/ChatAppearance/LinkIconPreview.tsx
rename to src/features/Settings/chat-appearance/features/ChatAppearance/LinkIconPreview.tsx
diff --git a/src/routes/(main)/settings/chat-appearance/features/ChatAppearance/MermaidPreview.tsx b/src/features/Settings/chat-appearance/features/ChatAppearance/MermaidPreview.tsx
similarity index 100%
rename from src/routes/(main)/settings/chat-appearance/features/ChatAppearance/MermaidPreview.tsx
rename to src/features/Settings/chat-appearance/features/ChatAppearance/MermaidPreview.tsx
diff --git a/src/routes/(main)/settings/chat-appearance/features/ChatAppearance/index.tsx b/src/features/Settings/chat-appearance/features/ChatAppearance/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/chat-appearance/features/ChatAppearance/index.tsx
rename to src/features/Settings/chat-appearance/features/ChatAppearance/index.tsx
diff --git a/src/routes/(main)/settings/common/features/Appearance/Preview.tsx b/src/features/Settings/common/features/Appearance/Preview.tsx
similarity index 100%
rename from src/routes/(main)/settings/common/features/Appearance/Preview.tsx
rename to src/features/Settings/common/features/Appearance/Preview.tsx
diff --git a/src/routes/(main)/settings/common/features/Appearance/ThemeSwatches/ThemeSwatchesNeutral.tsx b/src/features/Settings/common/features/Appearance/ThemeSwatches/ThemeSwatchesNeutral.tsx
similarity index 100%
rename from src/routes/(main)/settings/common/features/Appearance/ThemeSwatches/ThemeSwatchesNeutral.tsx
rename to src/features/Settings/common/features/Appearance/ThemeSwatches/ThemeSwatchesNeutral.tsx
diff --git a/src/routes/(main)/settings/common/features/Appearance/ThemeSwatches/ThemeSwatchesPrimary.tsx b/src/features/Settings/common/features/Appearance/ThemeSwatches/ThemeSwatchesPrimary.tsx
similarity index 100%
rename from src/routes/(main)/settings/common/features/Appearance/ThemeSwatches/ThemeSwatchesPrimary.tsx
rename to src/features/Settings/common/features/Appearance/ThemeSwatches/ThemeSwatchesPrimary.tsx
diff --git a/src/routes/(main)/settings/common/features/Appearance/ThemeSwatches/index.ts b/src/features/Settings/common/features/Appearance/ThemeSwatches/index.ts
similarity index 100%
rename from src/routes/(main)/settings/common/features/Appearance/ThemeSwatches/index.ts
rename to src/features/Settings/common/features/Appearance/ThemeSwatches/index.ts
diff --git a/src/routes/(main)/settings/common/features/Appearance/index.tsx b/src/features/Settings/common/features/Appearance/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/common/features/Appearance/index.tsx
rename to src/features/Settings/common/features/Appearance/index.tsx
diff --git a/src/routes/(main)/settings/common/features/Common/Common.tsx b/src/features/Settings/common/features/Common/Common.tsx
similarity index 100%
rename from src/routes/(main)/settings/common/features/Common/Common.tsx
rename to src/features/Settings/common/features/Common/Common.tsx
diff --git a/src/routes/(main)/settings/connector/index.tsx b/src/features/Settings/connector/index.tsx
similarity index 73%
rename from src/routes/(main)/settings/connector/index.tsx
rename to src/features/Settings/connector/index.tsx
index 2b4ab8836b8..fe90fe0035e 100644
--- a/src/routes/(main)/settings/connector/index.tsx
+++ b/src/features/Settings/connector/index.tsx
@@ -2,7 +2,7 @@
import { memo } from 'react';
-import { ToolSettings } from '@/routes/(main)/settings/skill';
+import { ToolSettings } from '@/features/Settings/skill';
const Page = memo(() => <ToolSettings viewMode="connector" />);
diff --git a/src/routes/(main)/settings/creds/features/CreateCredModal/Content.tsx b/src/features/Settings/creds/features/CreateCredModal/Content.tsx
similarity index 100%
rename from src/routes/(main)/settings/creds/features/CreateCredModal/Content.tsx
rename to src/features/Settings/creds/features/CreateCredModal/Content.tsx
diff --git a/src/routes/(main)/settings/creds/features/CreateCredModal/CredTypeSelector.tsx b/src/features/Settings/creds/features/CreateCredModal/CredTypeSelector.tsx
similarity index 100%
rename from src/routes/(main)/settings/creds/features/CreateCredModal/CredTypeSelector.tsx
rename to src/features/Settings/creds/features/CreateCredModal/CredTypeSelector.tsx
diff --git a/src/routes/(main)/settings/creds/features/CreateCredModal/FileCredForm.tsx b/src/features/Settings/creds/features/CreateCredModal/FileCredForm.tsx
similarity index 100%
rename from src/routes/(main)/settings/creds/features/CreateCredModal/FileCredForm.tsx
rename to src/features/Settings/creds/features/CreateCredModal/FileCredForm.tsx
diff --git a/src/routes/(main)/settings/creds/features/CreateCredModal/KVCredForm.tsx b/src/features/Settings/creds/features/CreateCredModal/KVCredForm.tsx
similarity index 100%
rename from src/routes/(main)/settings/creds/features/CreateCredModal/KVCredForm.tsx
rename to src/features/Settings/creds/features/CreateCredModal/KVCredForm.tsx
diff --git a/src/routes/(main)/settings/creds/features/CreateCredModal/OAuthCredForm.tsx b/src/features/Settings/creds/features/CreateCredModal/OAuthCredForm.tsx
similarity index 100%
rename from src/routes/(main)/settings/creds/features/CreateCredModal/OAuthCredForm.tsx
rename to src/features/Settings/creds/features/CreateCredModal/OAuthCredForm.tsx
diff --git a/src/routes/(main)/settings/creds/features/CreateCredModal/index.tsx b/src/features/Settings/creds/features/CreateCredModal/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/creds/features/CreateCredModal/index.tsx
rename to src/features/Settings/creds/features/CreateCredModal/index.tsx
diff --git a/src/routes/(main)/settings/creds/features/CredItem.tsx b/src/features/Settings/creds/features/CredItem.tsx
similarity index 100%
rename from src/routes/(main)/settings/creds/features/CredItem.tsx
rename to src/features/Settings/creds/features/CredItem.tsx
diff --git a/src/routes/(main)/settings/creds/features/CredsList.tsx b/src/features/Settings/creds/features/CredsList.tsx
similarity index 100%
rename from src/routes/(main)/settings/creds/features/CredsList.tsx
rename to src/features/Settings/creds/features/CredsList.tsx
diff --git a/src/routes/(main)/settings/creds/features/EditCredModal/Content.tsx b/src/features/Settings/creds/features/EditCredModal/Content.tsx
similarity index 100%
rename from src/routes/(main)/settings/creds/features/EditCredModal/Content.tsx
rename to src/features/Settings/creds/features/EditCredModal/Content.tsx
diff --git a/src/routes/(main)/settings/creds/features/EditCredModal/EditKVForm.tsx b/src/features/Settings/creds/features/EditCredModal/EditKVForm.tsx
similarity index 100%
rename from src/routes/(main)/settings/creds/features/EditCredModal/EditKVForm.tsx
rename to src/features/Settings/creds/features/EditCredModal/EditKVForm.tsx
diff --git a/src/routes/(main)/settings/creds/features/EditCredModal/EditMetaForm.tsx b/src/features/Settings/creds/features/EditCredModal/EditMetaForm.tsx
similarity index 100%
rename from src/routes/(main)/settings/creds/features/EditCredModal/EditMetaForm.tsx
rename to src/features/Settings/creds/features/EditCredModal/EditMetaForm.tsx
diff --git a/src/routes/(main)/settings/creds/features/EditCredModal/index.tsx b/src/features/Settings/creds/features/EditCredModal/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/creds/features/EditCredModal/index.tsx
rename to src/features/Settings/creds/features/EditCredModal/index.tsx
diff --git a/src/routes/(main)/settings/creds/features/ViewCredModal/Content.tsx b/src/features/Settings/creds/features/ViewCredModal/Content.tsx
similarity index 100%
rename from src/routes/(main)/settings/creds/features/ViewCredModal/Content.tsx
rename to src/features/Settings/creds/features/ViewCredModal/Content.tsx
diff --git a/src/routes/(main)/settings/creds/features/ViewCredModal/index.tsx b/src/features/Settings/creds/features/ViewCredModal/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/creds/features/ViewCredModal/index.tsx
rename to src/features/Settings/creds/features/ViewCredModal/index.tsx
diff --git a/src/routes/(main)/settings/creds/features/style.ts b/src/features/Settings/creds/features/style.ts
similarity index 100%
rename from src/routes/(main)/settings/creds/features/style.ts
rename to src/features/Settings/creds/features/style.ts
diff --git a/src/routes/(main)/settings/creds/features/useCredsApi.ts b/src/features/Settings/creds/features/useCredsApi.ts
similarity index 100%
rename from src/routes/(main)/settings/creds/features/useCredsApi.ts
rename to src/features/Settings/creds/features/useCredsApi.ts
diff --git a/src/routes/(main)/settings/creds/index.tsx b/src/features/Settings/creds/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/creds/index.tsx
rename to src/features/Settings/creds/index.tsx
diff --git a/src/routes/(main)/settings/devices/index.tsx b/src/features/Settings/devices/index.tsx
similarity index 93%
rename from src/routes/(main)/settings/devices/index.tsx
rename to src/features/Settings/devices/index.tsx
index 4b4b6a91af9..5d49471ccbf 100644
--- a/src/routes/(main)/settings/devices/index.tsx
+++ b/src/features/Settings/devices/index.tsx
@@ -4,7 +4,7 @@ import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { DeviceConnectModal, DeviceManager } from '@/features/DeviceManager';
-import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
+import SettingHeader from '@/features/Settings/features/SettingHeader';
interface PageProps {
showSettingHeader?: boolean;
diff --git a/src/routes/(main)/settings/features/SettingHeader.tsx b/src/features/Settings/features/SettingHeader.tsx
similarity index 100%
rename from src/routes/(main)/settings/features/SettingHeader.tsx
rename to src/features/Settings/features/SettingHeader.tsx
diff --git a/src/routes/(main)/settings/features/SettingsContent.tsx b/src/features/Settings/features/SettingsContent.tsx
similarity index 100%
rename from src/routes/(main)/settings/features/SettingsContent.tsx
rename to src/features/Settings/features/SettingsContent.tsx
diff --git a/src/routes/(main)/settings/features/componentMap.desktop.ts b/src/features/Settings/features/componentMap.desktop.ts
similarity index 100%
rename from src/routes/(main)/settings/features/componentMap.desktop.ts
rename to src/features/Settings/features/componentMap.desktop.ts
diff --git a/src/routes/(main)/settings/features/componentMap.sync.test.ts b/src/features/Settings/features/componentMap.sync.test.ts
similarity index 100%
rename from src/routes/(main)/settings/features/componentMap.sync.test.ts
rename to src/features/Settings/features/componentMap.sync.test.ts
diff --git a/src/routes/(main)/settings/features/componentMap.ts b/src/features/Settings/features/componentMap.ts
similarity index 100%
rename from src/routes/(main)/settings/features/componentMap.ts
rename to src/features/Settings/features/componentMap.ts
diff --git a/src/routes/(main)/settings/features/routeMeta.ts b/src/features/Settings/features/routeMeta.ts
similarity index 100%
rename from src/routes/(main)/settings/features/routeMeta.ts
rename to src/features/Settings/features/routeMeta.ts
diff --git a/src/routes/(main)/settings/hooks/useCategory.test.tsx b/src/features/Settings/hooks/useCategory.test.tsx
similarity index 100%
rename from src/routes/(main)/settings/hooks/useCategory.test.tsx
rename to src/features/Settings/hooks/useCategory.test.tsx
diff --git a/src/routes/(main)/settings/hooks/useCategory.tsx b/src/features/Settings/hooks/useCategory.tsx
similarity index 100%
rename from src/routes/(main)/settings/hooks/useCategory.tsx
rename to src/features/Settings/hooks/useCategory.tsx
diff --git a/src/routes/(main)/settings/hotkey/features/Conversation.tsx b/src/features/Settings/hotkey/features/Conversation.tsx
similarity index 100%
rename from src/routes/(main)/settings/hotkey/features/Conversation.tsx
rename to src/features/Settings/hotkey/features/Conversation.tsx
diff --git a/src/routes/(main)/settings/hotkey/features/Desktop.tsx b/src/features/Settings/hotkey/features/Desktop.tsx
similarity index 100%
rename from src/routes/(main)/settings/hotkey/features/Desktop.tsx
rename to src/features/Settings/hotkey/features/Desktop.tsx
diff --git a/src/routes/(main)/settings/hotkey/features/Essential.tsx b/src/features/Settings/hotkey/features/Essential.tsx
similarity index 100%
rename from src/routes/(main)/settings/hotkey/features/Essential.tsx
rename to src/features/Settings/hotkey/features/Essential.tsx
diff --git a/src/routes/(main)/settings/hotkey/features/styles.ts b/src/features/Settings/hotkey/features/styles.ts
similarity index 100%
rename from src/routes/(main)/settings/hotkey/features/styles.ts
rename to src/features/Settings/hotkey/features/styles.ts
diff --git a/src/routes/(main)/settings/hotkey/index.tsx b/src/features/Settings/hotkey/index.tsx
similarity index 88%
rename from src/routes/(main)/settings/hotkey/index.tsx
rename to src/features/Settings/hotkey/index.tsx
index 7218b1ca5f6..8b7eb2c98ef 100644
--- a/src/routes/(main)/settings/hotkey/index.tsx
+++ b/src/features/Settings/hotkey/index.tsx
@@ -1,7 +1,7 @@
import { useTranslation } from 'react-i18next';
import { isDesktop } from '@/const/version';
-import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
+import SettingHeader from '@/features/Settings/features/SettingHeader';
import Conversation from './features/Conversation';
import Desktop from './features/Desktop';
diff --git a/src/routes/(main)/settings/image/features/Image.tsx b/src/features/Settings/image/features/Image.tsx
similarity index 100%
rename from src/routes/(main)/settings/image/features/Image.tsx
rename to src/features/Settings/image/features/Image.tsx
diff --git a/src/features/Settings/index.tsx b/src/features/Settings/index.tsx
new file mode 100644
index 00000000000..024adf92705
--- /dev/null
+++ b/src/features/Settings/index.tsx
@@ -0,0 +1,40 @@
+'use client';
+
+import { memo } from 'react';
+import { useMatches, useParams } from 'react-router';
+
+import { SettingsTabs } from '@/store/global/initialState';
+
+import SettingsContent from './features/SettingsContent';
+import { type LayoutProps } from './Layout/type';
+
+interface SettingsRouteHandle {
+ settingsTab?: SettingsTabs;
+}
+
+const isSettingsRouteHandle = (handle: unknown): handle is SettingsRouteHandle => {
+ return typeof handle === 'object' && handle !== null && 'settingsTab' in handle;
+};
+
+const getSettingsTabFromMatches = (matches: ReturnType<typeof useMatches>) => {
+ for (const match of [...matches].reverse()) {
+ const { handle } = match;
+ if (isSettingsRouteHandle(handle) && handle.settingsTab) return handle.settingsTab;
+ }
+};
+
+const Layout = memo<LayoutProps>(() => {
+ const params = useParams<{ tab?: string }>();
+ const matches = useMatches();
+
+ const activeTab =
+ (params.tab as SettingsTabs | undefined) ||
+ getSettingsTabFromMatches(matches) ||
+ SettingsTabs.Profile;
+
+ return <SettingsContent activeTab={activeTab} mobile={false} />;
+});
+
+Layout.displayName = 'DesktopSettingsLayout';
+
+export default Layout;
diff --git a/src/routes/(main)/settings/labels/index.tsx b/src/features/Settings/labels/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/labels/index.tsx
rename to src/features/Settings/labels/index.tsx
diff --git a/src/routes/(main)/settings/labs/index.test.tsx b/src/features/Settings/labs/index.test.tsx
similarity index 98%
rename from src/routes/(main)/settings/labs/index.test.tsx
rename to src/features/Settings/labs/index.test.tsx
index eb49f753423..7af5571cdab 100644
--- a/src/routes/(main)/settings/labs/index.test.tsx
+++ b/src/features/Settings/labs/index.test.tsx
@@ -71,7 +71,7 @@ vi.mock('@lobehub/ui/base-ui', () => ({
Switch: () => <button />,
}));
-vi.mock('@/routes/(main)/settings/features/SettingHeader', () => ({
+vi.mock('@/features/Settings/features/SettingHeader', () => ({
default: ({ description, title }: { description?: string; title: string }) => (
<header>
<h1>{title}</h1>
diff --git a/src/routes/(main)/settings/labs/index.tsx b/src/features/Settings/labs/index.tsx
similarity index 98%
rename from src/routes/(main)/settings/labs/index.tsx
rename to src/features/Settings/labs/index.tsx
index 237628512d0..2d1b575976d 100644
--- a/src/routes/(main)/settings/labs/index.tsx
+++ b/src/features/Settings/labs/index.tsx
@@ -11,7 +11,7 @@ import { useTranslation } from 'react-i18next';
import AsyncError from '@/components/AsyncError';
import { FORM_STYLE } from '@/const/layoutTokens';
-import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
+import SettingHeader from '@/features/Settings/features/SettingHeader';
import { useUserStore } from '@/store/user';
import { labPreferSelectors, preferenceSelectors } from '@/store/user/selectors';
import { type UserLab } from '@/types/user';
diff --git a/src/routes/(main)/settings/memory/features/ManageMemoryButton.tsx b/src/features/Settings/memory/features/ManageMemoryButton.tsx
similarity index 100%
rename from src/routes/(main)/settings/memory/features/ManageMemoryButton.tsx
rename to src/features/Settings/memory/features/ManageMemoryButton.tsx
diff --git a/src/routes/(main)/settings/memory/features/Memory.tsx b/src/features/Settings/memory/features/Memory.tsx
similarity index 100%
rename from src/routes/(main)/settings/memory/features/Memory.tsx
rename to src/features/Settings/memory/features/Memory.tsx
diff --git a/src/routes/(main)/settings/memory/index.tsx b/src/features/Settings/memory/index.tsx
similarity index 87%
rename from src/routes/(main)/settings/memory/index.tsx
rename to src/features/Settings/memory/index.tsx
index 450a80b64d9..acf190d584d 100644
--- a/src/routes/(main)/settings/memory/index.tsx
+++ b/src/features/Settings/memory/index.tsx
@@ -2,7 +2,7 @@
import { useTranslation } from 'react-i18next';
-import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
+import SettingHeader from '@/features/Settings/features/SettingHeader';
import { ManageMemoryButton } from './features/ManageMemoryButton';
import Memory from './features/Memory';
diff --git a/src/routes/(main)/settings/messenger/index.tsx b/src/features/Settings/messenger/index.tsx
similarity index 84%
rename from src/routes/(main)/settings/messenger/index.tsx
rename to src/features/Settings/messenger/index.tsx
index 7073653dd0f..bb99f560b02 100644
--- a/src/routes/(main)/settings/messenger/index.tsx
+++ b/src/features/Settings/messenger/index.tsx
@@ -1,7 +1,7 @@
import { useTranslation } from 'react-i18next';
import MessengerSettings from '@/features/Messenger';
-import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
+import SettingHeader from '@/features/Settings/features/SettingHeader';
interface PageProps {
showSettingHeader?: boolean;
diff --git a/src/routes/(main)/settings/oauth-apps/features/AppDetail/EditForm.tsx b/src/features/Settings/oauth-apps/features/AppDetail/EditForm.tsx
similarity index 100%
rename from src/routes/(main)/settings/oauth-apps/features/AppDetail/EditForm.tsx
rename to src/features/Settings/oauth-apps/features/AppDetail/EditForm.tsx
diff --git a/src/routes/(main)/settings/oauth-apps/features/AppDetail/index.tsx b/src/features/Settings/oauth-apps/features/AppDetail/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/oauth-apps/features/AppDetail/index.tsx
rename to src/features/Settings/oauth-apps/features/AppDetail/index.tsx
diff --git a/src/routes/(main)/settings/oauth-apps/features/AppItem/index.tsx b/src/features/Settings/oauth-apps/features/AppItem/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/oauth-apps/features/AppItem/index.tsx
rename to src/features/Settings/oauth-apps/features/AppItem/index.tsx
diff --git a/src/routes/(main)/settings/oauth-apps/features/ClientIdDisplay/index.tsx b/src/features/Settings/oauth-apps/features/ClientIdDisplay/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/oauth-apps/features/ClientIdDisplay/index.tsx
rename to src/features/Settings/oauth-apps/features/ClientIdDisplay/index.tsx
diff --git a/src/routes/(main)/settings/oauth-apps/features/CreateAppModal/Content.tsx b/src/features/Settings/oauth-apps/features/CreateAppModal/Content.tsx
similarity index 100%
rename from src/routes/(main)/settings/oauth-apps/features/CreateAppModal/Content.tsx
rename to src/features/Settings/oauth-apps/features/CreateAppModal/Content.tsx
diff --git a/src/routes/(main)/settings/oauth-apps/features/CreateAppModal/index.tsx b/src/features/Settings/oauth-apps/features/CreateAppModal/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/oauth-apps/features/CreateAppModal/index.tsx
rename to src/features/Settings/oauth-apps/features/CreateAppModal/index.tsx
diff --git a/src/routes/(main)/settings/oauth-apps/features/OAuthApps.tsx b/src/features/Settings/oauth-apps/features/OAuthApps.tsx
similarity index 100%
rename from src/routes/(main)/settings/oauth-apps/features/OAuthApps.tsx
rename to src/features/Settings/oauth-apps/features/OAuthApps.tsx
diff --git a/src/routes/(main)/settings/oauth-apps/features/index.ts b/src/features/Settings/oauth-apps/features/index.ts
similarity index 100%
rename from src/routes/(main)/settings/oauth-apps/features/index.ts
rename to src/features/Settings/oauth-apps/features/index.ts
diff --git a/src/routes/(main)/settings/oauth-apps/index.test.tsx b/src/features/Settings/oauth-apps/index.test.tsx
similarity index 97%
rename from src/routes/(main)/settings/oauth-apps/index.test.tsx
rename to src/features/Settings/oauth-apps/index.test.tsx
index 200163f8560..245b7e50eaa 100644
--- a/src/routes/(main)/settings/oauth-apps/index.test.tsx
+++ b/src/features/Settings/oauth-apps/index.test.tsx
@@ -49,7 +49,7 @@ vi.mock('@/libs/trpc/client', () => ({
lambdaClient: { oauthApp: { create: { mutate: vi.fn() } } },
}));
-vi.mock('@/routes/(main)/settings/features/SettingHeader', () => ({
+vi.mock('@/features/Settings/features/SettingHeader', () => ({
default: ({ title }: { title: string }) => <h1>{title}</h1>,
}));
diff --git a/src/routes/(main)/settings/oauth-apps/index.tsx b/src/features/Settings/oauth-apps/index.tsx
similarity index 97%
rename from src/routes/(main)/settings/oauth-apps/index.tsx
rename to src/features/Settings/oauth-apps/index.tsx
index 7d9556488ac..45be1ac4f1b 100644
--- a/src/routes/(main)/settings/oauth-apps/index.tsx
+++ b/src/features/Settings/oauth-apps/index.tsx
@@ -5,10 +5,10 @@ import { useParams } from 'react-router';
import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';
import NotFound from '@/components/404';
+import SettingHeader from '@/features/Settings/features/SettingHeader';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import { usePermission } from '@/hooks/usePermission';
import { lambdaClient } from '@/libs/trpc/client';
-import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
import { useUserStore } from '@/store/user';
import { labPreferSelectors, preferenceSelectors } from '@/store/user/selectors';
diff --git a/src/routes/(main)/settings/profile/features/AvatarRow.tsx b/src/features/Settings/profile/features/AvatarRow.tsx
similarity index 100%
rename from src/routes/(main)/settings/profile/features/AvatarRow.tsx
rename to src/features/Settings/profile/features/AvatarRow.tsx
diff --git a/src/routes/(main)/settings/profile/features/ComposioAuthorizationList/index.tsx b/src/features/Settings/profile/features/ComposioAuthorizationList/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/profile/features/ComposioAuthorizationList/index.tsx
rename to src/features/Settings/profile/features/ComposioAuthorizationList/index.tsx
diff --git a/src/routes/(main)/settings/profile/features/EmailRow.tsx b/src/features/Settings/profile/features/EmailRow.tsx
similarity index 100%
rename from src/routes/(main)/settings/profile/features/EmailRow.tsx
rename to src/features/Settings/profile/features/EmailRow.tsx
diff --git a/src/routes/(main)/settings/profile/features/FullNameRow.tsx b/src/features/Settings/profile/features/FullNameRow.tsx
similarity index 100%
rename from src/routes/(main)/settings/profile/features/FullNameRow.tsx
rename to src/features/Settings/profile/features/FullNameRow.tsx
diff --git a/src/routes/(main)/settings/profile/features/InterestsRow.test.tsx b/src/features/Settings/profile/features/InterestsRow.test.tsx
similarity index 100%
rename from src/routes/(main)/settings/profile/features/InterestsRow.test.tsx
rename to src/features/Settings/profile/features/InterestsRow.test.tsx
diff --git a/src/routes/(main)/settings/profile/features/InterestsRow.tsx b/src/features/Settings/profile/features/InterestsRow.tsx
similarity index 98%
rename from src/routes/(main)/settings/profile/features/InterestsRow.tsx
rename to src/features/Settings/profile/features/InterestsRow.tsx
index 945732f7f69..aa6be07be3d 100644
--- a/src/routes/(main)/settings/profile/features/InterestsRow.tsx
+++ b/src/features/Settings/profile/features/InterestsRow.tsx
@@ -8,7 +8,7 @@ import { BriefcaseIcon } from 'lucide-react';
import { useCallback, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
-import { INTEREST_AREAS } from '@/routes/onboarding/config';
+import { INTEREST_AREAS } from '@/features/Onboarding/config';
import { useUserStore } from '@/store/user';
import { userProfileSelectors } from '@/store/user/selectors';
import { saveToast } from '@/store/utils/saveToast';
diff --git a/src/routes/(main)/settings/profile/features/PasswordRow.tsx b/src/features/Settings/profile/features/PasswordRow.tsx
similarity index 100%
rename from src/routes/(main)/settings/profile/features/PasswordRow.tsx
rename to src/features/Settings/profile/features/PasswordRow.tsx
diff --git a/src/routes/(main)/settings/profile/features/ProfileRow.tsx b/src/features/Settings/profile/features/ProfileRow.tsx
similarity index 100%
rename from src/routes/(main)/settings/profile/features/ProfileRow.tsx
rename to src/features/Settings/profile/features/ProfileRow.tsx
diff --git a/src/routes/(main)/settings/profile/features/SSOProvidersList/index.tsx b/src/features/Settings/profile/features/SSOProvidersList/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/profile/features/SSOProvidersList/index.tsx
rename to src/features/Settings/profile/features/SSOProvidersList/index.tsx
diff --git a/src/routes/(main)/settings/profile/features/UsernameRow.tsx b/src/features/Settings/profile/features/UsernameRow.tsx
similarity index 100%
rename from src/routes/(main)/settings/profile/features/UsernameRow.tsx
rename to src/features/Settings/profile/features/UsernameRow.tsx
diff --git a/src/routes/(main)/settings/profile/features/usePasswordReset.test.ts b/src/features/Settings/profile/features/usePasswordReset.test.ts
similarity index 100%
rename from src/routes/(main)/settings/profile/features/usePasswordReset.test.ts
rename to src/features/Settings/profile/features/usePasswordReset.test.ts
diff --git a/src/routes/(main)/settings/profile/features/usePasswordReset.ts b/src/features/Settings/profile/features/usePasswordReset.ts
similarity index 100%
rename from src/routes/(main)/settings/profile/features/usePasswordReset.ts
rename to src/features/Settings/profile/features/usePasswordReset.ts
diff --git a/src/routes/(main)/settings/profile/index.tsx b/src/features/Settings/profile/index.tsx
similarity index 98%
rename from src/routes/(main)/settings/profile/index.tsx
rename to src/features/Settings/profile/index.tsx
index 70ebc73e222..9b1ed1362d6 100644
--- a/src/routes/(main)/settings/profile/index.tsx
+++ b/src/features/Settings/profile/index.tsx
@@ -6,7 +6,7 @@ import { Divider } from 'antd';
import { useEffect } from 'react';
import { useTranslation } from 'react-i18next';
-import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
+import SettingHeader from '@/features/Settings/features/SettingHeader';
import { useServerConfigStore } from '@/store/serverConfig';
import { serverConfigSelectors } from '@/store/serverConfig/selectors';
import { useToolStore } from '@/store/tool';
diff --git a/src/routes/(main)/settings/provider/(list)/ProviderGrid/Card.tsx b/src/features/Settings/provider/(list)/ProviderGrid/Card.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/(list)/ProviderGrid/Card.tsx
rename to src/features/Settings/provider/(list)/ProviderGrid/Card.tsx
diff --git a/src/routes/(main)/settings/provider/(list)/ProviderGrid/EnableSwitch.tsx b/src/features/Settings/provider/(list)/ProviderGrid/EnableSwitch.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/(list)/ProviderGrid/EnableSwitch.tsx
rename to src/features/Settings/provider/(list)/ProviderGrid/EnableSwitch.tsx
diff --git a/src/routes/(main)/settings/provider/(list)/ProviderGrid/index.tsx b/src/features/Settings/provider/(list)/ProviderGrid/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/(list)/ProviderGrid/index.tsx
rename to src/features/Settings/provider/(list)/ProviderGrid/index.tsx
diff --git a/src/routes/(main)/settings/provider/(list)/ProviderGrid/style.ts b/src/features/Settings/provider/(list)/ProviderGrid/style.ts
similarity index 100%
rename from src/routes/(main)/settings/provider/(list)/ProviderGrid/style.ts
rename to src/features/Settings/provider/(list)/ProviderGrid/style.ts
diff --git a/src/routes/(main)/settings/provider/(list)/index.tsx b/src/features/Settings/provider/(list)/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/(list)/index.tsx
rename to src/features/Settings/provider/(list)/index.tsx
diff --git a/src/routes/(main)/settings/provider/ProviderMenu/Actions.tsx b/src/features/Settings/provider/ProviderMenu/Actions.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/ProviderMenu/Actions.tsx
rename to src/features/Settings/provider/ProviderMenu/Actions.tsx
diff --git a/src/routes/(main)/settings/provider/ProviderMenu/AddNew.tsx b/src/features/Settings/provider/ProviderMenu/AddNew.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/ProviderMenu/AddNew.tsx
rename to src/features/Settings/provider/ProviderMenu/AddNew.tsx
diff --git a/src/routes/(main)/settings/provider/ProviderMenu/All.tsx b/src/features/Settings/provider/ProviderMenu/All.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/ProviderMenu/All.tsx
rename to src/features/Settings/provider/ProviderMenu/All.tsx
diff --git a/src/routes/(main)/settings/provider/ProviderMenu/Item.tsx b/src/features/Settings/provider/ProviderMenu/Item.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/ProviderMenu/Item.tsx
rename to src/features/Settings/provider/ProviderMenu/Item.tsx
diff --git a/src/routes/(main)/settings/provider/ProviderMenu/List.tsx b/src/features/Settings/provider/ProviderMenu/List.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/ProviderMenu/List.tsx
rename to src/features/Settings/provider/ProviderMenu/List.tsx
diff --git a/src/routes/(main)/settings/provider/ProviderMenu/SearchResult.tsx b/src/features/Settings/provider/ProviderMenu/SearchResult.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/ProviderMenu/SearchResult.tsx
rename to src/features/Settings/provider/ProviderMenu/SearchResult.tsx
diff --git a/src/routes/(main)/settings/provider/ProviderMenu/SortProviderModal/GroupItem.tsx b/src/features/Settings/provider/ProviderMenu/SortProviderModal/GroupItem.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/ProviderMenu/SortProviderModal/GroupItem.tsx
rename to src/features/Settings/provider/ProviderMenu/SortProviderModal/GroupItem.tsx
diff --git a/src/routes/(main)/settings/provider/ProviderMenu/SortProviderModal/index.tsx b/src/features/Settings/provider/ProviderMenu/SortProviderModal/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/ProviderMenu/SortProviderModal/index.tsx
rename to src/features/Settings/provider/ProviderMenu/SortProviderModal/index.tsx
diff --git a/src/routes/(main)/settings/provider/ProviderMenu/index.tsx b/src/features/Settings/provider/ProviderMenu/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/ProviderMenu/index.tsx
rename to src/features/Settings/provider/ProviderMenu/index.tsx
diff --git a/src/routes/(main)/settings/provider/ProviderMenu/useDropdownMenu.tsx b/src/features/Settings/provider/ProviderMenu/useDropdownMenu.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/ProviderMenu/useDropdownMenu.tsx
rename to src/features/Settings/provider/ProviderMenu/useDropdownMenu.tsx
diff --git a/src/routes/(main)/settings/provider/_layout/Desktop/Container.tsx b/src/features/Settings/provider/_layout/Desktop/Container.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/_layout/Desktop/Container.tsx
rename to src/features/Settings/provider/_layout/Desktop/Container.tsx
diff --git a/src/routes/(main)/settings/provider/_layout/Desktop/index.tsx b/src/features/Settings/provider/_layout/Desktop/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/_layout/Desktop/index.tsx
rename to src/features/Settings/provider/_layout/Desktop/index.tsx
diff --git a/src/routes/(main)/settings/provider/_layout/Desktop/style.ts b/src/features/Settings/provider/_layout/Desktop/style.ts
similarity index 100%
rename from src/routes/(main)/settings/provider/_layout/Desktop/style.ts
rename to src/features/Settings/provider/_layout/Desktop/style.ts
diff --git a/src/routes/(main)/settings/provider/_layout/Mobile.tsx b/src/features/Settings/provider/_layout/Mobile.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/_layout/Mobile.tsx
rename to src/features/Settings/provider/_layout/Mobile.tsx
diff --git a/src/routes/(main)/settings/provider/const.ts b/src/features/Settings/provider/const.ts
similarity index 100%
rename from src/routes/(main)/settings/provider/const.ts
rename to src/features/Settings/provider/const.ts
diff --git a/src/routes/(main)/settings/provider/detail/azure/index.tsx b/src/features/Settings/provider/detail/azure/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/detail/azure/index.tsx
rename to src/features/Settings/provider/detail/azure/index.tsx
diff --git a/src/routes/(main)/settings/provider/detail/azureai/index.tsx b/src/features/Settings/provider/detail/azureai/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/detail/azureai/index.tsx
rename to src/features/Settings/provider/detail/azureai/index.tsx
diff --git a/src/routes/(main)/settings/provider/detail/bedrock/index.tsx b/src/features/Settings/provider/detail/bedrock/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/detail/bedrock/index.tsx
rename to src/features/Settings/provider/detail/bedrock/index.tsx
diff --git a/src/routes/(main)/settings/provider/detail/cloudflare/index.tsx b/src/features/Settings/provider/detail/cloudflare/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/detail/cloudflare/index.tsx
rename to src/features/Settings/provider/detail/cloudflare/index.tsx
diff --git a/src/routes/(main)/settings/provider/detail/comfyui/index.tsx b/src/features/Settings/provider/detail/comfyui/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/detail/comfyui/index.tsx
rename to src/features/Settings/provider/detail/comfyui/index.tsx
diff --git a/src/routes/(main)/settings/provider/detail/default/CustomProviderDetail.tsx b/src/features/Settings/provider/detail/default/CustomProviderDetail.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/detail/default/CustomProviderDetail.tsx
rename to src/features/Settings/provider/detail/default/CustomProviderDetail.tsx
diff --git a/src/routes/(main)/settings/provider/detail/default/ProviderDetialPage.tsx b/src/features/Settings/provider/detail/default/ProviderDetialPage.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/detail/default/ProviderDetialPage.tsx
rename to src/features/Settings/provider/detail/default/ProviderDetialPage.tsx
diff --git a/src/routes/(main)/settings/provider/detail/default/index.tsx b/src/features/Settings/provider/detail/default/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/detail/default/index.tsx
rename to src/features/Settings/provider/detail/default/index.tsx
diff --git a/src/routes/(main)/settings/provider/detail/github/index.tsx b/src/features/Settings/provider/detail/github/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/detail/github/index.tsx
rename to src/features/Settings/provider/detail/github/index.tsx
diff --git a/src/routes/(main)/settings/provider/detail/index.tsx b/src/features/Settings/provider/detail/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/detail/index.tsx
rename to src/features/Settings/provider/detail/index.tsx
diff --git a/src/routes/(main)/settings/provider/detail/newapi/index.tsx b/src/features/Settings/provider/detail/newapi/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/detail/newapi/index.tsx
rename to src/features/Settings/provider/detail/newapi/index.tsx
diff --git a/src/routes/(main)/settings/provider/detail/ollama/CheckError.tsx b/src/features/Settings/provider/detail/ollama/CheckError.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/detail/ollama/CheckError.tsx
rename to src/features/Settings/provider/detail/ollama/CheckError.tsx
diff --git a/src/routes/(main)/settings/provider/detail/ollama/Container.tsx b/src/features/Settings/provider/detail/ollama/Container.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/detail/ollama/Container.tsx
rename to src/features/Settings/provider/detail/ollama/Container.tsx
diff --git a/src/routes/(main)/settings/provider/detail/ollama/index.tsx b/src/features/Settings/provider/detail/ollama/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/detail/ollama/index.tsx
rename to src/features/Settings/provider/detail/ollama/index.tsx
diff --git a/src/routes/(main)/settings/provider/detail/openai/index.tsx b/src/features/Settings/provider/detail/openai/index.tsx
similarity index 86%
rename from src/routes/(main)/settings/provider/detail/openai/index.tsx
rename to src/features/Settings/provider/detail/openai/index.tsx
index d118333f696..f6c6cb0b74a 100644
--- a/src/routes/(main)/settings/provider/detail/openai/index.tsx
+++ b/src/features/Settings/provider/detail/openai/index.tsx
@@ -1,6 +1,7 @@
import { OpenAIProviderCard } from 'model-bank/modelProviders';
-import { useSettingsContext } from '../../../_layout/ContextProvider';
+import { useSettingsContext } from '@/features/Settings/Layout/ContextProvider';
+
import ProviderDetail from '../default';
const Page = () => {
diff --git a/src/routes/(main)/settings/provider/detail/vertexai/index.tsx b/src/features/Settings/provider/detail/vertexai/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/detail/vertexai/index.tsx
rename to src/features/Settings/provider/detail/vertexai/index.tsx
diff --git a/src/routes/(main)/settings/provider/features/CreateNewProvider/Content.tsx b/src/features/Settings/provider/features/CreateNewProvider/Content.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/CreateNewProvider/Content.tsx
rename to src/features/Settings/provider/features/CreateNewProvider/Content.tsx
diff --git a/src/routes/(main)/settings/provider/features/CreateNewProvider/index.tsx b/src/features/Settings/provider/features/CreateNewProvider/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/CreateNewProvider/index.tsx
rename to src/features/Settings/provider/features/CreateNewProvider/index.tsx
diff --git a/src/routes/(main)/settings/provider/features/ModelList/CreateNewModelModal/Content.tsx b/src/features/Settings/provider/features/ModelList/CreateNewModelModal/Content.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/CreateNewModelModal/Content.tsx
rename to src/features/Settings/provider/features/ModelList/CreateNewModelModal/Content.tsx
diff --git a/src/routes/(main)/settings/provider/features/ModelList/CreateNewModelModal/ExtendParamsSelect.tsx b/src/features/Settings/provider/features/ModelList/CreateNewModelModal/ExtendParamsSelect.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/CreateNewModelModal/ExtendParamsSelect.tsx
rename to src/features/Settings/provider/features/ModelList/CreateNewModelModal/ExtendParamsSelect.tsx
diff --git a/src/routes/(main)/settings/provider/features/ModelList/CreateNewModelModal/Footer.tsx b/src/features/Settings/provider/features/ModelList/CreateNewModelModal/Footer.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/CreateNewModelModal/Footer.tsx
rename to src/features/Settings/provider/features/ModelList/CreateNewModelModal/Footer.tsx
diff --git a/src/routes/(main)/settings/provider/features/ModelList/CreateNewModelModal/Form.tsx b/src/features/Settings/provider/features/ModelList/CreateNewModelModal/Form.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/CreateNewModelModal/Form.tsx
rename to src/features/Settings/provider/features/ModelList/CreateNewModelModal/Form.tsx
diff --git a/src/routes/(main)/settings/provider/features/ModelList/CreateNewModelModal/__tests__/ExtendParamsSelect.test.tsx b/src/features/Settings/provider/features/ModelList/CreateNewModelModal/__tests__/ExtendParamsSelect.test.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/CreateNewModelModal/__tests__/ExtendParamsSelect.test.tsx
rename to src/features/Settings/provider/features/ModelList/CreateNewModelModal/__tests__/ExtendParamsSelect.test.tsx
diff --git a/src/routes/(main)/settings/provider/features/ModelList/CreateNewModelModal/__tests__/utils.test.ts b/src/features/Settings/provider/features/ModelList/CreateNewModelModal/__tests__/utils.test.ts
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/CreateNewModelModal/__tests__/utils.test.ts
rename to src/features/Settings/provider/features/ModelList/CreateNewModelModal/__tests__/utils.test.ts
diff --git a/src/routes/(main)/settings/provider/features/ModelList/CreateNewModelModal/index.tsx b/src/features/Settings/provider/features/ModelList/CreateNewModelModal/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/CreateNewModelModal/index.tsx
rename to src/features/Settings/provider/features/ModelList/CreateNewModelModal/index.tsx
diff --git a/src/routes/(main)/settings/provider/features/ModelList/CreateNewModelModal/utils.ts b/src/features/Settings/provider/features/ModelList/CreateNewModelModal/utils.ts
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/CreateNewModelModal/utils.ts
rename to src/features/Settings/provider/features/ModelList/CreateNewModelModal/utils.ts
diff --git a/src/routes/(main)/settings/provider/features/ModelList/DisabledModels.tsx b/src/features/Settings/provider/features/ModelList/DisabledModels.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/DisabledModels.tsx
rename to src/features/Settings/provider/features/ModelList/DisabledModels.tsx
diff --git a/src/routes/(main)/settings/provider/features/ModelList/EmptyModels.tsx b/src/features/Settings/provider/features/ModelList/EmptyModels.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/EmptyModels.tsx
rename to src/features/Settings/provider/features/ModelList/EmptyModels.tsx
diff --git a/src/routes/(main)/settings/provider/features/ModelList/EnabledModelList/index.tsx b/src/features/Settings/provider/features/ModelList/EnabledModelList/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/EnabledModelList/index.tsx
rename to src/features/Settings/provider/features/ModelList/EnabledModelList/index.tsx
diff --git a/src/routes/(main)/settings/provider/features/ModelList/ModelConfigModal/Content.tsx b/src/features/Settings/provider/features/ModelList/ModelConfigModal/Content.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/ModelConfigModal/Content.tsx
rename to src/features/Settings/provider/features/ModelList/ModelConfigModal/Content.tsx
diff --git a/src/routes/(main)/settings/provider/features/ModelList/ModelConfigModal/Footer.tsx b/src/features/Settings/provider/features/ModelList/ModelConfigModal/Footer.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/ModelConfigModal/Footer.tsx
rename to src/features/Settings/provider/features/ModelList/ModelConfigModal/Footer.tsx
diff --git a/src/routes/(main)/settings/provider/features/ModelList/ModelConfigModal/index.tsx b/src/features/Settings/provider/features/ModelList/ModelConfigModal/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/ModelConfigModal/index.tsx
rename to src/features/Settings/provider/features/ModelList/ModelConfigModal/index.tsx
diff --git a/src/routes/(main)/settings/provider/features/ModelList/ModelItem.tsx b/src/features/Settings/provider/features/ModelList/ModelItem.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/ModelItem.tsx
rename to src/features/Settings/provider/features/ModelList/ModelItem.tsx
diff --git a/src/routes/(main)/settings/provider/features/ModelList/ModelTitle/Search.test.tsx b/src/features/Settings/provider/features/ModelList/ModelTitle/Search.test.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/ModelTitle/Search.test.tsx
rename to src/features/Settings/provider/features/ModelList/ModelTitle/Search.test.tsx
diff --git a/src/routes/(main)/settings/provider/features/ModelList/ModelTitle/Search.tsx b/src/features/Settings/provider/features/ModelList/ModelTitle/Search.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/ModelTitle/Search.tsx
rename to src/features/Settings/provider/features/ModelList/ModelTitle/Search.tsx
diff --git a/src/routes/(main)/settings/provider/features/ModelList/ModelTitle/index.tsx b/src/features/Settings/provider/features/ModelList/ModelTitle/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/ModelTitle/index.tsx
rename to src/features/Settings/provider/features/ModelList/ModelTitle/index.tsx
diff --git a/src/routes/(main)/settings/provider/features/ModelList/ProviderSettingsContext.ts b/src/features/Settings/provider/features/ModelList/ProviderSettingsContext.ts
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/ProviderSettingsContext.ts
rename to src/features/Settings/provider/features/ModelList/ProviderSettingsContext.ts
diff --git a/src/routes/(main)/settings/provider/features/ModelList/SearchResult.test.tsx b/src/features/Settings/provider/features/ModelList/SearchResult.test.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/SearchResult.test.tsx
rename to src/features/Settings/provider/features/ModelList/SearchResult.test.tsx
diff --git a/src/routes/(main)/settings/provider/features/ModelList/SearchResult.tsx b/src/features/Settings/provider/features/ModelList/SearchResult.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/SearchResult.tsx
rename to src/features/Settings/provider/features/ModelList/SearchResult.tsx
diff --git a/src/routes/(main)/settings/provider/features/ModelList/SkeletonList.tsx b/src/features/Settings/provider/features/ModelList/SkeletonList.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/SkeletonList.tsx
rename to src/features/Settings/provider/features/ModelList/SkeletonList.tsx
diff --git a/src/routes/(main)/settings/provider/features/ModelList/SortModelModal/ListItem.tsx b/src/features/Settings/provider/features/ModelList/SortModelModal/ListItem.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/SortModelModal/ListItem.tsx
rename to src/features/Settings/provider/features/ModelList/SortModelModal/ListItem.tsx
diff --git a/src/routes/(main)/settings/provider/features/ModelList/SortModelModal/index.tsx b/src/features/Settings/provider/features/ModelList/SortModelModal/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/SortModelModal/index.tsx
rename to src/features/Settings/provider/features/ModelList/SortModelModal/index.tsx
diff --git a/src/routes/(main)/settings/provider/features/ModelList/index.tsx b/src/features/Settings/provider/features/ModelList/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ModelList/index.tsx
rename to src/features/Settings/provider/features/ModelList/index.tsx
diff --git a/src/routes/(main)/settings/provider/features/ProviderConfig/Checker.tsx b/src/features/Settings/provider/features/ProviderConfig/Checker.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ProviderConfig/Checker.tsx
rename to src/features/Settings/provider/features/ProviderConfig/Checker.tsx
diff --git a/src/routes/(main)/settings/provider/features/ProviderConfig/EnableSwitch.tsx b/src/features/Settings/provider/features/ProviderConfig/EnableSwitch.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ProviderConfig/EnableSwitch.tsx
rename to src/features/Settings/provider/features/ProviderConfig/EnableSwitch.tsx
diff --git a/src/routes/(main)/settings/provider/features/ProviderConfig/OAuthDeviceFlowAuth/index.tsx b/src/features/Settings/provider/features/ProviderConfig/OAuthDeviceFlowAuth/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ProviderConfig/OAuthDeviceFlowAuth/index.tsx
rename to src/features/Settings/provider/features/ProviderConfig/OAuthDeviceFlowAuth/index.tsx
diff --git a/src/routes/(main)/settings/provider/features/ProviderConfig/OAuthDeviceFlowAuth/useOAuthDeviceFlow.ts b/src/features/Settings/provider/features/ProviderConfig/OAuthDeviceFlowAuth/useOAuthDeviceFlow.ts
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ProviderConfig/OAuthDeviceFlowAuth/useOAuthDeviceFlow.ts
rename to src/features/Settings/provider/features/ProviderConfig/OAuthDeviceFlowAuth/useOAuthDeviceFlow.ts
diff --git a/src/routes/(main)/settings/provider/features/ProviderConfig/UpdateProviderInfo/SettingModal.tsx b/src/features/Settings/provider/features/ProviderConfig/UpdateProviderInfo/SettingModal.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ProviderConfig/UpdateProviderInfo/SettingModal.tsx
rename to src/features/Settings/provider/features/ProviderConfig/UpdateProviderInfo/SettingModal.tsx
diff --git a/src/routes/(main)/settings/provider/features/ProviderConfig/UpdateProviderInfo/index.tsx b/src/features/Settings/provider/features/ProviderConfig/UpdateProviderInfo/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ProviderConfig/UpdateProviderInfo/index.tsx
rename to src/features/Settings/provider/features/ProviderConfig/UpdateProviderInfo/index.tsx
diff --git a/src/routes/(main)/settings/provider/features/ProviderConfig/UpdateProviderInfo/normalizeProviderSettings.test.ts b/src/features/Settings/provider/features/ProviderConfig/UpdateProviderInfo/normalizeProviderSettings.test.ts
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ProviderConfig/UpdateProviderInfo/normalizeProviderSettings.test.ts
rename to src/features/Settings/provider/features/ProviderConfig/UpdateProviderInfo/normalizeProviderSettings.test.ts
diff --git a/src/routes/(main)/settings/provider/features/ProviderConfig/index.tsx b/src/features/Settings/provider/features/ProviderConfig/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/provider/features/ProviderConfig/index.tsx
rename to src/features/Settings/provider/features/ProviderConfig/index.tsx
diff --git a/src/routes/(main)/settings/provider/features/customProviderSdkOptions.ts b/src/features/Settings/provider/features/customProviderSdkOptions.ts
similarity index 100%
rename from src/routes/(main)/settings/provider/features/customProviderSdkOptions.ts
rename to src/features/Settings/provider/features/customProviderSdkOptions.ts
diff --git a/src/routes/(main)/settings/provider/features/providerSettings.ts b/src/features/Settings/provider/features/providerSettings.ts
similarity index 100%
rename from src/routes/(main)/settings/provider/features/providerSettings.ts
rename to src/features/Settings/provider/features/providerSettings.ts
diff --git a/src/features/Settings/provider/index.tsx b/src/features/Settings/provider/index.tsx
new file mode 100644
index 00000000000..005f37ec936
--- /dev/null
+++ b/src/features/Settings/provider/index.tsx
@@ -0,0 +1,72 @@
+'use client';
+
+import { Flexbox } from '@lobehub/ui';
+import { memo } from 'react';
+import { Outlet, useParams } from 'react-router';
+
+import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
+
+import DesktopLayoutContainer from './_layout/Desktop/Container';
+import ProviderDetailPageComponent from './detail';
+import ProviderMenu from './ProviderMenu';
+
+// Layout component that wraps provider pages with navigation
+export const ProviderLayout = memo(() => {
+ const navigate = useWorkspaceAwareNavigate();
+
+ const handleProviderSelect = (providerKey: string) => {
+ navigate(`/settings/provider/${providerKey}`);
+ };
+
+ return (
+ <Flexbox
+ horizontal
+ width={'100%'}
+ style={{
+ maxHeight: '100%',
+ }}
+ >
+ <ProviderMenu mobile={false} onProviderSelect={handleProviderSelect} />
+ <DesktopLayoutContainer>
+ <Outlet />
+ </DesktopLayoutContainer>
+ </Flexbox>
+ );
+});
+
+ProviderLayout.displayName = 'ProviderLayout';
+
+// Detail page component that receives providerId from route params
+export const ProviderDetailPage = memo(() => {
+ const params = useParams<{ providerId: string }>();
+ const navigate = useWorkspaceAwareNavigate();
+
+ const handleProviderSelect = (providerKey: string) => {
+ navigate(`/settings/provider/${providerKey}`);
+ };
+
+ return (
+ <ProviderDetailPageComponent
+ id={params.providerId ?? ''}
+ onProviderSelect={handleProviderSelect}
+ />
+ );
+});
+
+ProviderDetailPage.displayName = 'ProviderDetailPage';
+
+// Default export for backward compatibility (used by SettingsContent)
+type ProviderPageType = {
+ mobile?: boolean;
+};
+
+const ProviderPage = (props: ProviderPageType) => {
+ const { mobile } = props;
+
+ // For mobile or when used via SettingsContent, use the old Page component
+ // This is a fallback for non-router usage
+ const OldPage = require('./(list)').default;
+ return <OldPage mobile={mobile} />;
+};
+
+export default ProviderPage;
diff --git a/src/routes/(main)/settings/provider/type.ts b/src/features/Settings/provider/type.ts
similarity index 100%
rename from src/routes/(main)/settings/provider/type.ts
rename to src/features/Settings/provider/type.ts
diff --git a/src/routes/(main)/settings/proxy/features/ProxyForm.test.tsx b/src/features/Settings/proxy/features/ProxyForm.test.tsx
similarity index 100%
rename from src/routes/(main)/settings/proxy/features/ProxyForm.test.tsx
rename to src/features/Settings/proxy/features/ProxyForm.test.tsx
diff --git a/src/routes/(main)/settings/proxy/features/ProxyForm.tsx b/src/features/Settings/proxy/features/ProxyForm.tsx
similarity index 100%
rename from src/routes/(main)/settings/proxy/features/ProxyForm.tsx
rename to src/features/Settings/proxy/features/ProxyForm.tsx
diff --git a/src/routes/(main)/settings/proxy/features/SaveBar.tsx b/src/features/Settings/proxy/features/SaveBar.tsx
similarity index 100%
rename from src/routes/(main)/settings/proxy/features/SaveBar.tsx
rename to src/features/Settings/proxy/features/SaveBar.tsx
diff --git a/src/routes/(main)/settings/proxy/features/useProxyDirty.ts b/src/features/Settings/proxy/features/useProxyDirty.ts
similarity index 100%
rename from src/routes/(main)/settings/proxy/features/useProxyDirty.ts
rename to src/features/Settings/proxy/features/useProxyDirty.ts
diff --git a/src/routes/(main)/settings/proxy/index.tsx b/src/features/Settings/proxy/index.tsx
similarity index 78%
rename from src/routes/(main)/settings/proxy/index.tsx
rename to src/features/Settings/proxy/index.tsx
index e7cda457e3d..dfc30000d84 100644
--- a/src/routes/(main)/settings/proxy/index.tsx
+++ b/src/features/Settings/proxy/index.tsx
@@ -1,6 +1,6 @@
import { useTranslation } from 'react-i18next';
-import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
+import SettingHeader from '@/features/Settings/features/SettingHeader';
import ProxyForm from './features/ProxyForm';
diff --git a/src/routes/(main)/settings/security/index.tsx b/src/features/Settings/security/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/security/index.tsx
rename to src/features/Settings/security/index.tsx
diff --git a/src/routes/(main)/settings/service-model/index.tsx b/src/features/Settings/service-model/index.tsx
similarity index 90%
rename from src/routes/(main)/settings/service-model/index.tsx
rename to src/features/Settings/service-model/index.tsx
index f9d3add1d31..c7626d7bb11 100644
--- a/src/routes/(main)/settings/service-model/index.tsx
+++ b/src/features/Settings/service-model/index.tsx
@@ -3,7 +3,7 @@
import { useTranslation } from 'react-i18next';
import { ModelAssignmentsForm } from '@/features/ServiceModel';
-import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
+import SettingHeader from '@/features/Settings/features/SettingHeader';
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
import Image from '../image/features/Image';
diff --git a/src/routes/(main)/settings/skill/features/Actions.tsx b/src/features/Settings/skill/features/Actions.tsx
similarity index 100%
rename from src/routes/(main)/settings/skill/features/Actions.tsx
rename to src/features/Settings/skill/features/Actions.tsx
diff --git a/src/routes/(main)/settings/skill/features/AgentConnectorItem.tsx b/src/features/Settings/skill/features/AgentConnectorItem.tsx
similarity index 100%
rename from src/routes/(main)/settings/skill/features/AgentConnectorItem.tsx
rename to src/features/Settings/skill/features/AgentConnectorItem.tsx
diff --git a/src/routes/(main)/settings/skill/features/AgentConnectorUsage.tsx b/src/features/Settings/skill/features/AgentConnectorUsage.tsx
similarity index 100%
rename from src/routes/(main)/settings/skill/features/AgentConnectorUsage.tsx
rename to src/features/Settings/skill/features/AgentConnectorUsage.tsx
diff --git a/src/routes/(main)/settings/skill/features/AgentSkillItem.tsx b/src/features/Settings/skill/features/AgentSkillItem.tsx
similarity index 100%
rename from src/routes/(main)/settings/skill/features/AgentSkillItem.tsx
rename to src/features/Settings/skill/features/AgentSkillItem.tsx
diff --git a/src/routes/(main)/settings/skill/features/BuiltinSkillItem.tsx b/src/features/Settings/skill/features/BuiltinSkillItem.tsx
similarity index 100%
rename from src/routes/(main)/settings/skill/features/BuiltinSkillItem.tsx
rename to src/features/Settings/skill/features/BuiltinSkillItem.tsx
diff --git a/src/routes/(main)/settings/skill/features/ComposioSkillItem.tsx b/src/features/Settings/skill/features/ComposioSkillItem.tsx
similarity index 100%
rename from src/routes/(main)/settings/skill/features/ComposioSkillItem.tsx
rename to src/features/Settings/skill/features/ComposioSkillItem.tsx
diff --git a/src/routes/(main)/settings/skill/features/EditCustomPlugin.tsx b/src/features/Settings/skill/features/EditCustomPlugin.tsx
similarity index 100%
rename from src/routes/(main)/settings/skill/features/EditCustomPlugin.tsx
rename to src/features/Settings/skill/features/EditCustomPlugin.tsx
diff --git a/src/routes/(main)/settings/skill/features/LeftPanel.tsx b/src/features/Settings/skill/features/LeftPanel.tsx
similarity index 100%
rename from src/routes/(main)/settings/skill/features/LeftPanel.tsx
rename to src/features/Settings/skill/features/LeftPanel.tsx
diff --git a/src/routes/(main)/settings/skill/features/LobehubSkillItem.tsx b/src/features/Settings/skill/features/LobehubSkillItem.tsx
similarity index 100%
rename from src/routes/(main)/settings/skill/features/LobehubSkillItem.tsx
rename to src/features/Settings/skill/features/LobehubSkillItem.tsx
diff --git a/src/routes/(main)/settings/skill/features/McpSkillItem.tsx b/src/features/Settings/skill/features/McpSkillItem.tsx
similarity index 100%
rename from src/routes/(main)/settings/skill/features/McpSkillItem.tsx
rename to src/features/Settings/skill/features/McpSkillItem.tsx
diff --git a/src/routes/(main)/settings/skill/features/SkillDetail/index.test.tsx b/src/features/Settings/skill/features/SkillDetail/index.test.tsx
similarity index 100%
rename from src/routes/(main)/settings/skill/features/SkillDetail/index.test.tsx
rename to src/features/Settings/skill/features/SkillDetail/index.test.tsx
diff --git a/src/routes/(main)/settings/skill/features/SkillDetail/index.tsx b/src/features/Settings/skill/features/SkillDetail/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/skill/features/SkillDetail/index.tsx
rename to src/features/Settings/skill/features/SkillDetail/index.tsx
diff --git a/src/routes/(main)/settings/skill/features/SkillDetail/localization.test.ts b/src/features/Settings/skill/features/SkillDetail/localization.test.ts
similarity index 100%
rename from src/routes/(main)/settings/skill/features/SkillDetail/localization.test.ts
rename to src/features/Settings/skill/features/SkillDetail/localization.test.ts
diff --git a/src/routes/(main)/settings/skill/features/SkillDetail/localization.ts b/src/features/Settings/skill/features/SkillDetail/localization.ts
similarity index 100%
rename from src/routes/(main)/settings/skill/features/SkillDetail/localization.ts
rename to src/features/Settings/skill/features/SkillDetail/localization.ts
diff --git a/src/routes/(main)/settings/skill/features/SkillList.tsx b/src/features/Settings/skill/features/SkillList.tsx
similarity index 100%
rename from src/routes/(main)/settings/skill/features/SkillList.tsx
rename to src/features/Settings/skill/features/SkillList.tsx
diff --git a/src/routes/(main)/settings/skill/features/style.ts b/src/features/Settings/skill/features/style.ts
similarity index 100%
rename from src/routes/(main)/settings/skill/features/style.ts
rename to src/features/Settings/skill/features/style.ts
diff --git a/src/routes/(main)/settings/skill/index.tsx b/src/features/Settings/skill/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/skill/index.tsx
rename to src/features/Settings/skill/index.tsx
diff --git a/src/routes/(main)/settings/stats/features/components/StatsFormGroup.tsx b/src/features/Settings/stats/features/components/StatsFormGroup.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/components/StatsFormGroup.tsx
rename to src/features/Settings/stats/features/components/StatsFormGroup.tsx
diff --git a/src/routes/(main)/settings/stats/features/components/TimeLabel.tsx b/src/features/Settings/stats/features/components/TimeLabel.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/components/TimeLabel.tsx
rename to src/features/Settings/stats/features/components/TimeLabel.tsx
diff --git a/src/routes/(main)/settings/stats/features/components/UsageBarChart.tsx b/src/features/Settings/stats/features/components/UsageBarChart.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/components/UsageBarChart.tsx
rename to src/features/Settings/stats/features/components/UsageBarChart.tsx
diff --git a/src/routes/(main)/settings/stats/features/overview/ShareButton/Preview.tsx b/src/features/Settings/stats/features/overview/ShareButton/Preview.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/overview/ShareButton/Preview.tsx
rename to src/features/Settings/stats/features/overview/ShareButton/Preview.tsx
diff --git a/src/routes/(main)/settings/stats/features/overview/ShareButton/ShareModal.tsx b/src/features/Settings/stats/features/overview/ShareButton/ShareModal.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/overview/ShareButton/ShareModal.tsx
rename to src/features/Settings/stats/features/overview/ShareButton/ShareModal.tsx
diff --git a/src/routes/(main)/settings/stats/features/overview/ShareButton/TotalCard.tsx b/src/features/Settings/stats/features/overview/ShareButton/TotalCard.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/overview/ShareButton/TotalCard.tsx
rename to src/features/Settings/stats/features/overview/ShareButton/TotalCard.tsx
diff --git a/src/routes/(main)/settings/stats/features/overview/ShareButton/index.tsx b/src/features/Settings/stats/features/overview/ShareButton/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/overview/ShareButton/index.tsx
rename to src/features/Settings/stats/features/overview/ShareButton/index.tsx
diff --git a/src/routes/(main)/settings/stats/features/overview/TotalAssistants.tsx b/src/features/Settings/stats/features/overview/TotalAssistants.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/overview/TotalAssistants.tsx
rename to src/features/Settings/stats/features/overview/TotalAssistants.tsx
diff --git a/src/routes/(main)/settings/stats/features/overview/TotalMessages.tsx b/src/features/Settings/stats/features/overview/TotalMessages.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/overview/TotalMessages.tsx
rename to src/features/Settings/stats/features/overview/TotalMessages.tsx
diff --git a/src/routes/(main)/settings/stats/features/overview/TotalTokens.tsx b/src/features/Settings/stats/features/overview/TotalTokens.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/overview/TotalTokens.tsx
rename to src/features/Settings/stats/features/overview/TotalTokens.tsx
diff --git a/src/routes/(main)/settings/stats/features/overview/TotalTopics.tsx b/src/features/Settings/stats/features/overview/TotalTopics.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/overview/TotalTopics.tsx
rename to src/features/Settings/stats/features/overview/TotalTopics.tsx
diff --git a/src/routes/(main)/settings/stats/features/overview/Welcome.tsx b/src/features/Settings/stats/features/overview/Welcome.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/overview/Welcome.tsx
rename to src/features/Settings/stats/features/overview/Welcome.tsx
diff --git a/src/routes/(main)/settings/stats/features/overview/WorkspaceWelcome.tsx b/src/features/Settings/stats/features/overview/WorkspaceWelcome.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/overview/WorkspaceWelcome.tsx
rename to src/features/Settings/stats/features/overview/WorkspaceWelcome.tsx
diff --git a/src/routes/(main)/settings/stats/features/overview/index.ts b/src/features/Settings/stats/features/overview/index.ts
similarity index 100%
rename from src/routes/(main)/settings/stats/features/overview/index.ts
rename to src/features/Settings/stats/features/overview/index.ts
diff --git a/src/routes/(main)/settings/stats/features/rankings/AssistantsRank.tsx b/src/features/Settings/stats/features/rankings/AssistantsRank.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/rankings/AssistantsRank.tsx
rename to src/features/Settings/stats/features/rankings/AssistantsRank.tsx
diff --git a/src/routes/(main)/settings/stats/features/rankings/ModelsRank.tsx b/src/features/Settings/stats/features/rankings/ModelsRank.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/rankings/ModelsRank.tsx
rename to src/features/Settings/stats/features/rankings/ModelsRank.tsx
diff --git a/src/routes/(main)/settings/stats/features/rankings/TopicsRank.tsx b/src/features/Settings/stats/features/rankings/TopicsRank.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/rankings/TopicsRank.tsx
rename to src/features/Settings/stats/features/rankings/TopicsRank.tsx
diff --git a/src/routes/(main)/settings/stats/features/rankings/index.ts b/src/features/Settings/stats/features/rankings/index.ts
similarity index 100%
rename from src/routes/(main)/settings/stats/features/rankings/index.ts
rename to src/features/Settings/stats/features/rankings/index.ts
diff --git a/src/routes/(main)/settings/stats/features/usage/UsageCards/ActiveModels/ModelTable.tsx b/src/features/Settings/stats/features/usage/UsageCards/ActiveModels/ModelTable.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/usage/UsageCards/ActiveModels/ModelTable.tsx
rename to src/features/Settings/stats/features/usage/UsageCards/ActiveModels/ModelTable.tsx
diff --git a/src/routes/(main)/settings/stats/features/usage/UsageCards/ActiveModels/index.test.tsx b/src/features/Settings/stats/features/usage/UsageCards/ActiveModels/index.test.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/usage/UsageCards/ActiveModels/index.test.tsx
rename to src/features/Settings/stats/features/usage/UsageCards/ActiveModels/index.test.tsx
diff --git a/src/routes/(main)/settings/stats/features/usage/UsageCards/ActiveModels/index.tsx b/src/features/Settings/stats/features/usage/UsageCards/ActiveModels/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/usage/UsageCards/ActiveModels/index.tsx
rename to src/features/Settings/stats/features/usage/UsageCards/ActiveModels/index.tsx
diff --git a/src/routes/(main)/settings/stats/features/usage/UsageCards/MonthSpend.tsx b/src/features/Settings/stats/features/usage/UsageCards/MonthSpend.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/usage/UsageCards/MonthSpend.tsx
rename to src/features/Settings/stats/features/usage/UsageCards/MonthSpend.tsx
diff --git a/src/routes/(main)/settings/stats/features/usage/UsageCards/TodaySpend.tsx b/src/features/Settings/stats/features/usage/UsageCards/TodaySpend.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/usage/UsageCards/TodaySpend.tsx
rename to src/features/Settings/stats/features/usage/UsageCards/TodaySpend.tsx
diff --git a/src/routes/(main)/settings/stats/features/usage/UsageCards/index.tsx b/src/features/Settings/stats/features/usage/UsageCards/index.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/usage/UsageCards/index.tsx
rename to src/features/Settings/stats/features/usage/UsageCards/index.tsx
diff --git a/src/routes/(main)/settings/stats/features/usage/UsageTable.tsx b/src/features/Settings/stats/features/usage/UsageTable.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/usage/UsageTable.tsx
rename to src/features/Settings/stats/features/usage/UsageTable.tsx
diff --git a/src/routes/(main)/settings/stats/features/usage/UsageTrends.tsx b/src/features/Settings/stats/features/usage/UsageTrends.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/usage/UsageTrends.tsx
rename to src/features/Settings/stats/features/usage/UsageTrends.tsx
diff --git a/src/routes/(main)/settings/stats/features/usage/index.ts b/src/features/Settings/stats/features/usage/index.ts
similarity index 100%
rename from src/routes/(main)/settings/stats/features/usage/index.ts
rename to src/features/Settings/stats/features/usage/index.ts
diff --git a/src/routes/(main)/settings/stats/features/visualization/AiHeatmaps.tsx b/src/features/Settings/stats/features/visualization/AiHeatmaps.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/visualization/AiHeatmaps.tsx
rename to src/features/Settings/stats/features/visualization/AiHeatmaps.tsx
diff --git a/src/routes/(main)/settings/stats/features/visualization/HeatmapStats.tsx b/src/features/Settings/stats/features/visualization/HeatmapStats.tsx
similarity index 100%
rename from src/routes/(main)/settings/stats/features/visualization/HeatmapStats.tsx
rename to src/features/Settings/stats/features/visualization/HeatmapStats.tsx
diff --git a/src/routes/(main)/settings/stats/features/visualization/index.ts b/src/features/Settings/stats/features/visualization/index.ts
similarity index 100%
rename from src/routes/(main)/settings/stats/features/visualization/index.ts
rename to src/features/Settings/stats/features/visualization/index.ts
diff --git a/src/routes/(main)/settings/stats/index.tsx b/src/features/Settings/stats/index.tsx
similarity index 98%
rename from src/routes/(main)/settings/stats/index.tsx
rename to src/features/Settings/stats/index.tsx
index 693553130ed..5e43e980259 100644
--- a/src/routes/(main)/settings/stats/index.tsx
+++ b/src/features/Settings/stats/index.tsx
@@ -11,9 +11,9 @@ import { memo, type ReactNode, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import AsyncBoundary from '@/components/AsyncBoundary';
+import SettingHeader from '@/features/Settings/features/SettingHeader';
import { useClientDataSWR } from '@/libs/swr';
import { statsKeys } from '@/libs/swr/keys';
-import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
import { usageService } from '@/services/usage';
import {
diff --git a/src/routes/(main)/settings/stats/types.ts b/src/features/Settings/stats/types.ts
similarity index 100%
rename from src/routes/(main)/settings/stats/types.ts
rename to src/features/Settings/stats/types.ts
diff --git a/src/routes/(main)/settings/storage/features/Advanced.test.tsx b/src/features/Settings/storage/features/Advanced.test.tsx
similarity index 100%
rename from src/routes/(main)/settings/storage/features/Advanced.test.tsx
rename to src/features/Settings/storage/features/Advanced.test.tsx
diff --git a/src/routes/(main)/settings/storage/features/Advanced.tsx b/src/features/Settings/storage/features/Advanced.tsx
similarity index 100%
rename from src/routes/(main)/settings/storage/features/Advanced.tsx
rename to src/features/Settings/storage/features/Advanced.tsx
diff --git a/src/routes/(main)/settings/storage/index.tsx b/src/features/Settings/storage/index.tsx
similarity index 93%
rename from src/routes/(main)/settings/storage/index.tsx
rename to src/features/Settings/storage/index.tsx
index 90c5586f448..c2be02582e5 100644
--- a/src/routes/(main)/settings/storage/index.tsx
+++ b/src/features/Settings/storage/index.tsx
@@ -3,7 +3,7 @@
import { Flexbox, FormGroup, Skeleton } from '@lobehub/ui';
import { useTranslation } from 'react-i18next';
-import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
+import SettingHeader from '@/features/Settings/features/SettingHeader';
import { useServerConfigStore } from '@/store/serverConfig';
import { useUserStore } from '@/store/user';
import { authSelectors } from '@/store/user/selectors';
diff --git a/src/routes/(main)/settings/system-tools/features/AppEnvironmentSection.tsx b/src/features/Settings/system-tools/features/AppEnvironmentSection.tsx
similarity index 100%
rename from src/routes/(main)/settings/system-tools/features/AppEnvironmentSection.tsx
rename to src/features/Settings/system-tools/features/AppEnvironmentSection.tsx
diff --git a/src/routes/(main)/settings/system-tools/features/CliTestSection.tsx b/src/features/Settings/system-tools/features/CliTestSection.tsx
similarity index 100%
rename from src/routes/(main)/settings/system-tools/features/CliTestSection.tsx
rename to src/features/Settings/system-tools/features/CliTestSection.tsx
diff --git a/src/routes/(main)/settings/system-tools/features/ShellSection.tsx b/src/features/Settings/system-tools/features/ShellSection.tsx
similarity index 100%
rename from src/routes/(main)/settings/system-tools/features/ShellSection.tsx
rename to src/features/Settings/system-tools/features/ShellSection.tsx
diff --git a/src/routes/(main)/settings/system-tools/features/ToolDetectorSection.tsx b/src/features/Settings/system-tools/features/ToolDetectorSection.tsx
similarity index 100%
rename from src/routes/(main)/settings/system-tools/features/ToolDetectorSection.tsx
rename to src/features/Settings/system-tools/features/ToolDetectorSection.tsx
diff --git a/src/routes/(main)/settings/system-tools/index.tsx b/src/features/Settings/system-tools/index.tsx
similarity index 91%
rename from src/routes/(main)/settings/system-tools/index.tsx
rename to src/features/Settings/system-tools/index.tsx
index 986136d9dc6..4dd1c82de97 100644
--- a/src/routes/(main)/settings/system-tools/index.tsx
+++ b/src/features/Settings/system-tools/index.tsx
@@ -1,6 +1,6 @@
import { useTranslation } from 'react-i18next';
-import SettingHeader from '@/routes/(main)/settings/features/SettingHeader';
+import SettingHeader from '@/features/Settings/features/SettingHeader';
import { useUserStore } from '@/store/user';
import { userGeneralSettingsSelectors } from '@/store/user/slices/settings/selectors';
diff --git a/src/routes/(main)/settings/tts/features/OpenAI.tsx b/src/features/Settings/tts/features/OpenAI.tsx
similarity index 100%
rename from src/routes/(main)/settings/tts/features/OpenAI.tsx
rename to src/features/Settings/tts/features/OpenAI.tsx
diff --git a/src/routes/(main)/settings/tts/features/const.tsx b/src/features/Settings/tts/features/const.tsx
similarity index 100%
rename from src/routes/(main)/settings/tts/features/const.tsx
rename to src/features/Settings/tts/features/const.tsx
diff --git a/src/features/SettingsSearch/useSettingsSearch.ts b/src/features/SettingsSearch/useSettingsSearch.ts
index 366589c7ad1..82efdf872b9 100644
--- a/src/features/SettingsSearch/useSettingsSearch.ts
+++ b/src/features/SettingsSearch/useSettingsSearch.ts
@@ -4,7 +4,7 @@ import { DEFAULT_MODEL_PROVIDER_LIST } from 'model-bank/modelProviders';
import { useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
-import { useCategory } from '@/routes/(main)/settings/hooks/useCategory';
+import { useCategory } from '@/features/Settings/hooks/useCategory';
import { SettingsTabs } from '@/store/global/initialState';
import {
featureFlagsSelectors,
diff --git a/src/hooks/useSignOut.ts b/src/hooks/useSignOut.ts
index 6365cd67b25..ec3e7f8fb00 100644
--- a/src/hooks/useSignOut.ts
+++ b/src/hooks/useSignOut.ts
@@ -1,8 +1,8 @@
import { useCallback } from 'react';
import { isDesktop } from '@/const/version';
-import { navigateToDesktopOnboarding } from '@/routes/(desktop)/desktop-onboarding/navigation';
-import { DesktopOnboardingScreen } from '@/routes/(desktop)/desktop-onboarding/types';
+import { navigateToDesktopOnboarding } from '@/features/DesktopOnboarding/navigation';
+import { DesktopOnboardingScreen } from '@/features/DesktopOnboarding/types';
import { useUserStore } from '@/store/user';
export const useSignOut = () => {
diff --git a/src/routes/(desktop)/desktop-onboarding/index.tsx b/src/routes/(desktop)/desktop-onboarding/index.tsx
index de1ffef35f8..34bb049b768 100644
--- a/src/routes/(desktop)/desktop-onboarding/index.tsx
+++ b/src/routes/(desktop)/desktop-onboarding/index.tsx
@@ -1,245 +1 @@
-'use client';
-
-import { APP_WINDOW_MIN_SIZE } from '@lobechat/desktop-bridge';
-import { Flexbox, Skeleton } from '@lobehub/ui';
-import { memo, Suspense, useCallback, useEffect, useState } from 'react';
-import { useSearchParams } from 'react-router';
-
-import Loading from '@/components/Loading/BrandTextLoading';
-import { remoteServerService } from '@/services/electron/remoteServer';
-import { electronSystemService } from '@/services/electron/system';
-
-import OnboardingContainer from './_layout';
-import DataModeStep from './features/DataModeStep';
-import LoginStep from './features/LoginStep';
-import PermissionsStep from './features/PermissionsStep';
-import WelcomeStep from './features/WelcomeStep';
-import { resolveNextScreen, resolvePreviousScreen } from './flow';
-import { resolveInitialScreen } from './resolveInitialScreen';
-import {
- clearDesktopOnboardingScreen,
- getDesktopOnboardingEverCompleted,
- getDesktopOnboardingScreen,
- setDesktopOnboardingCompleted,
- setDesktopOnboardingEverCompleted,
- setDesktopOnboardingScreen,
-} from './storage';
-import { DesktopOnboardingScreen, isDesktopOnboardingScreen } from './types';
-
-const DesktopOnboardingPage = memo(() => {
- const [searchParams, setSearchParams] = useSearchParams();
- const [isMac, setIsMac] = useState(true);
- const [isLoading, setIsLoading] = useState(true);
- const [everCompleted] = useState(getDesktopOnboardingEverCompleted);
-
- const resolveScreenForPlatform = useCallback(
- (screen: DesktopOnboardingScreen) =>
- resolveInitialScreen({
- everCompleted,
- isMac,
- requested: screen,
- saved: null,
- }),
- [everCompleted, isMac],
- );
-
- const getRequestedScreenFromUrl = useCallback((): DesktopOnboardingScreen | null => {
- const screenParam = searchParams.get('screen');
- if (isDesktopOnboardingScreen(screenParam)) return screenParam;
-
- return null;
- }, [searchParams]);
-
- const [currentScreen, setCurrentScreen] = useState<DesktopOnboardingScreen>(
- DesktopOnboardingScreen.Welcome,
- );
-
- useEffect(() => {
- electronSystemService.setDesktopOnboardingCompleted(false).catch((error) => {
- console.error('[DesktopOnboarding] Failed to mark onboarding as in progress:', error);
- });
- }, []);
-
- useEffect(() => {
- if (isLoading) return;
-
- const initial = resolveInitialScreen({
- everCompleted,
- isMac,
- requested: getRequestedScreenFromUrl(),
- saved: getDesktopOnboardingScreen(),
- });
-
- setCurrentScreen(initial);
-
- // Canonicalize URL to `?screen=...`
- const currentUrlScreen = searchParams.get('screen');
- if (currentUrlScreen !== initial) {
- setSearchParams({ screen: initial });
- }
- }, [everCompleted, getRequestedScreenFromUrl, isLoading, isMac, searchParams, setSearchParams]);
-
- // Persist current screen to localStorage.
- useEffect(() => {
- if (isLoading) return;
- setDesktopOnboardingScreen(currentScreen);
- }, [currentScreen, isLoading]);
-
- // Set window size and resizability
- useEffect(() => {
- const minimumSize = { height: 900, width: 1200 };
-
- const applyWindowSettings = async () => {
- try {
- await electronSystemService.setWindowMinimumSize(minimumSize);
- } catch (error) {
- console.error('[DesktopOnboarding] Failed to apply window settings:', error);
- }
- };
-
- applyWindowSettings();
-
- return () => {
- // Restore to app-level default minimum size preset
- electronSystemService.setWindowMinimumSize(APP_WINDOW_MIN_SIZE).catch((error) => {
- console.error('[DesktopOnboarding] Failed to restore window settings:', error);
- });
- };
- }, []);
-
- // Detect platform: skip permissions page on non-macOS
- useEffect(() => {
- let mounted = true;
- const detectPlatform = async () => {
- try {
- const state = await electronSystemService.getAppState();
- if (!mounted) return;
- setIsMac(state.platform === 'darwin');
- } catch {
- // Fallback: keep default (true)
- } finally {
- setIsLoading(false);
- }
- };
- void detectPlatform();
- return () => {
- mounted = false;
- };
- }, []);
-
- // Listen URL changes: allow deep-linking between screens.
- useEffect(() => {
- if (isLoading) return;
- const requested = getRequestedScreenFromUrl();
- if (!requested) return;
- const resolved = resolveScreenForPlatform(requested);
- if (resolved !== currentScreen) setCurrentScreen(resolved);
- }, [currentScreen, getRequestedScreenFromUrl, isLoading, resolveScreenForPlatform]);
-
- const completeOnboarding = useCallback(async () => {
- setDesktopOnboardingCompleted();
- setDesktopOnboardingEverCompleted();
- clearDesktopOnboardingScreen();
-
- try {
- await Promise.all([
- electronSystemService.setDesktopOnboardingCompleted(true),
- electronSystemService.setWindowMinimumSize(APP_WINDOW_MIN_SIZE),
- ]);
- } catch (error) {
- console.error('[DesktopOnboarding] Failed to finalize onboarding:', error);
- }
-
- // Use hard reload instead of SPA navigation to ensure the app boots with the new desktop state.
- window.location.replace('/');
- }, []);
-
- const goToNextStep = useCallback(async () => {
- let isAuthenticated = false;
- try {
- isAuthenticated = await remoteServerService.isRemoteServerConfigured();
- } catch (error) {
- console.error('[DesktopOnboarding] Failed to verify authentication:', error);
- }
-
- const next = resolveNextScreen({
- current: currentScreen,
- everCompleted,
- isAuthenticated,
- isMac,
- });
-
- if (!next) {
- await completeOnboarding();
- return;
- }
-
- setSearchParams({ screen: next });
- setCurrentScreen(next);
- }, [completeOnboarding, currentScreen, everCompleted, isMac, setSearchParams]);
-
- const goToPreviousStep = useCallback(() => {
- setCurrentScreen((prev) => {
- const prevScreen = resolvePreviousScreen({ current: prev, isMac });
- setSearchParams({ screen: prevScreen });
- return prevScreen;
- });
- }, [isMac, setSearchParams]);
-
- if (isLoading) {
- return <Loading debugId="DesktopOnboarding" />;
- }
-
- const renderStep = () => {
- switch (currentScreen) {
- case DesktopOnboardingScreen.Welcome: {
- return <WelcomeStep onNext={goToNextStep} />;
- }
- case DesktopOnboardingScreen.Permissions: {
- // macOS-only screen; fallback to DataMode if platform doesn't support.
- if (!isMac) {
- setCurrentScreen(DesktopOnboardingScreen.DataMode);
- return null;
- }
- return <PermissionsStep onBack={goToPreviousStep} onNext={goToNextStep} />;
- }
- case DesktopOnboardingScreen.DataMode: {
- return <DataModeStep onBack={goToPreviousStep} onNext={goToNextStep} />;
- }
- case DesktopOnboardingScreen.Login: {
- return <LoginStep onBack={goToPreviousStep} onNext={goToNextStep} />;
- }
- default: {
- return null;
- }
- }
- };
-
- return (
- <OnboardingContainer>
- <Flexbox gap={24} style={{ maxWidth: 560, minHeight: '100%', width: '100%' }}>
- <Suspense
- fallback={
- <Flexbox gap={8}>
- <Skeleton.Avatar size={48} />
- <Skeleton
- paragraph={{
- rows: 8,
- }}
- title={{
- fontSize: 24,
- }}
- />
- </Flexbox>
- }
- >
- {renderStep()}
- </Suspense>
- </Flexbox>
- </OnboardingContainer>
- );
-});
-
-DesktopOnboardingPage.displayName = 'DesktopOnboardingPage';
-
-export default DesktopOnboardingPage;
+export { default } from '@/features/DesktopOnboarding';
diff --git a/src/routes/(main)/[workspaceSlug]/settings/apikey/index.tsx b/src/routes/(main)/[workspaceSlug]/settings/apikey/index.tsx
index 0fd761d3fa9..a073f2acaf6 100644
--- a/src/routes/(main)/[workspaceSlug]/settings/apikey/index.tsx
+++ b/src/routes/(main)/[workspaceSlug]/settings/apikey/index.tsx
@@ -1,8 +1,8 @@
'use client';
import WorkspaceApiKeyGuard from '@/business/client/BusinessSettingPages/WorkspaceApiKeyGuard';
+import Page from '@/features/Settings/apikey';
import { WorkspaceAdminOnly } from '@/features/WorkspaceSetting';
-import Page from '@/routes/(main)/settings/apikey';
const WorkspaceApiKeySetting = () => (
<WorkspaceAdminOnly>
diff --git a/src/routes/(main)/[workspaceSlug]/settings/connector/index.tsx b/src/routes/(main)/[workspaceSlug]/settings/connector/index.tsx
index 0260288a469..35ac3ce0118 100644
--- a/src/routes/(main)/[workspaceSlug]/settings/connector/index.tsx
+++ b/src/routes/(main)/[workspaceSlug]/settings/connector/index.tsx
@@ -1,6 +1,6 @@
'use client';
-import { ToolSettings } from '@/routes/(main)/settings/skill';
+import { ToolSettings } from '@/features/Settings/skill';
const WorkspaceConnectorSetting = () => <ToolSettings viewMode="connector" />;
diff --git a/src/routes/(main)/[workspaceSlug]/settings/credential/features/PersonalCredsSection/index.tsx b/src/routes/(main)/[workspaceSlug]/settings/credential/features/PersonalCredsSection/index.tsx
index 7954811aa05..135c28a4758 100644
--- a/src/routes/(main)/[workspaceSlug]/settings/credential/features/PersonalCredsSection/index.tsx
+++ b/src/routes/(main)/[workspaceSlug]/settings/credential/features/PersonalCredsSection/index.tsx
@@ -8,8 +8,8 @@ import { useTranslation } from 'react-i18next';
import AsyncBoundary from '@/components/AsyncBoundary';
import ListSkeleton from '@/components/ListSkeleton';
+import CredItem from '@/features/Settings/creds/features/CredItem';
import { lambdaQuery } from '@/libs/trpc/client';
-import CredItem from '@/routes/(main)/settings/creds/features/CredItem';
import ShareToggle from './ShareToggle';
diff --git a/src/routes/(main)/[workspaceSlug]/settings/credential/index.tsx b/src/routes/(main)/[workspaceSlug]/settings/credential/index.tsx
index 4a54914fecb..962f3a478cd 100644
--- a/src/routes/(main)/[workspaceSlug]/settings/credential/index.tsx
+++ b/src/routes/(main)/[workspaceSlug]/settings/credential/index.tsx
@@ -8,15 +8,12 @@ import { Plus, UserRoundIcon, UsersIcon } from 'lucide-react';
import { useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import { createCreateCredModal } from '@/features/Settings/creds/features/CreateCredModal';
+import CredsList from '@/features/Settings/creds/features/CredsList';
+import { type CredsApi, CredsApiProvider } from '@/features/Settings/creds/features/useCredsApi';
import { usePermission } from '@/hooks/usePermission';
import { useMarketAuth } from '@/layout/AuthProvider/MarketAuth';
import { lambdaClient, lambdaQuery } from '@/libs/trpc/client';
-import { createCreateCredModal } from '@/routes/(main)/settings/creds/features/CreateCredModal';
-import CredsList from '@/routes/(main)/settings/creds/features/CredsList';
-import {
- type CredsApi,
- CredsApiProvider,
-} from '@/routes/(main)/settings/creds/features/useCredsApi';
import PersonalCredsSection from './features/PersonalCredsSection';
diff --git a/src/routes/(main)/[workspaceSlug]/settings/oauth-apps/index.tsx b/src/routes/(main)/[workspaceSlug]/settings/oauth-apps/index.tsx
index dddd6f2a751..25a50c642dc 100644
--- a/src/routes/(main)/[workspaceSlug]/settings/oauth-apps/index.tsx
+++ b/src/routes/(main)/[workspaceSlug]/settings/oauth-apps/index.tsx
@@ -1,5 +1,5 @@
'use client';
-import Page from '@/routes/(main)/settings/oauth-apps';
+import Page from '@/features/Settings/oauth-apps';
export default Page;
diff --git a/src/routes/(main)/[workspaceSlug]/settings/provider/index.test.tsx b/src/routes/(main)/[workspaceSlug]/settings/provider/index.test.tsx
index be6c82566d5..4d9f6300ca7 100644
--- a/src/routes/(main)/[workspaceSlug]/settings/provider/index.test.tsx
+++ b/src/routes/(main)/[workspaceSlug]/settings/provider/index.test.tsx
@@ -17,16 +17,16 @@ vi.mock('@/business/client/hooks/useIsWorkspaceLoading', () => ({
vi.mock('@/const/version', () => ({ isCustomBranding: false }));
-vi.mock('@/routes/(main)/settings/provider/_layout/Desktop', () => ({
+vi.mock('@/features/Settings/provider/_layout/Desktop', () => ({
default: ({ children }: PropsWithChildren) => <>{children}</>,
}));
-vi.mock('@/routes/(main)/settings/provider/_layout/Mobile', () => ({
+vi.mock('@/features/Settings/provider/_layout/Mobile', () => ({
default: ({ children }: PropsWithChildren) => <>{children}</>,
}));
-vi.mock('@/routes/(main)/settings/provider/detail', async () => {
- const { useSettingsContext } = await import('@/routes/(main)/settings/_layout/ContextProvider');
+vi.mock('@/features/Settings/provider/detail', async () => {
+ const { useSettingsContext } = await import('@/features/Settings/Layout/ContextProvider');
const ProviderDetail = () => {
const { showOpenAIApiKey, showOpenAIProxyUrl } = useSettingsContext();
diff --git a/src/routes/(main)/[workspaceSlug]/settings/provider/index.tsx b/src/routes/(main)/[workspaceSlug]/settings/provider/index.tsx
index 54c289767e5..dbd125fc1ae 100644
--- a/src/routes/(main)/[workspaceSlug]/settings/provider/index.tsx
+++ b/src/routes/(main)/[workspaceSlug]/settings/provider/index.tsx
@@ -1,8 +1,8 @@
'use client';
+import SettingsContextProvider from '@/features/Settings/Layout/ContextProvider';
+import Page from '@/features/Settings/provider/(list)';
import WorkspaceAdminOnly from '@/features/WorkspaceSetting/AdminOnly';
-import SettingsContextProvider from '@/routes/(main)/settings/_layout/ContextProvider';
-import Page from '@/routes/(main)/settings/provider/(list)';
const WorkspaceProviderSetting = () => (
<WorkspaceAdminOnly>
diff --git a/src/routes/(main)/[workspaceSlug]/settings/service-model/index.test.tsx b/src/routes/(main)/[workspaceSlug]/settings/service-model/index.test.tsx
index 77826787e5e..3a7dedd5c77 100644
--- a/src/routes/(main)/[workspaceSlug]/settings/service-model/index.test.tsx
+++ b/src/routes/(main)/[workspaceSlug]/settings/service-model/index.test.tsx
@@ -13,7 +13,7 @@ vi.mock('@/business/client/hooks/useIsWorkspaceLoading', () => ({
useIsWorkspaceLoading: () => false,
}));
-vi.mock('@/routes/(main)/settings/service-model', () => ({
+vi.mock('@/features/Settings/service-model', () => ({
default: () => <div data-testid="service-model-page">service model settings</div>,
}));
diff --git a/src/routes/(main)/[workspaceSlug]/settings/service-model/index.tsx b/src/routes/(main)/[workspaceSlug]/settings/service-model/index.tsx
index c240698b2df..c881fcb8ab1 100644
--- a/src/routes/(main)/[workspaceSlug]/settings/service-model/index.tsx
+++ b/src/routes/(main)/[workspaceSlug]/settings/service-model/index.tsx
@@ -1,7 +1,7 @@
'use client';
+import Page from '@/features/Settings/service-model';
import WorkspaceAdminOnly from '@/features/WorkspaceSetting/AdminOnly';
-import Page from '@/routes/(main)/settings/service-model';
const WorkspaceServiceModelSetting = () => (
<WorkspaceAdminOnly>
diff --git a/src/routes/(main)/[workspaceSlug]/settings/skill/index.tsx b/src/routes/(main)/[workspaceSlug]/settings/skill/index.tsx
index c66e41eebaf..ac1c9a3c518 100644
--- a/src/routes/(main)/[workspaceSlug]/settings/skill/index.tsx
+++ b/src/routes/(main)/[workspaceSlug]/settings/skill/index.tsx
@@ -1,6 +1,6 @@
'use client';
-import Page from '@/routes/(main)/settings/skill';
+import Page from '@/features/Settings/skill';
const WorkspaceSkillSetting = () => <Page />;
diff --git a/src/routes/(main)/[workspaceSlug]/settings/statistics/index.test.tsx b/src/routes/(main)/[workspaceSlug]/settings/statistics/index.test.tsx
index 6b39f302b5b..834a2e86218 100644
--- a/src/routes/(main)/[workspaceSlug]/settings/statistics/index.test.tsx
+++ b/src/routes/(main)/[workspaceSlug]/settings/statistics/index.test.tsx
@@ -13,7 +13,7 @@ vi.mock('@/business/client/hooks/useFetchWorkspaceMembers', () => ({
useFetchWorkspaceMembers: useFetchWorkspaceMembersMock,
}));
-vi.mock('@/routes/(main)/settings/stats/features/overview/WorkspaceWelcome', () => ({
+vi.mock('@/features/Settings/stats/features/overview/WorkspaceWelcome', () => ({
default: () => <div>Workspace Welcome</div>,
}));
@@ -24,7 +24,7 @@ vi.mock('react-i18next', () => ({
}),
}));
-vi.mock('@/routes/(main)/settings/stats', () => ({
+vi.mock('@/features/Settings/stats', () => ({
default: (props: {
resolveUser: (userId: string) => { avatar?: string | null; name: string };
showSettingHeader?: boolean;
diff --git a/src/routes/(main)/[workspaceSlug]/settings/statistics/index.tsx b/src/routes/(main)/[workspaceSlug]/settings/statistics/index.tsx
index 5c70e728e8f..b9141d54853 100644
--- a/src/routes/(main)/[workspaceSlug]/settings/statistics/index.tsx
+++ b/src/routes/(main)/[workspaceSlug]/settings/statistics/index.tsx
@@ -6,9 +6,9 @@ import { useTranslation } from 'react-i18next';
import WorkspaceSpendInsights from '@/business/client/features/WorkspaceSpendInsights';
import { useFetchWorkspaceMembers } from '@/business/client/hooks/useFetchWorkspaceMembers';
-import Page from '@/routes/(main)/settings/stats';
-import WorkspaceWelcome from '@/routes/(main)/settings/stats/features/overview/WorkspaceWelcome';
-import { type UserDisplay } from '@/routes/(main)/settings/stats/types';
+import Page from '@/features/Settings/stats';
+import WorkspaceWelcome from '@/features/Settings/stats/features/overview/WorkspaceWelcome';
+import { type UserDisplay } from '@/features/Settings/stats/types';
interface WorkspaceStatsMemberProfile {
avatar?: string | null;
diff --git a/src/routes/(main)/_layout/DesktopAutoOidcOnFirstOpen.tsx b/src/routes/(main)/_layout/DesktopAutoOidcOnFirstOpen.tsx
index 7828624e0de..1a2af92c948 100644
--- a/src/routes/(main)/_layout/DesktopAutoOidcOnFirstOpen.tsx
+++ b/src/routes/(main)/_layout/DesktopAutoOidcOnFirstOpen.tsx
@@ -2,7 +2,7 @@
import { memo, useEffect } from 'react';
-import { getDesktopOnboardingCompleted } from '@/routes/(desktop)/desktop-onboarding/storage';
+import { getDesktopOnboardingCompleted } from '@/features/DesktopOnboarding/storage';
import { useElectronStore } from '@/store/electron';
import {
getDesktopAutoOidcFirstOpenHandled,
diff --git a/src/routes/(main)/_layout/index.desktop.tsx b/src/routes/(main)/_layout/index.desktop.tsx
index f4afeb9f458..fa47b50993f 100644
--- a/src/routes/(main)/_layout/index.desktop.tsx
+++ b/src/routes/(main)/_layout/index.desktop.tsx
@@ -29,10 +29,10 @@ import TabCacheBridges from '@/features/Electron/titlebar/TabBar/TabCacheBridges
import TitleBar from '@/features/Electron/titlebar/TitleBar';
import HotkeyHelperPanel from '@/features/HotkeyHelperPanel';
import NavPanelShell from '@/features/NavPanel/Shell';
+import { DndContextWrapper } from '@/features/ResourceManager/DndContextWrapper';
import { usePlatform } from '@/hooks/usePlatform';
import CmdkLazy from '@/layout/GlobalProvider/CmdkLazy';
import dynamic from '@/libs/next/dynamic';
-import { DndContextWrapper } from '@/routes/(main)/resource/features/DndContextWrapper';
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
import DesktopAutoOidcOnFirstOpen from './DesktopAutoOidcOnFirstOpen';
diff --git a/src/routes/(main)/_layout/index.tsx b/src/routes/(main)/_layout/index.tsx
index 4eefba8bada..f6c944f1ad1 100644
--- a/src/routes/(main)/_layout/index.tsx
+++ b/src/routes/(main)/_layout/index.tsx
@@ -26,11 +26,11 @@ import TabCacheBridges from '@/features/Electron/titlebar/TabBar/TabCacheBridges
import TitleBar from '@/features/Electron/titlebar/TitleBar';
import HotkeyHelperPanel from '@/features/HotkeyHelperPanel';
import NavPanelShell from '@/features/NavPanel/Shell';
+import { DndContextWrapper } from '@/features/ResourceManager/DndContextWrapper';
import { RouteMetaBridge } from '@/features/RouteMeta';
import { usePlatform } from '@/hooks/usePlatform';
import CmdkLazy from '@/layout/GlobalProvider/CmdkLazy';
import dynamic from '@/libs/next/dynamic';
-import { DndContextWrapper } from '@/routes/(main)/resource/features/DndContextWrapper';
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
import DesktopHome from '../home';
diff --git a/src/routes/(main)/group/_layout/Sidebar/Header/Agent/SwitchPanel.tsx b/src/routes/(main)/group/_layout/Sidebar/Header/Agent/SwitchPanel.tsx
index 68be0c8e540..03e243a4ddc 100644
--- a/src/routes/(main)/group/_layout/Sidebar/Header/Agent/SwitchPanel.tsx
+++ b/src/routes/(main)/group/_layout/Sidebar/Header/Agent/SwitchPanel.tsx
@@ -2,10 +2,10 @@ import { Flexbox, Popover } from '@lobehub/ui';
import { type PropsWithChildren } from 'react';
import React, { memo, Suspense } from 'react';
+import List from '@/features/HomeSidebar/Body/Agent/List';
+import { AgentModalProvider } from '@/features/HomeSidebar/Body/Agent/ModalProvider';
import SkeletonList from '@/features/NavPanel/components/SkeletonList';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-import List from '@/routes/(main)/home/_layout/Body/Agent/List';
-import { AgentModalProvider } from '@/routes/(main)/home/_layout/Body/Agent/ModalProvider';
const SwitchPanel = memo<PropsWithChildren>(({ children }) => {
const navigate = useWorkspaceAwareNavigate();
diff --git a/src/routes/(main)/home/_layout/index.tsx b/src/routes/(main)/home/_layout/index.tsx
index 019e896c649..a2b804705f9 100644
--- a/src/routes/(main)/home/_layout/index.tsx
+++ b/src/routes/(main)/home/_layout/index.tsx
@@ -1,71 +1 @@
-import { Flexbox } from '@lobehub/ui';
-import { useTheme } from 'antd-style';
-import { Activity, type FC, type ReactNode, useEffect, useMemo, useState } from 'react';
-import { Outlet, useLocation } from 'react-router';
-
-import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaceSlug';
-import { useIsDark } from '@/hooks/useIsDark';
-
-import HomeAgentIdSync from './HomeAgentIdSync';
-import RecentHydration from './RecentHydration';
-import { styles } from './style';
-
-interface LayoutProps {
- children?: ReactNode;
-}
-
-const Layout: FC<LayoutProps> = ({ children }) => {
- const isDarkMode = useIsDark();
- const theme = useTheme(); // Keep for colorBgContainerSecondary (not in cssVar)
- const { pathname } = useLocation();
- const activeSlug = useActiveWorkspaceSlug();
- const isHomeRoute =
- pathname === '/' ||
- (!!activeSlug && (pathname === `/${activeSlug}` || pathname === `/${activeSlug}/`));
- const [hasActivated, setHasActivated] = useState(isHomeRoute);
- const content = children ?? <Outlet />;
-
- useEffect(() => {
- if (isHomeRoute) setHasActivated(true);
- }, [isHomeRoute]);
-
- // CSS variable for dynamic background color (colorBgContainerSecondary is not in cssVar)
- const cssVariables = useMemo<Record<string, string>>(
- () => ({
- '--content-bg-secondary': theme.colorBgContainerSecondary,
- }),
- [theme.colorBgContainerSecondary],
- );
-
- if (!hasActivated) return null;
-
- // Keep the Home layout alive and render it offscreen when inactive. The nav
- // panel entry is owned by `NavPanelShell`, not by this layout — see the note
- // there for why it cannot be registered from inside the route tree.
- return (
- <Activity mode={isHomeRoute ? 'visible' : 'hidden'} name="DesktopHomeLayout">
- {/* `position: absolute; inset: 0` keeps overlaying the outlet when Activity is hidden,
- because Activity preserves state but doesn't visually hide the DOM. Force-hide here. */}
- <Flexbox
- className={styles.absoluteContainer}
- height={'100%'}
- style={isHomeRoute ? undefined : { display: 'none' }}
- width={'100%'}
- >
- <Flexbox
- className={isDarkMode ? styles.contentDark : styles.contentLight}
- flex={1}
- height={'100%'}
- style={cssVariables}
- >
- {content}
- </Flexbox>
-
- <HomeAgentIdSync />
- <RecentHydration />
- </Flexbox>
- </Activity>
- );
-};
-
-export default Layout;
+export { default } from '@/features/HomeLayout';
diff --git a/src/routes/(main)/resource/(home)/_layout/index.tsx b/src/routes/(main)/resource/(home)/_layout/index.tsx
index a45b05f274c..39bc44af140 100644
--- a/src/routes/(main)/resource/(home)/_layout/index.tsx
+++ b/src/routes/(main)/resource/(home)/_layout/index.tsx
@@ -1,21 +1 @@
-'use client';
-
-import { Flexbox } from '@lobehub/ui';
-import { type FC } from 'react';
-import { Outlet } from 'react-router';
-
-import Sidebar from './Sidebar';
-import { styles } from './style';
-
-const HomeLayout: FC = () => {
- return (
- <>
- <Sidebar />
- <Flexbox className={styles.mainContainer} flex={1} height={'100%'}>
- <Outlet />
- </Flexbox>
- </>
- );
-};
-
-export default HomeLayout;
+export { default } from '@/features/ResourceHome/Layout';
diff --git a/src/routes/(main)/resource/(home)/index.tsx b/src/routes/(main)/resource/(home)/index.tsx
index ccac04bd4f2..2d0131bdca7 100644
--- a/src/routes/(main)/resource/(home)/index.tsx
+++ b/src/routes/(main)/resource/(home)/index.tsx
@@ -1,61 +1 @@
-'use client';
-
-import { memo, useLayoutEffect } from 'react';
-import { useLocation, useSearchParams } from 'react-router';
-
-import ResourceManager from '@/features/ResourceManager';
-import WorkGallery from '@/features/WorkGallery';
-import { parseWorkGalleryKey } from '@/features/WorkGallery/const';
-import { FilesTabs } from '@/types/files';
-
-import { useInitFileCheck } from '../features/hooks/useInitFileCheck';
-import { useResourceManagerStore } from '../features/store';
-
-const ResourceHomePage = memo(() => {
- const [searchParams] = useSearchParams();
- const location = useLocation();
- const [setCategory, setLibraryId] = useResourceManagerStore((s) => [
- s.setCategory,
- s.setLibraryId,
- ]);
-
- const categoryParam = (searchParams.get('category') as FilesTabs) || FilesTabs.All;
- // `?works=<type>` switches the content area to the cross-topic Work gallery,
- // independent of the file explorer (which stays keyed on `?category=`).
- const worksKey = parseWorkGalleryKey(searchParams.get('works'));
-
- // Clear libraryId when on home route using useLayoutEffect
- // useLayoutEffect runs synchronously before browser paint, ensuring state is cleared
- // before child components' useEffects run, while avoiding React's setState-in-render error
- // IMPORTANT: Only depend on location.pathname, NOT currentLibraryId to avoid feedback loop
- // When location changes to /resource, clear libraryId
- // Don't clear when location is /library/* (even if this component is still mounted)
- useLayoutEffect(() => {
- const isOnHomeRoute =
- location.pathname === '/resource' || !location.pathname.includes('/library/');
- if (isOnHomeRoute) {
- setLibraryId(undefined);
- }
- }, [setLibraryId, location.pathname]);
-
- // Sync category from URL using useLayoutEffect
- // IMPORTANT: Only sync if we're actually on the home route (not transitioning to library)
- useLayoutEffect(() => {
- const isOnHomeRoute =
- location.pathname === '/resource' || !location.pathname.includes('/library/');
- if (isOnHomeRoute) {
- setCategory(categoryParam);
- }
- }, [categoryParam, setCategory, location.pathname]);
-
- // Sync file view mode from URL
- useInitFileCheck();
-
- if (worksKey) return <WorkGallery galleryKey={worksKey} />;
-
- return <ResourceManager />;
-});
-
-ResourceHomePage.displayName = 'ResourceHomePage';
-
-export default ResourceHomePage;
+export { default } from '@/features/ResourceHome';
diff --git a/src/routes/(main)/resource/_layout/index.tsx b/src/routes/(main)/resource/_layout/index.tsx
index e169f43b1f2..2da846be3de 100644
--- a/src/routes/(main)/resource/_layout/index.tsx
+++ b/src/routes/(main)/resource/_layout/index.tsx
@@ -1,17 +1 @@
-'use client';
-
-import { type FC } from 'react';
-import { Outlet } from 'react-router';
-
-import RegisterHotkeys from './RegisterHotkeys';
-
-const ResourceLayout: FC = () => {
- return (
- <>
- <Outlet />
- <RegisterHotkeys />
- </>
- );
-};
-
-export default ResourceLayout;
+export { default } from '@/features/ResourceManager/Layout';
diff --git a/src/routes/(main)/resource/library/[slug]/index.tsx b/src/routes/(main)/resource/library/[slug]/index.tsx
index f9cf91f3f60..a217da5ab89 100644
--- a/src/routes/(main)/resource/library/[slug]/index.tsx
+++ b/src/routes/(main)/resource/library/[slug]/index.tsx
@@ -1 +1 @@
-export { default } from '../index';
+export { default } from '@/features/ResourceLibrary';
diff --git a/src/routes/(main)/resource/library/_layout/index.tsx b/src/routes/(main)/resource/library/_layout/index.tsx
index 1c17970da85..4ec9008602b 100644
--- a/src/routes/(main)/resource/library/_layout/index.tsx
+++ b/src/routes/(main)/resource/library/_layout/index.tsx
@@ -1,24 +1 @@
-'use client';
-
-import { Flexbox } from '@lobehub/ui';
-import { type FC } from 'react';
-import { Outlet } from 'react-router';
-
-import RegisterHotkeys from '@/routes/(main)/resource/library/features/RegisterHotkeys';
-
-import Sidebar from './Sidebar';
-import { styles } from './style';
-
-const LibraryLayout: FC = () => {
- return (
- <>
- <Sidebar />
- <Flexbox className={styles.mainContainer} flex={1} height={'100%'}>
- <Outlet />
- </Flexbox>
- <RegisterHotkeys />
- </>
- );
-};
-
-export default LibraryLayout;
+export { default } from '@/features/ResourceLibrary/Layout';
diff --git a/src/routes/(main)/resource/library/index.tsx b/src/routes/(main)/resource/library/index.tsx
index 17fb30789fa..a217da5ab89 100644
--- a/src/routes/(main)/resource/library/index.tsx
+++ b/src/routes/(main)/resource/library/index.tsx
@@ -1,63 +1 @@
-'use client';
-
-import { memo, useLayoutEffect } from 'react';
-import { useLocation, useParams } from 'react-router';
-
-import NotFound from '@/components/404';
-import AsyncError from '@/components/AsyncError';
-import NProgress from '@/components/NProgress';
-import ResourceManager from '@/features/ResourceManager';
-import Container from '@/routes/(main)/resource/library/features/Container';
-
-import { useInitFileCheck } from '../features/hooks/useInitFileCheck';
-import { useKnowledgeBaseItem } from '../features/hooks/useKnowledgeItem';
-import { useResourceManagerStore } from '../features/store';
-
-const MainContent = memo(() => {
- const { id: knowledgeBaseId } = useParams<{ id: string }>();
- const location = useLocation();
- const setLibraryId = useResourceManagerStore((s) => s.setLibraryId);
-
- // Load knowledge base data
- const { data, isLoading, error, mutate } = useKnowledgeBaseItem(knowledgeBaseId || '');
-
- // Sync libraryId from URL params using useLayoutEffect
- // useLayoutEffect runs synchronously before browser paint, ensuring state is set
- // before Explorer component renders and computes query parameters
- // IMPORTANT: Only depend on knowledgeBaseId and location.pathname, NOT currentLibraryId to avoid feedback loop
- useLayoutEffect(() => {
- const isOnLibraryRoute = location.pathname.includes('/library/');
- if (isOnLibraryRoute) {
- setLibraryId(knowledgeBaseId);
- }
- }, [knowledgeBaseId, setLibraryId, location.pathname]);
-
- // Sync file view mode from URL
- useInitFileCheck();
-
- // A network / 500 on the KB fetch is NOT "this library doesn't exist" (Read §1.1):
- // branch a transient error to a reload state that keeps the URL, and reserve the
- // terminal 404 for a genuinely resolved-null (deleted / never-existed) record.
- if (error && !data) return <AsyncError error={error} variant={'page'} onRetry={() => mutate()} />;
-
- if (!isLoading && !data) return <NotFound />;
-
- return <ResourceManager />;
-});
-
-MainContent.displayName = 'LibraryMainContent';
-
-const LibraryPage = memo(() => {
- return (
- <>
- <NProgress />
- <Container>
- <MainContent />
- </Container>
- </>
- );
-});
-
-LibraryPage.displayName = 'LibraryPage';
-
-export default LibraryPage;
+export { default } from '@/features/ResourceLibrary';
diff --git a/src/routes/(main)/settings/_layout/index.tsx b/src/routes/(main)/settings/_layout/index.tsx
index 5cf328eee30..9cf35adb44e 100644
--- a/src/routes/(main)/settings/_layout/index.tsx
+++ b/src/routes/(main)/settings/_layout/index.tsx
@@ -1,28 +1 @@
-'use client';
-
-import { Flexbox } from '@lobehub/ui';
-import { type FC } from 'react';
-import { Outlet } from 'react-router';
-
-import SideBar from '@/routes/(main)/settings/_layout/SideBar';
-
-import SettingsContextProvider from './ContextProvider';
-import { styles } from './style';
-
-const Layout: FC = () => {
- return (
- <SettingsContextProvider
- value={{
- showOpenAIApiKey: true,
- showOpenAIProxyUrl: true,
- }}
- >
- <SideBar />
- <Flexbox className={styles.mainContainer} flex={1} height={'100%'}>
- <Outlet />
- </Flexbox>
- </SettingsContextProvider>
- );
-};
-
-export default Layout;
+export { default } from '@/features/Settings/Layout';
diff --git a/src/routes/(main)/settings/index.tsx b/src/routes/(main)/settings/index.tsx
index 0a914b353e8..fbfc54b61ab 100644
--- a/src/routes/(main)/settings/index.tsx
+++ b/src/routes/(main)/settings/index.tsx
@@ -1,40 +1 @@
-'use client';
-
-import { memo } from 'react';
-import { useMatches, useParams } from 'react-router';
-
-import { SettingsTabs } from '@/store/global/initialState';
-
-import { type LayoutProps } from './_layout/type';
-import SettingsContent from './features/SettingsContent';
-
-interface SettingsRouteHandle {
- settingsTab?: SettingsTabs;
-}
-
-const isSettingsRouteHandle = (handle: unknown): handle is SettingsRouteHandle => {
- return typeof handle === 'object' && handle !== null && 'settingsTab' in handle;
-};
-
-const getSettingsTabFromMatches = (matches: ReturnType<typeof useMatches>) => {
- for (const match of [...matches].reverse()) {
- const { handle } = match;
- if (isSettingsRouteHandle(handle) && handle.settingsTab) return handle.settingsTab;
- }
-};
-
-const Layout = memo<LayoutProps>(() => {
- const params = useParams<{ tab?: string }>();
- const matches = useMatches();
-
- const activeTab =
- (params.tab as SettingsTabs | undefined) ||
- getSettingsTabFromMatches(matches) ||
- SettingsTabs.Profile;
-
- return <SettingsContent activeTab={activeTab} mobile={false} />;
-});
-
-Layout.displayName = 'DesktopSettingsLayout';
-
-export default Layout;
+export { default } from '@/features/Settings';
diff --git a/src/routes/(main)/settings/provider/index.tsx b/src/routes/(main)/settings/provider/index.tsx
index 005f37ec936..be98301eb77 100644
--- a/src/routes/(main)/settings/provider/index.tsx
+++ b/src/routes/(main)/settings/provider/index.tsx
@@ -1,72 +1 @@
-'use client';
-
-import { Flexbox } from '@lobehub/ui';
-import { memo } from 'react';
-import { Outlet, useParams } from 'react-router';
-
-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-
-import DesktopLayoutContainer from './_layout/Desktop/Container';
-import ProviderDetailPageComponent from './detail';
-import ProviderMenu from './ProviderMenu';
-
-// Layout component that wraps provider pages with navigation
-export const ProviderLayout = memo(() => {
- const navigate = useWorkspaceAwareNavigate();
-
- const handleProviderSelect = (providerKey: string) => {
- navigate(`/settings/provider/${providerKey}`);
- };
-
- return (
- <Flexbox
- horizontal
- width={'100%'}
- style={{
- maxHeight: '100%',
- }}
- >
- <ProviderMenu mobile={false} onProviderSelect={handleProviderSelect} />
- <DesktopLayoutContainer>
- <Outlet />
- </DesktopLayoutContainer>
- </Flexbox>
- );
-});
-
-ProviderLayout.displayName = 'ProviderLayout';
-
-// Detail page component that receives providerId from route params
-export const ProviderDetailPage = memo(() => {
- const params = useParams<{ providerId: string }>();
- const navigate = useWorkspaceAwareNavigate();
-
- const handleProviderSelect = (providerKey: string) => {
- navigate(`/settings/provider/${providerKey}`);
- };
-
- return (
- <ProviderDetailPageComponent
- id={params.providerId ?? ''}
- onProviderSelect={handleProviderSelect}
- />
- );
-});
-
-ProviderDetailPage.displayName = 'ProviderDetailPage';
-
-// Default export for backward compatibility (used by SettingsContent)
-type ProviderPageType = {
- mobile?: boolean;
-};
-
-const ProviderPage = (props: ProviderPageType) => {
- const { mobile } = props;
-
- // For mobile or when used via SettingsContent, use the old Page component
- // This is a fallback for non-router usage
- const OldPage = require('./(list)').default;
- return <OldPage mobile={mobile} />;
-};
-
-export default ProviderPage;
+export { default, ProviderDetailPage, ProviderLayout } from '@/features/Settings/provider';
diff --git a/src/routes/(mobile)/(home)/_layout/index.tsx b/src/routes/(mobile)/(home)/_layout/index.tsx
index ef6a858c5df..f6ff92bc70f 100644
--- a/src/routes/(mobile)/(home)/_layout/index.tsx
+++ b/src/routes/(mobile)/(home)/_layout/index.tsx
@@ -1,18 +1 @@
-import { type FC } from 'react';
-import { Outlet } from 'react-router';
-
-import MobileLayout from '@/routes/(mobile)/(home)/_layout/MobileLayout';
-import SessionHydration from '@/routes/(mobile)/(home)/_layout/SessionHydration';
-
-const Layout: FC = () => {
- return (
- <>
- <MobileLayout>
- <Outlet />
- </MobileLayout>
- <SessionHydration />
- </>
- );
-};
-
-export default Layout;
+export { default } from '@/features/MobileHome/Layout';
diff --git a/src/routes/(mobile)/(home)/index.tsx b/src/routes/(mobile)/(home)/index.tsx
index 5e551205b72..b8d36d29dcb 100644
--- a/src/routes/(mobile)/(home)/index.tsx
+++ b/src/routes/(mobile)/(home)/index.tsx
@@ -1,16 +1 @@
-import { memo,Suspense } from 'react';
-
-import SessionListContent from './features/SessionListContent';
-import SkeletonList from './features/SkeletonList';
-
-const Home = memo(() => {
- return (
- <Suspense fallback={<SkeletonList />}>
- <SessionListContent />
- </Suspense>
- );
-});
-
-Home.displayName = 'MobileHome';
-
-export default Home;
+export { default } from '@/features/MobileHome';
diff --git a/src/routes/(mobile)/settings/_layout/index.tsx b/src/routes/(mobile)/settings/_layout/index.tsx
index aab28511ea0..ce2f090aa4f 100644
--- a/src/routes/(mobile)/settings/_layout/index.tsx
+++ b/src/routes/(mobile)/settings/_layout/index.tsx
@@ -4,8 +4,8 @@ import { memo } from 'react';
import { Outlet } from 'react-router';
import MobileContentLayout from '@/components/server/MobileNavLayout';
+import SettingsContextProvider from '@/features/Settings/Layout/ContextProvider';
-import SettingsContextProvider from '../../../(main)/settings/_layout/ContextProvider';
import Header from './Header';
const MobileSettingsWrapper = memo(() => {
diff --git a/src/routes/(mobile)/settings/index.tsx b/src/routes/(mobile)/settings/index.tsx
index 4b254342811..65c036a06fd 100644
--- a/src/routes/(mobile)/settings/index.tsx
+++ b/src/routes/(mobile)/settings/index.tsx
@@ -2,10 +2,10 @@
import MobileContentLayout from '@/components/server/MobileNavLayout';
import Footer from '@/features/Setting/Footer';
+import SettingsContent from '@/features/Settings/features/SettingsContent';
import { parseAsString, useQueryState } from '@/hooks/useQueryParam';
import { SettingsTabs } from '@/store/global/initialState';
-import SettingsContent from '../../(main)/settings/features/SettingsContent';
import Header from './_layout/Header';
const Layout = () => {
diff --git a/src/routes/(mobile)/settings/provider/_layout/index.tsx b/src/routes/(mobile)/settings/provider/_layout/index.tsx
index 5eda0466b3f..1dbb08df01d 100644
--- a/src/routes/(mobile)/settings/provider/_layout/index.tsx
+++ b/src/routes/(mobile)/settings/provider/_layout/index.tsx
@@ -2,10 +2,9 @@
import { Outlet, useParams } from 'react-router';
+import ProviderMenu from '@/features/Settings/provider/ProviderMenu';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
-import ProviderMenu from '../../../../(main)/settings/provider/ProviderMenu';
-
const Layout = () => {
const params = useParams<{ providerId: string }>();
const navigate = useWorkspaceAwareNavigate();
diff --git a/src/routes/onboarding/index.tsx b/src/routes/onboarding/index.tsx
index 444c6cfb032..45bab47ea0b 100644
--- a/src/routes/onboarding/index.tsx
+++ b/src/routes/onboarding/index.tsx
@@ -1,96 +1 @@
-'use client';
-
-import { Flexbox } from '@lobehub/ui';
-import { memo, useCallback, useEffect, useRef } from 'react';
-import { useSearchParams } from 'react-router';
-
-import Loading from '@/components/Loading/BrandTextLoading';
-import ClassicOnboardingPage from '@/features/Onboarding/Classic';
-import { useOnboardingAgentTemplates } from '@/hooks/useOnboardingAgentTemplates';
-import OnboardingContainer from '@/routes/onboarding/_layout';
-import ResponseLanguageStep from '@/routes/onboarding/features/ResponseLanguageStep';
-import TelemetryStep from '@/routes/onboarding/features/TelemetryStep';
-import {
- trackOnboardingStepCompleted,
- trackOnboardingStepViewed,
-} from '@/services/onboardingMetrics';
-import { useUserStore } from '@/store/user';
-import { onboardingSelectors } from '@/store/user/selectors';
-import { clearStaleOnboardingCallbackUrl } from '@/utils/onboardingRedirect';
-
-const COMMON_STEP_TRACKING = {
- 1: { flow: 'common', step: 'telemetry', stepIndex: 1 },
- 2: { flow: 'common', step: 'response_language', stepIndex: 2 },
-} as const;
-
-const OnboardingPage = memo(() => {
- const isUserStateInit = useUserStore((s) => s.isUserStateInit);
- const commonStepsCompleted = useUserStore(onboardingSelectors.commonStepsCompleted);
-
- const [searchParams, setSearchParams] = useSearchParams();
- const step: 1 | 2 = searchParams.get('step') === '2' ? 2 : 1;
- const hasStepParam = searchParams.has('step');
- const viewedStepKeysRef = useRef<Set<string>>(new Set());
-
- useOnboardingAgentTemplates(isUserStateInit && (!commonStepsCompleted || hasStepParam));
-
- // This component only mounts on top-level entries to `/onboarding` (fresh
- // signup landings and `?step` re-entries from the classic back button), so
- // mount is the one safe point to drop a stale callback stashed by a
- // previously abandoned attempt — later search changes are internal step
- // navigations that must keep the stash.
- useEffect(() => {
- clearStaleOnboardingCallbackUrl(window.location.pathname, window.location.search);
- }, []);
-
- useEffect(() => {
- if (!isUserStateInit || (commonStepsCompleted && !hasStepParam)) return;
-
- const payload = COMMON_STEP_TRACKING[step];
- if (viewedStepKeysRef.current.has(payload.step)) return;
-
- viewedStepKeysRef.current.add(payload.step);
- trackOnboardingStepViewed(payload);
- }, [commonStepsCompleted, hasStepParam, isUserStateInit, step]);
-
- const goNextFromTelemetry = useCallback(() => {
- trackOnboardingStepCompleted(COMMON_STEP_TRACKING[1]);
- setSearchParams({ step: '2' }, { replace: true });
- }, [setSearchParams]);
-
- const goBackFromLanguage = useCallback(() => {
- setSearchParams({ step: '1' }, { replace: true });
- }, [setSearchParams]);
-
- const finishCommon = useCallback(() => {
- trackOnboardingStepCompleted(COMMON_STEP_TRACKING[2]);
- setSearchParams({}, { replace: true });
- }, [setSearchParams]);
-
- if (!isUserStateInit) {
- return <Loading debugId="Onboarding/userState" />;
- }
-
- // With the shared prefix complete, `/onboarding` renders the classic branch
- // inline — but an explicit `?step` (classic FullName back button) re-enters
- // the prefix.
- if (commonStepsCompleted && !hasStepParam) {
- return <ClassicOnboardingPage />;
- }
-
- return (
- <OnboardingContainer>
- <Flexbox gap={24} style={{ maxWidth: 600, width: '100%' }}>
- {step === 1 ? (
- <TelemetryStep onNext={goNextFromTelemetry} />
- ) : (
- <ResponseLanguageStep onBack={goBackFromLanguage} onNext={finishCommon} />
- )}
- </Flexbox>
- </OnboardingContainer>
- );
-});
-
-OnboardingPage.displayName = 'OnboardingPage';
-
-export default OnboardingPage;
+export { default } from '@/features/Onboarding';
diff --git a/src/spa/router/desktopRouter.shared.tsx b/src/spa/router/desktopRouter.shared.tsx
index e583e181c62..0ce3c944b04 100644
--- a/src/spa/router/desktopRouter.shared.tsx
+++ b/src/spa/router/desktopRouter.shared.tsx
@@ -23,6 +23,7 @@ import { agentDocumentRouteMeta } from '@/features/AgentDocumentPage/routeMeta';
import { taskRouteMeta, tasksRouteMeta } from '@/features/AgentTasks/routeMeta';
import { agentsRouteMeta } from '@/features/AgentViewAll/routeMeta';
import { pageRouteMeta } from '@/features/Pages/routeMeta';
+import { settingsRouteMeta } from '@/features/Settings/features/routeMeta';
import { workspaceHomeRouteMeta } from '@/features/Workspace/routeMeta';
import {
agentChannelRouteMeta,
@@ -33,7 +34,6 @@ import {
topicsRouteMeta,
} from '@/routes/(main)/agent/features/routeMeta';
import { groupProfileRouteMeta, groupRouteMeta } from '@/routes/(main)/group/features/routeMeta';
-import { settingsRouteMeta } from '@/routes/(main)/settings/features/routeMeta';
import AppShellSkeleton, { APP_SHELL_FALLBACK_ID } from '@/spa/BootShell/AppShellSkeleton';
import { loadRouteWithBuiltinToolSurfaces } from '@/spa/initialize/toolSurfaces';
import { routeMeta } from '@/spa/router/routeMeta';