@lobehub/chat 0.142.3 → 0.142.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/package.json +1 -1
  3. package/src/app/chat/(desktop)/features/ChatHeader/HeaderAction.tsx +2 -2
  4. package/src/app/chat/(desktop)/index.tsx +12 -23
  5. package/src/app/chat/(mobile)/features/SessionHeader.tsx +2 -0
  6. package/src/app/chat/(mobile)/index.tsx +4 -7
  7. package/src/app/chat/(mobile)/{features/ChatHeader.tsx → mobile/ChatHeader/index.tsx} +2 -2
  8. package/src/app/chat/(mobile)/mobile/page.tsx +6 -4
  9. package/src/app/chat/{(desktop)/features → _layout/Desktop}/SessionList.tsx +2 -0
  10. package/src/app/chat/{(desktop)/layout.desktop.tsx → _layout/Desktop/index.tsx} +7 -6
  11. package/src/app/chat/_layout/Mobile/index.tsx +7 -0
  12. package/src/app/chat/components/SessionHydration/index.tsx +1 -6
  13. package/src/app/chat/features/SessionListContent/Inbox/index.tsx +4 -11
  14. package/src/app/chat/features/SessionListContent/List/index.tsx +2 -14
  15. package/src/app/chat/features/{ChatHeader/ShareButton → ShareButton}/Preview.tsx +1 -1
  16. package/src/app/chat/layout.ts +8 -0
  17. package/src/app/chat/page.tsx +2 -0
  18. package/src/app/chat/settings/(desktop)/index.tsx +13 -19
  19. package/src/app/chat/settings/(mobile)/{features/Header.tsx → Header.tsx} +4 -1
  20. package/src/app/chat/settings/(mobile)/index.tsx +4 -3
  21. package/src/app/home/Redirect.tsx +0 -4
  22. package/src/app/layout.tsx +7 -12
  23. package/src/app/market/(desktop)/index.tsx +8 -16
  24. package/src/app/market/(mobile)/index.tsx +12 -7
  25. package/src/app/market/_layout/Desktop/index.tsx +59 -0
  26. package/src/app/market/_layout/Mobile/Header.tsx +20 -0
  27. package/src/app/market/_layout/Mobile/index.tsx +14 -0
  28. package/src/app/market/layout.ts +8 -0
  29. package/src/app/settings/(desktop)/index.tsx +8 -10
  30. package/src/app/settings/(mobile)/index.tsx +53 -1
  31. package/src/app/settings/{(desktop)/features → _layout/Desktop}/Header.tsx +8 -3
  32. package/src/app/settings/{(desktop)/features → _layout/Desktop}/SideBar.tsx +8 -3
  33. package/src/app/settings/_layout/Desktop/index.tsx +27 -0
  34. package/src/app/settings/{(mobile)/features/Header/index.tsx → _layout/Mobile/SubSettingHeader.tsx} +9 -8
  35. package/src/app/settings/_layout/Mobile/index.tsx +23 -0
  36. package/src/app/settings/layout.ts +8 -0
  37. package/src/app/settings/page.tsx +4 -2
  38. package/src/app/welcome/(desktop)/index.tsx +9 -17
  39. package/src/app/welcome/(mobile)/index.tsx +12 -6
  40. package/src/app/welcome/_layout/Desktop.tsx +29 -0
  41. package/src/app/welcome/_layout/Mobile.tsx +9 -0
  42. package/src/app/welcome/features/Banner/index.tsx +1 -3
  43. package/src/app/welcome/layout.ts +8 -0
  44. package/src/components/client/ClientResponsiveContent/index.tsx +32 -0
  45. package/src/components/client/ClientResponsiveLayout.tsx +32 -0
  46. package/src/components/server/ServerLayout.tsx +20 -0
  47. package/src/features/AvatarWithUpload/index.tsx +12 -9
  48. package/src/features/MobileSwitchLoading/index.tsx +2 -0
  49. package/src/hooks/useActiveSettingsKey.ts +16 -0
  50. package/src/hooks/useActiveTabKey.ts +12 -0
  51. package/src/hooks/useIsMobile.ts +2 -1
  52. package/src/hooks/useIsSubSlug.ts +12 -0
  53. package/src/layout/AuthProvider/index.tsx +16 -0
  54. package/src/layout/{AppLayout.desktop.tsx → GlobalLayout/Desktop/Client.tsx} +11 -9
  55. package/src/layout/GlobalLayout/Desktop/index.tsx +16 -0
  56. package/src/layout/{AppLayout.mobile.tsx → GlobalLayout/Mobile/Client.tsx} +2 -16
  57. package/src/layout/GlobalLayout/Mobile/index.tsx +25 -0
  58. package/src/layout/GlobalLayout/index.tsx +8 -0
  59. package/src/store/session/slices/session/action.test.ts +0 -35
  60. package/src/store/session/slices/session/action.ts +8 -21
  61. package/src/store/session/slices/session/initialState.ts +0 -7
  62. package/src/styles/mobileHeader.ts +7 -0
  63. package/src/app/chat/settings/(desktop)/layout.desktop.tsx +0 -18
  64. package/src/app/chat/settings/(mobile)/layout.mobile.tsx +0 -9
  65. package/src/app/market/(desktop)/layout.desktop.tsx +0 -65
  66. package/src/app/market/(mobile)/features/Header.tsx +0 -10
  67. package/src/app/market/(mobile)/layout.mobile.tsx +0 -25
  68. package/src/app/settings/(desktop)/layout.desktop.tsx +0 -35
  69. package/src/app/settings/(desktop)/layout.responsive.tsx +0 -21
  70. package/src/app/settings/(mobile)/features/Header/Home.tsx +0 -8
  71. package/src/app/settings/(mobile)/layout.mobile.tsx +0 -21
  72. package/src/app/settings/(mobile)/mobile/index.tsx +0 -54
  73. package/src/app/settings/(mobile)/mobile/layout.mobile.tsx +0 -14
  74. package/src/app/settings/about/layout.tsx +0 -9
  75. package/src/app/settings/agent/layout.tsx +0 -9
  76. package/src/app/settings/common/layout.tsx +0 -9
  77. package/src/app/settings/layout.server.tsx +0 -19
  78. package/src/app/settings/llm/layout.tsx +0 -9
  79. package/src/app/settings/sync/layout.tsx +0 -9
  80. package/src/app/settings/tts/layout.tsx +0 -9
  81. package/src/app/welcome/(desktop)/layout.desktop.tsx +0 -31
  82. package/src/app/welcome/(mobile)/features/Header.tsx +0 -6
  83. package/src/app/welcome/(mobile)/features/Showcase.tsx +0 -16
  84. package/src/app/welcome/(mobile)/layout.mobile.tsx +0 -20
  85. package/src/components/ResponsiveContainer/index.tsx +0 -20
  86. package/src/layout/ServerResponsiveLayout/Client.tsx +0 -23
  87. package/src/layout/ServerResponsiveLayout/index.tsx +0 -21
  88. /package/src/app/chat/(mobile)/{features → mobile/ChatHeader}/ChatHeaderTitle.tsx +0 -0
  89. /package/src/app/chat/{(desktop)/features → _layout/Desktop}/SessionHeader.tsx +0 -0
  90. /package/src/app/chat/features/{ChatHeader/SettingButton.tsx → SettingButton.tsx} +0 -0
  91. /package/src/app/chat/features/{ChatHeader/ShareButton → ShareButton}/ShareModal.tsx +0 -0
  92. /package/src/app/chat/features/{ChatHeader/ShareButton → ShareButton}/index.tsx +0 -0
  93. /package/src/app/chat/features/{ChatHeader/ShareButton → ShareButton}/style.ts +0 -0
  94. /package/src/app/chat/features/{ChatHeader/ShareButton → ShareButton}/type.ts +0 -0
  95. /package/src/app/chat/features/{ChatHeader/ShareButton → ShareButton}/useScreenshot.ts +0 -0
  96. /package/src/app/chat/settings/(desktop)/{features/Header.tsx → Header.tsx} +0 -0
  97. /package/src/app/market/{(desktop)/features → _layout/Desktop}/AgentDetail.tsx +0 -0
  98. /package/src/app/market/{(desktop)/features → _layout/Desktop}/Header.tsx +0 -0
  99. /package/src/{features → layout/GlobalLayout/Desktop}/SideBar/BottomActions.tsx +0 -0
  100. /package/src/{features → layout/GlobalLayout/Desktop}/SideBar/TopActions.tsx +0 -0
  101. /package/src/{features → layout/GlobalLayout/Desktop}/SideBar/index.tsx +0 -0
@@ -1,19 +1,21 @@
1
+ 'use client';
2
+
1
3
  import { useTheme } from 'antd-style';
2
- import { ReactNode, memo } from 'react';
4
+ import { PropsWithChildren, memo } from 'react';
3
5
  import { Flexbox } from 'react-layout-kit';
4
6
 
5
- import SideBar from '@/features/SideBar';
7
+ import ClientResponsiveLayout from '@/components/client/ClientResponsiveLayout';
8
+ import { useActiveTabKey } from '@/hooks/useActiveTabKey';
6
9
  import { useIsPWA } from '@/hooks/useIsPWA';
7
- import { SidebarTabKey } from '@/store/global/initialState';
8
10
 
9
- interface AppLayoutDesktopProps {
10
- children: ReactNode;
11
- sidebarKey?: SidebarTabKey;
12
- }
13
- const AppLayoutDesktop = memo<AppLayoutDesktopProps>(({ children, sidebarKey }) => {
11
+ import SideBar from './SideBar';
12
+
13
+ const Desktop = memo<PropsWithChildren>(({ children }) => {
14
14
  const isPWA = useIsPWA();
15
15
  const theme = useTheme();
16
16
 
17
+ const sidebarKey = useActiveTabKey();
18
+
17
19
  return (
18
20
  <Flexbox
19
21
  height={'100%'}
@@ -27,4 +29,4 @@ const AppLayoutDesktop = memo<AppLayoutDesktopProps>(({ children, sidebarKey })
27
29
  );
28
30
  });
29
31
 
30
- export default AppLayoutDesktop;
32
+ export default ClientResponsiveLayout({ Desktop, Mobile: () => import('../Mobile') });
@@ -0,0 +1,16 @@
1
+ 'use client';
2
+
3
+ import { usePathname } from 'next/navigation';
4
+ import { PropsWithChildren, memo } from 'react';
5
+
6
+ import Client from './Client';
7
+
8
+ const DesktopLayout = memo<PropsWithChildren>(({ children }) => {
9
+ const pathname = usePathname();
10
+
11
+ if (pathname === '/') return children;
12
+
13
+ return <Client>{children}</Client>;
14
+ });
15
+
16
+ export default DesktopLayout;
@@ -1,7 +1,7 @@
1
1
  import { type MobileNavBarTitleProps } from '@lobehub/ui';
2
2
  import { createStyles } from 'antd-style';
3
3
  import dynamic from 'next/dynamic';
4
- import { CSSProperties, PropsWithChildren, ReactNode, memo } from 'react';
4
+ import { CSSProperties, PropsWithChildren, memo } from 'react';
5
5
  import { Flexbox } from 'react-layout-kit';
6
6
 
7
7
  import SafeSpacing from '@/components/SafeSpacing';
@@ -19,13 +19,6 @@ const useStyles = createStyles(({ css, cx, stylish }) => ({
19
19
  height: 100%;
20
20
  `,
21
21
  ),
22
- mobileNavBar: css`
23
- position: fixed;
24
- z-index: 100;
25
- top: 0;
26
- right: 0;
27
- left: 0;
28
- `,
29
22
  mobileTabBar: css`
30
23
  position: fixed;
31
24
  z-index: 100;
@@ -37,7 +30,6 @@ const useStyles = createStyles(({ css, cx, stylish }) => ({
37
30
 
38
31
  interface AppMobileLayoutProps extends PropsWithChildren {
39
32
  className?: string;
40
- navBar?: ReactNode;
41
33
  showTabBar?: boolean;
42
34
  style?: CSSProperties;
43
35
  tabBarKey?: SidebarTabKey;
@@ -45,17 +37,11 @@ interface AppMobileLayoutProps extends PropsWithChildren {
45
37
  }
46
38
 
47
39
  const AppLayoutMobile = memo<AppMobileLayoutProps>(
48
- ({ children, showTabBar, tabBarKey, navBar, style, className }) => {
40
+ ({ children, showTabBar, tabBarKey, style, className }) => {
49
41
  const { styles, cx } = useStyles();
50
42
 
51
43
  return (
52
44
  <Flexbox className={cx(styles.container, className)} style={style}>
53
- {navBar && (
54
- <>
55
- <div className={styles.mobileNavBar}>{navBar}</div>
56
- <SafeSpacing mobile position={'top'} />
57
- </>
58
- )}
59
45
  {children}
60
46
  {showTabBar && (
61
47
  <>
@@ -0,0 +1,25 @@
1
+ 'use client';
2
+
3
+ import { usePathname } from 'next/navigation';
4
+ import { PropsWithChildren, memo } from 'react';
5
+
6
+ import { useActiveTabKey } from '@/hooks/useActiveTabKey';
7
+ import { useIsSubSlug } from '@/hooks/useIsSubSlug';
8
+
9
+ import Layout from './Client';
10
+
11
+ const MobileLayout = memo<PropsWithChildren>(({ children }) => {
12
+ const pathname = usePathname();
13
+ const tabBarKey = useActiveTabKey();
14
+ const isSubPath = useIsSubSlug();
15
+
16
+ if (pathname === '/') return children;
17
+
18
+ return (
19
+ <Layout showTabBar={!isSubPath} tabBarKey={tabBarKey}>
20
+ {children}
21
+ </Layout>
22
+ );
23
+ });
24
+
25
+ export default MobileLayout;
@@ -0,0 +1,8 @@
1
+ import ServerLayout from '@/components/server/ServerLayout';
2
+
3
+ import Desktop from './Desktop';
4
+ import Mobile from './Mobile';
5
+
6
+ const GlobalLayout = ServerLayout({ Desktop, Mobile });
7
+
8
+ export default GlobalLayout;
@@ -31,9 +31,6 @@ beforeEach(() => {
31
31
  vi.clearAllMocks();
32
32
  useSessionStore.setState({
33
33
  refreshSessions: mockRefresh,
34
- router: {
35
- push: mockRouterPush,
36
- } as unknown as AppRouterInstance,
37
34
  });
38
35
  });
39
36
 
@@ -72,9 +69,6 @@ describe('SessionAction', () => {
72
69
  expect(call[1]).toMatchObject({ config: { displayMode: 'docs' } });
73
70
 
74
71
  expect(createdSessionId).toBe(newSessionId);
75
- expect(mockRouterPush).toHaveBeenCalledWith(
76
- SESSION_CHAT_URL(newSessionId, result.current.isMobile),
77
- );
78
72
  });
79
73
 
80
74
  it('should create a new session but not switch to it if isSwitchSession is false', async () => {
@@ -131,35 +125,6 @@ describe('SessionAction', () => {
131
125
  });
132
126
  });
133
127
 
134
- describe('switchSession', () => {
135
- it('should switch to the provided session id', async () => {
136
- const { result } = renderHook(() => useSessionStore());
137
- const sessionId = 'session-id';
138
-
139
- act(() => {
140
- result.current.switchSession(sessionId);
141
- });
142
-
143
- expect(result.current.activeId).toBe(sessionId);
144
- expect(mockRouterPush).toHaveBeenCalledWith(
145
- SESSION_CHAT_URL(sessionId, result.current.isMobile),
146
- );
147
- });
148
-
149
- it('should switch to the inbox session id if none is provided', async () => {
150
- const { result } = renderHook(() => useSessionStore());
151
-
152
- act(() => {
153
- result.current.switchSession();
154
- });
155
-
156
- expect(result.current.activeId).toBe(INBOX_SESSION_ID);
157
- expect(mockRouterPush).toHaveBeenCalledWith(
158
- SESSION_CHAT_URL(INBOX_SESSION_ID, result.current.isMobile),
159
- );
160
- });
161
- });
162
-
163
128
  describe('activeSession', () => {
164
129
  it('should set the provided session id as active', async () => {
165
130
  const { result } = renderHook(() => useSessionStore());
@@ -5,7 +5,6 @@ import { DeepPartial } from 'utility-types';
5
5
  import { StateCreator } from 'zustand/vanilla';
6
6
 
7
7
  import { INBOX_SESSION_ID } from '@/const/session';
8
- import { SESSION_CHAT_URL } from '@/const/url';
9
8
  import { useClientDataSWR } from '@/libs/swr';
10
9
  import { sessionService } from '@/services/session';
11
10
  import { useGlobalStore } from '@/store/global';
@@ -56,10 +55,6 @@ export interface SessionAction {
56
55
  * @param id - sessionId
57
56
  */
58
57
  removeSession: (id: string) => void;
59
- /**
60
- * switch session url
61
- */
62
- switchSession: (sessionId?: string) => void;
63
58
  /**
64
59
  * A custom hook that uses SWR to fetch sessions data.
65
60
  */
@@ -86,9 +81,9 @@ export const createSessionSlice: StateCreator<
86
81
  },
87
82
 
88
83
  createSession: async (agent, isSwitchSession = true) => {
89
- const { switchSession, refreshSessions } = get();
84
+ const { activeSession, refreshSessions } = get();
90
85
 
91
- // 合并 settings 里的 defaultAgent
86
+ // merge the defaultAgent in settings
92
87
  const defaultAgent = merge(
93
88
  initLobeSession,
94
89
  settingsSelectors.defaultAgent(useGlobalStore.getState()),
@@ -99,14 +94,14 @@ export const createSessionSlice: StateCreator<
99
94
  const id = await sessionService.createNewSession(LobeSessionType.Agent, newSession);
100
95
  await refreshSessions();
101
96
 
102
- // 创建后是否跳转到对应会话,默认跳转
103
- if (isSwitchSession) switchSession(id);
97
+ // Whether to goto to the new session after creation, the default is to switch to
98
+ if (isSwitchSession) activeSession(id);
104
99
 
105
100
  return id;
106
101
  },
107
102
 
108
103
  duplicateSession: async (id) => {
109
- const { switchSession, refreshSessions } = get();
104
+ const { activeSession, refreshSessions } = get();
110
105
  const session = sessionSelectors.getSessionById(id)(get());
111
106
 
112
107
  if (!session) return;
@@ -123,7 +118,7 @@ export const createSessionSlice: StateCreator<
123
118
  }
124
119
 
125
120
  await refreshSessions();
126
- switchSession(newId);
121
+ activeSession(newId);
127
122
  },
128
123
 
129
124
  pinSession: async (sessionId, pinned) => {
@@ -140,20 +135,12 @@ export const createSessionSlice: StateCreator<
140
135
  await sessionService.removeSession(sessionId);
141
136
  await get().refreshSessions();
142
137
 
138
+ // If the active session deleted, switch to the inbox session
143
139
  if (sessionId === get().activeId) {
144
- get().switchSession();
140
+ get().activeSession(INBOX_SESSION_ID);
145
141
  }
146
142
  },
147
143
 
148
- switchSession: (sessionId = INBOX_SESSION_ID) => {
149
- const { isMobile, router } = get();
150
-
151
- get().activeSession(sessionId);
152
-
153
- // TODO: 后续可以把 router 移除
154
- router?.push(SESSION_CHAT_URL(sessionId, isMobile));
155
- },
156
-
157
144
  useFetchSessions: () =>
158
145
  useClientDataSWR<ChatSessionList>(FETCH_SESSIONS_KEY, sessionService.getSessionsWithGroup, {
159
146
  onSuccess: (data) => {
@@ -1,5 +1,3 @@
1
- import { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime';
2
-
3
1
  import { DEFAULT_AGENT_META } from '@/const/meta';
4
2
  import { DEFAULT_AGENT_CONFIG } from '@/const/settings';
5
3
  import { CustomSessionGroup, LobeAgentSession, LobeSessionType } from '@/types/session';
@@ -25,11 +23,6 @@ export interface SessionState {
25
23
  isSearching: boolean;
26
24
  isSessionsFirstFetchFinished: boolean;
27
25
  pinnedSessions: LobeAgentSession[];
28
- /**
29
- * 后续看看是否可以将 router 部分的逻辑移出去
30
- * @deprecated
31
- */
32
- router?: AppRouterInstance;
33
26
  searchKeywords: string;
34
27
  searchSessions: LobeAgentSession[];
35
28
  /**
@@ -0,0 +1,7 @@
1
+ import { CSSProperties } from 'react';
2
+
3
+ export const mobileHeaderSticky: CSSProperties = {
4
+ position: 'sticky',
5
+ top: 0,
6
+ zIndex: 100,
7
+ };
@@ -1,18 +0,0 @@
1
- import { PropsWithChildren, memo } from 'react';
2
- import { Flexbox } from 'react-layout-kit';
3
-
4
- import SafeSpacing from '@/components/SafeSpacing';
5
- import { HEADER_HEIGHT } from '@/const/layoutTokens';
6
-
7
- import Layout from '../../(desktop)/layout.desktop';
8
- import Header from './features/Header';
9
-
10
- export default memo(({ children }: PropsWithChildren) => (
11
- <Layout>
12
- <Header />
13
- <Flexbox align={'center'} flex={1} gap={16} padding={24} style={{ overflow: 'scroll' }}>
14
- <SafeSpacing height={HEADER_HEIGHT - 16} />
15
- {children}
16
- </Flexbox>
17
- </Layout>
18
- ));
@@ -1,9 +0,0 @@
1
- import { PropsWithChildren, memo } from 'react';
2
-
3
- import AppLayoutMobile from '@/layout/AppLayout.mobile';
4
-
5
- import Header from './features/Header';
6
-
7
- export default memo(({ children }: PropsWithChildren) => (
8
- <AppLayoutMobile navBar={<Header />}>{children}</AppLayoutMobile>
9
- ));
@@ -1,65 +0,0 @@
1
- import { GridBackground } from '@lobehub/ui';
2
- import { createStyles } from 'antd-style';
3
- import dynamic from 'next/dynamic';
4
- import { PropsWithChildren, memo } from 'react';
5
- import { Center, Flexbox } from 'react-layout-kit';
6
-
7
- import SafeSpacing from '@/components/SafeSpacing';
8
- import { MAX_WIDTH } from '@/const/layoutTokens';
9
- import AppLayoutDesktop from '@/layout/AppLayout.desktop';
10
- import { SidebarTabKey } from '@/store/global/initialState';
11
-
12
- import Header from './features/Header';
13
-
14
- const SideBar = dynamic(() => import('./features/AgentDetail'));
15
-
16
- const useStyles = createStyles(({ css }) => ({
17
- background: css`
18
- width: 80%;
19
- margin: -60px 0 -20px;
20
- `,
21
- title: css`
22
- z-index: 2;
23
- margin-top: 24px;
24
- font-size: 56px;
25
- font-weight: 800;
26
- `,
27
- }));
28
-
29
- const MarketLayout = memo<PropsWithChildren>(({ children }) => {
30
- const { theme, styles } = useStyles();
31
-
32
- return (
33
- <AppLayoutDesktop sidebarKey={SidebarTabKey.Market}>
34
- <Flexbox
35
- flex={1}
36
- height={'100%'}
37
- id={'lobe-market-container'}
38
- style={{ position: 'relative' }}
39
- >
40
- <Header />
41
- <Flexbox flex={1} height={'calc(100% - 64px)'} horizontal>
42
- <Flexbox align={'center'} flex={1} style={{ overflow: 'scroll', padding: 16 }}>
43
- <SafeSpacing />
44
-
45
- <Flexbox gap={16} style={{ maxWidth: MAX_WIDTH, position: 'relative', width: '100%' }}>
46
- <Center>
47
- <h1 className={styles.title}>Find & Use The Best Agents</h1>
48
- <GridBackground
49
- animation
50
- className={styles.background}
51
- colorFront={theme.colorText}
52
- random
53
- />
54
- </Center>
55
- {children}
56
- </Flexbox>
57
- </Flexbox>
58
- <SideBar />
59
- </Flexbox>
60
- </Flexbox>
61
- </AppLayoutDesktop>
62
- );
63
- });
64
-
65
- export default MarketLayout;
@@ -1,10 +0,0 @@
1
- import { Logo, MobileNavBar } from '@lobehub/ui';
2
- import { memo } from 'react';
3
-
4
- import ShareAgentButton from '../../features/ShareAgentButton';
5
-
6
- const Header = memo(() => {
7
- return <MobileNavBar center={<Logo type={'text'} />} right={<ShareAgentButton mobile />} />;
8
- });
9
-
10
- export default Header;
@@ -1,25 +0,0 @@
1
- 'use client';
2
-
3
- import dynamic from 'next/dynamic';
4
- import { PropsWithChildren } from 'react';
5
- import { Flexbox } from 'react-layout-kit';
6
-
7
- import AppLayoutMobile from '@/layout/AppLayout.mobile';
8
- import { SidebarTabKey } from '@/store/global/initialState';
9
-
10
- import Header from './features/Header';
11
-
12
- const DetailModal = dynamic(() => import('./features/AgentDetail'));
13
-
14
- const MarketLayout = ({ children }: PropsWithChildren) => {
15
- return (
16
- <AppLayoutMobile navBar={<Header />} showTabBar tabBarKey={SidebarTabKey.Market}>
17
- <Flexbox flex={1} gap={16} style={{ padding: 16 }}>
18
- {children}
19
- </Flexbox>
20
- <DetailModal />
21
- </AppLayoutMobile>
22
- );
23
- };
24
-
25
- export default MarketLayout;
@@ -1,35 +0,0 @@
1
- 'use client';
2
-
3
- import { ReactNode, memo } from 'react';
4
- import { Center, Flexbox } from 'react-layout-kit';
5
-
6
- import SafeSpacing from '@/components/SafeSpacing';
7
- import AppLayoutDesktop from '@/layout/AppLayout.desktop';
8
- import { SettingsTabs, SidebarTabKey } from '@/store/global/initialState';
9
-
10
- import Header from './features/Header';
11
- import SideBar from './features/SideBar';
12
-
13
- export interface DesktopLayoutProps {
14
- activeTab: SettingsTabs;
15
- children: ReactNode;
16
- }
17
-
18
- const DesktopLayout = memo<DesktopLayoutProps>(({ children, activeTab }) => {
19
- return (
20
- <AppLayoutDesktop sidebarKey={SidebarTabKey.Setting}>
21
- <SideBar activeTab={activeTab} />
22
- <Flexbox flex={1} height={'100%'} style={{ position: 'relative' }}>
23
- <Header activeTab={activeTab} />
24
- <Flexbox align={'center'} flex={1} padding={24} style={{ overflow: 'scroll' }}>
25
- <SafeSpacing />
26
- <Center gap={16} width={'100%'}>
27
- {children}
28
- </Center>
29
- </Flexbox>
30
- </Flexbox>
31
- </AppLayoutDesktop>
32
- );
33
- });
34
-
35
- export default DesktopLayout;
@@ -1,21 +0,0 @@
1
- 'use client';
2
-
3
- import dynamic from 'next/dynamic';
4
- import { FC, memo } from 'react';
5
-
6
- import MobileSwitchLoading from '@/features/MobileSwitchLoading';
7
- // TODO: need to be removed
8
- import ResponsiveLayout from '@/layout/ServerResponsiveLayout/Client';
9
-
10
- import DesktopLayout, { DesktopLayoutProps } from './layout.desktop';
11
-
12
- const MobileLayout = dynamic(() => import('../(mobile)/layout.mobile'), {
13
- loading: MobileSwitchLoading,
14
- ssr: false,
15
- }) as FC;
16
-
17
- export default memo<DesktopLayoutProps>(({ children, activeTab }) => (
18
- <ResponsiveLayout Desktop={DesktopLayout} Mobile={MobileLayout} activeTab={activeTab}>
19
- {children}
20
- </ResponsiveLayout>
21
- ));
@@ -1,8 +0,0 @@
1
- import { Logo, MobileNavBar } from '@lobehub/ui';
2
- import { memo } from 'react';
3
-
4
- const Header = memo(() => {
5
- return <MobileNavBar center={<Logo type={'text'} />} />;
6
- });
7
-
8
- export default Header;
@@ -1,21 +0,0 @@
1
- 'use client';
2
-
3
- import { ReactNode, memo } from 'react';
4
- import { Flexbox } from 'react-layout-kit';
5
-
6
- import AppLayoutMobile from '@/layout/AppLayout.mobile';
7
- import { SettingsTabs, SidebarTabKey } from '@/store/global/initialState';
8
-
9
- import Header from './features/Header';
10
-
11
- export interface SettingLayoutProps {
12
- activeTab: SettingsTabs;
13
- children: ReactNode;
14
- }
15
- export default memo(({ children, activeTab }: SettingLayoutProps) => {
16
- return (
17
- <AppLayoutMobile navBar={<Header activeTab={activeTab} />} tabBarKey={SidebarTabKey.Setting}>
18
- <Flexbox style={{ overflow: 'scroll' }}>{children}</Flexbox>
19
- </AppLayoutMobile>
20
- );
21
- });
@@ -1,54 +0,0 @@
1
- 'use client';
2
-
3
- import { Divider } from 'antd';
4
- import { createStyles } from 'antd-style';
5
- import { memo } from 'react';
6
- import { Center } from 'react-layout-kit';
7
-
8
- import { CURRENT_VERSION } from '@/const/version';
9
- import AvatarWithUpload from '@/features/AvatarWithUpload';
10
- import { useGlobalStore } from '@/store/global';
11
- import { commonSelectors } from '@/store/global/selectors';
12
-
13
- import SettingList from '../../features/SettingList';
14
- import AvatarBanner from '../features/AvatarBanner';
15
- import ExtraList from '../features/ExtraList';
16
- import Layout from './layout.mobile';
17
-
18
- const useStyles = createStyles(({ css, token }) => ({
19
- divider: css`
20
- height: 6px;
21
- background: ${token.colorFillTertiary};
22
- `,
23
- footer: css`
24
- font-size: 12px;
25
- color: ${token.colorTextQuaternary};
26
- `,
27
- }));
28
-
29
- const Setting = memo(() => {
30
- const avatar = useGlobalStore(commonSelectors.userAvatar);
31
- const { styles } = useStyles();
32
-
33
- return (
34
- <Layout>
35
- <AvatarBanner avatar={avatar}>
36
- <Center style={{ position: 'absolute', zIndex: 2 }}>
37
- <AvatarWithUpload size={88} />
38
- </Center>
39
- </AvatarBanner>
40
- <div style={{ width: '100%' }}>
41
- <SettingList />
42
- <div className={styles.divider} />
43
- <ExtraList />
44
- <Center style={{ paddingInline: 64 }}>
45
- <Divider>
46
- <span className={styles.footer}>LobeChat v{CURRENT_VERSION}</span>
47
- </Divider>
48
- </Center>
49
- </div>
50
- </Layout>
51
- );
52
- });
53
-
54
- export default Setting;
@@ -1,14 +0,0 @@
1
- 'use client';
2
-
3
- import { PropsWithChildren, memo } from 'react';
4
- import { Flexbox } from 'react-layout-kit';
5
-
6
- import AppLayoutMobile from '@/layout/AppLayout.mobile';
7
-
8
- import Header from '../features/Header/Home';
9
-
10
- export default memo(({ children }: PropsWithChildren) => (
11
- <AppLayoutMobile navBar={<Header />} showTabBar>
12
- <Flexbox style={{ overflow: 'scroll' }}>{children}</Flexbox>
13
- </AppLayoutMobile>
14
- ));
@@ -1,9 +0,0 @@
1
- import { PropsWithChildren } from 'react';
2
-
3
- import { SettingsTabs } from '@/store/global/initialState';
4
-
5
- import SettingLayout from '../layout.server';
6
-
7
- export default ({ children }: PropsWithChildren) => {
8
- return <SettingLayout activeTab={SettingsTabs.About}>{children}</SettingLayout>;
9
- };
@@ -1,9 +0,0 @@
1
- import { PropsWithChildren } from 'react';
2
-
3
- import { SettingsTabs } from '@/store/global/initialState';
4
-
5
- import SettingLayout from '../layout.server';
6
-
7
- export default ({ children }: PropsWithChildren) => {
8
- return <SettingLayout activeTab={SettingsTabs.Agent}>{children}</SettingLayout>;
9
- };
@@ -1,9 +0,0 @@
1
- import { PropsWithChildren } from 'react';
2
-
3
- import { SettingsTabs } from '@/store/global/initialState';
4
-
5
- import SettingLayout from '../layout.server';
6
-
7
- export default ({ children }: PropsWithChildren) => {
8
- return <SettingLayout activeTab={SettingsTabs.Common}>{children}</SettingLayout>;
9
- };
@@ -1,19 +0,0 @@
1
- import { PropsWithChildren, ReactNode, memo } from 'react';
2
-
3
- import ResponsiveLayout from '@/layout/ServerResponsiveLayout';
4
- import { SettingsTabs } from '@/store/global/initialState';
5
-
6
- import DesktopLayout from './(desktop)/layout.responsive';
7
- import MobileLayout from './(mobile)/layout.mobile';
8
-
9
- export interface SettingLayoutProps {
10
- activeTab: SettingsTabs;
11
- children: ReactNode;
12
- }
13
- const SettingLayout = memo<SettingLayoutProps>(({ children, ...res }: PropsWithChildren) => (
14
- <ResponsiveLayout Desktop={DesktopLayout} Mobile={MobileLayout} {...res}>
15
- {children}
16
- </ResponsiveLayout>
17
- ));
18
-
19
- export default SettingLayout;
@@ -1,9 +0,0 @@
1
- import { PropsWithChildren } from 'react';
2
-
3
- import { SettingsTabs } from '@/store/global/initialState';
4
-
5
- import SettingLayout from '../layout.server';
6
-
7
- export default ({ children }: PropsWithChildren) => {
8
- return <SettingLayout activeTab={SettingsTabs.LLM}>{children}</SettingLayout>;
9
- };
@@ -1,9 +0,0 @@
1
- import { PropsWithChildren } from 'react';
2
-
3
- import { SettingsTabs } from '@/store/global/initialState';
4
-
5
- import SettingLayout from '../layout.server';
6
-
7
- export default ({ children }: PropsWithChildren) => {
8
- return <SettingLayout activeTab={SettingsTabs.Sync}>{children}</SettingLayout>;
9
- };