@lobehub/chat 0.142.3 → 0.142.4

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 (92) hide show
  1. package/CHANGELOG.md +17 -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 +4 -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/features/{ChatHeader/ShareButton → ShareButton}/Preview.tsx +1 -1
  13. package/src/app/chat/layout.ts +8 -0
  14. package/src/app/chat/page.tsx +2 -0
  15. package/src/app/chat/settings/(desktop)/index.tsx +13 -19
  16. package/src/app/chat/settings/(mobile)/{features/Header.tsx → Header.tsx} +4 -1
  17. package/src/app/chat/settings/(mobile)/index.tsx +4 -3
  18. package/src/app/layout.tsx +7 -12
  19. package/src/app/market/(desktop)/index.tsx +8 -16
  20. package/src/app/market/(mobile)/index.tsx +12 -7
  21. package/src/app/market/_layout/Desktop/index.tsx +59 -0
  22. package/src/app/market/_layout/Mobile/Header.tsx +20 -0
  23. package/src/app/market/_layout/Mobile/index.tsx +14 -0
  24. package/src/app/market/layout.ts +8 -0
  25. package/src/app/settings/(desktop)/index.tsx +8 -10
  26. package/src/app/settings/(mobile)/index.tsx +53 -1
  27. package/src/app/settings/{(desktop)/features → _layout/Desktop}/Header.tsx +8 -3
  28. package/src/app/settings/{(desktop)/features → _layout/Desktop}/SideBar.tsx +8 -3
  29. package/src/app/settings/_layout/Desktop/index.tsx +27 -0
  30. package/src/app/settings/{(mobile)/features/Header/index.tsx → _layout/Mobile/SubSettingHeader.tsx} +9 -8
  31. package/src/app/settings/_layout/Mobile/index.tsx +23 -0
  32. package/src/app/settings/layout.ts +8 -0
  33. package/src/app/settings/page.tsx +4 -2
  34. package/src/app/welcome/(desktop)/index.tsx +9 -17
  35. package/src/app/welcome/(mobile)/index.tsx +12 -6
  36. package/src/app/welcome/_layout/Desktop.tsx +29 -0
  37. package/src/app/welcome/_layout/Mobile.tsx +9 -0
  38. package/src/app/welcome/layout.ts +8 -0
  39. package/src/components/client/ClientResponsiveContent/index.tsx +32 -0
  40. package/src/components/client/ClientResponsiveLayout.tsx +32 -0
  41. package/src/components/server/ServerLayout.tsx +20 -0
  42. package/src/features/AvatarWithUpload/index.tsx +12 -9
  43. package/src/features/MobileSwitchLoading/index.tsx +2 -0
  44. package/src/hooks/useActiveSettingsKey.ts +16 -0
  45. package/src/hooks/useActiveTabKey.ts +12 -0
  46. package/src/hooks/useIsSubSlug.ts +12 -0
  47. package/src/layout/AuthProvider/index.tsx +16 -0
  48. package/src/layout/{AppLayout.desktop.tsx → GlobalLayout/Desktop/Client.tsx} +11 -9
  49. package/src/layout/GlobalLayout/Desktop/index.tsx +16 -0
  50. package/src/layout/{AppLayout.mobile.tsx → GlobalLayout/Mobile/Client.tsx} +2 -16
  51. package/src/layout/GlobalLayout/Mobile/index.tsx +25 -0
  52. package/src/layout/GlobalLayout/index.tsx +8 -0
  53. package/src/styles/mobileHeader.ts +7 -0
  54. package/src/app/chat/settings/(desktop)/layout.desktop.tsx +0 -18
  55. package/src/app/chat/settings/(mobile)/layout.mobile.tsx +0 -9
  56. package/src/app/market/(desktop)/layout.desktop.tsx +0 -65
  57. package/src/app/market/(mobile)/features/Header.tsx +0 -10
  58. package/src/app/market/(mobile)/layout.mobile.tsx +0 -25
  59. package/src/app/settings/(desktop)/layout.desktop.tsx +0 -35
  60. package/src/app/settings/(desktop)/layout.responsive.tsx +0 -21
  61. package/src/app/settings/(mobile)/features/Header/Home.tsx +0 -8
  62. package/src/app/settings/(mobile)/layout.mobile.tsx +0 -21
  63. package/src/app/settings/(mobile)/mobile/index.tsx +0 -54
  64. package/src/app/settings/(mobile)/mobile/layout.mobile.tsx +0 -14
  65. package/src/app/settings/about/layout.tsx +0 -9
  66. package/src/app/settings/agent/layout.tsx +0 -9
  67. package/src/app/settings/common/layout.tsx +0 -9
  68. package/src/app/settings/layout.server.tsx +0 -19
  69. package/src/app/settings/llm/layout.tsx +0 -9
  70. package/src/app/settings/sync/layout.tsx +0 -9
  71. package/src/app/settings/tts/layout.tsx +0 -9
  72. package/src/app/welcome/(desktop)/layout.desktop.tsx +0 -31
  73. package/src/app/welcome/(mobile)/features/Header.tsx +0 -6
  74. package/src/app/welcome/(mobile)/features/Showcase.tsx +0 -16
  75. package/src/app/welcome/(mobile)/layout.mobile.tsx +0 -20
  76. package/src/components/ResponsiveContainer/index.tsx +0 -20
  77. package/src/layout/ServerResponsiveLayout/Client.tsx +0 -23
  78. package/src/layout/ServerResponsiveLayout/index.tsx +0 -21
  79. /package/src/app/chat/(mobile)/{features → mobile/ChatHeader}/ChatHeaderTitle.tsx +0 -0
  80. /package/src/app/chat/{(desktop)/features → _layout/Desktop}/SessionHeader.tsx +0 -0
  81. /package/src/app/chat/features/{ChatHeader/SettingButton.tsx → SettingButton.tsx} +0 -0
  82. /package/src/app/chat/features/{ChatHeader/ShareButton → ShareButton}/ShareModal.tsx +0 -0
  83. /package/src/app/chat/features/{ChatHeader/ShareButton → ShareButton}/index.tsx +0 -0
  84. /package/src/app/chat/features/{ChatHeader/ShareButton → ShareButton}/style.ts +0 -0
  85. /package/src/app/chat/features/{ChatHeader/ShareButton → ShareButton}/type.ts +0 -0
  86. /package/src/app/chat/features/{ChatHeader/ShareButton → ShareButton}/useScreenshot.ts +0 -0
  87. /package/src/app/chat/settings/(desktop)/{features/Header.tsx → Header.tsx} +0 -0
  88. /package/src/app/market/{(desktop)/features → _layout/Desktop}/AgentDetail.tsx +0 -0
  89. /package/src/app/market/{(desktop)/features → _layout/Desktop}/Header.tsx +0 -0
  90. /package/src/{features → layout/GlobalLayout/Desktop}/SideBar/BottomActions.tsx +0 -0
  91. /package/src/{features → layout/GlobalLayout/Desktop}/SideBar/TopActions.tsx +0 -0
  92. /package/src/{features → layout/GlobalLayout/Desktop}/SideBar/index.tsx +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 0.142.4](https://github.com/lobehub/lobe-chat/compare/v0.142.3...v0.142.4)
6
+
7
+ <sup>Released on **2024-03-26**</sup>
8
+
9
+ <br/>
10
+
11
+ <details>
12
+ <summary><kbd>Improvements and Fixes</kbd></summary>
13
+
14
+ </details>
15
+
16
+ <div align="right">
17
+
18
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
19
+
20
+ </div>
21
+
5
22
  ### [Version 0.142.3](https://github.com/lobehub/lobe-chat/compare/v0.142.2...v0.142.3)
6
23
 
7
24
  <sup>Released on **2024-03-26**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.142.3",
3
+ "version": "0.142.4",
4
4
  "description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
5
5
  "keywords": [
6
6
  "framework",
@@ -6,8 +6,8 @@ import { useTranslation } from 'react-i18next';
6
6
  import { DESKTOP_HEADER_ICON_SIZE } from '@/const/layoutTokens';
7
7
  import { useGlobalStore } from '@/store/global';
8
8
 
9
- import SettingButton from '../../../features/ChatHeader/SettingButton';
10
- import ShareButton from '../../../features/ChatHeader/ShareButton';
9
+ import SettingButton from '../../../features/SettingButton';
10
+ import ShareButton from '../../../features/ShareButton';
11
11
 
12
12
  const HeaderAction = memo(() => {
13
13
  const { t } = useTranslation('chat');
@@ -1,33 +1,22 @@
1
1
  'use client';
2
2
 
3
- import dynamic from 'next/dynamic';
4
- import { FC, memo } from 'react';
3
+ import { memo } from 'react';
5
4
  import { Flexbox } from 'react-layout-kit';
6
5
 
7
- import ResponsiveContainer from '@/components/ResponsiveContainer';
8
- import MobileSwitchLoading from '@/features/MobileSwitchLoading';
6
+ import ClientResponsiveContent from '@/components/client/ClientResponsiveContent';
9
7
 
10
- import PageTitle from '../features/PageTitle';
11
8
  import ChatHeader from './features/ChatHeader';
12
9
  import Conversation from './features/Conversation';
13
10
  import SideBar from './features/SideBar';
14
- import Layout from './layout.desktop';
15
11
 
16
- const Mobile: FC = dynamic(() => import('../(mobile)'), {
17
- loading: MobileSwitchLoading,
18
- ssr: false,
19
- }) as FC;
20
-
21
- const DesktopPage = memo(() => (
22
- <ResponsiveContainer Mobile={Mobile}>
23
- <Layout>
24
- <PageTitle />
25
- <ChatHeader />
26
- <Flexbox flex={1} height={'calc(100% - 64px)'} horizontal>
27
- <Conversation />
28
- <SideBar />
29
- </Flexbox>
30
- </Layout>
31
- </ResponsiveContainer>
12
+ const Desktop = memo(() => (
13
+ <>
14
+ <ChatHeader />
15
+ <Flexbox flex={1} height={'calc(100% - 64px)'} horizontal>
16
+ <Conversation />
17
+ <SideBar />
18
+ </Flexbox>
19
+ </>
32
20
  ));
33
- export default DesktopPage;
21
+
22
+ export default ClientResponsiveContent({ Desktop, Mobile: () => import('../(mobile)') });
@@ -10,6 +10,7 @@ import SyncStatusInspector from '@/features/SyncStatusInspector';
10
10
  import { useGlobalStore } from '@/store/global';
11
11
  import { commonSelectors } from '@/store/global/selectors';
12
12
  import { useSessionStore } from '@/store/session';
13
+ import { mobileHeaderSticky } from '@/styles/mobileHeader';
13
14
 
14
15
  export const useStyles = createStyles(({ css, token }) => ({
15
16
  logo: css`
@@ -43,6 +44,7 @@ const Header = memo(() => {
43
44
  size={MOBILE_HEADER_ICON_SIZE}
44
45
  />
45
46
  }
47
+ style={mobileHeaderSticky}
46
48
  />
47
49
  );
48
50
  });
@@ -3,25 +3,22 @@
3
3
  import { useRouter } from 'next/navigation';
4
4
  import { memo, useEffect } from 'react';
5
5
 
6
- import AppLayoutMobile from '@/layout/AppLayout.mobile';
7
- import { SidebarTabKey } from '@/store/global/initialState';
8
-
9
- import PageTitle from '../features/PageTitle';
10
6
  import SessionHeader from './features/SessionHeader';
11
7
  import SessionList from './features/SessionList';
12
8
 
13
9
  const ChatMobilePage = memo(() => {
14
10
  const router = useRouter();
11
+
15
12
  useEffect(() => {
16
13
  router.prefetch('/chat/mobile');
17
14
  router.prefetch('/settings');
18
15
  }, []);
19
16
 
20
17
  return (
21
- <AppLayoutMobile navBar={<SessionHeader />} showTabBar tabBarKey={SidebarTabKey.Chat}>
22
- <PageTitle />
18
+ <>
19
+ <SessionHeader />
23
20
  <SessionList />
24
- </AppLayoutMobile>
21
+ </>
25
22
  );
26
23
  });
27
24
 
@@ -2,8 +2,8 @@ import { MobileNavBar } from '@lobehub/ui';
2
2
  import { useRouter } from 'next/navigation';
3
3
  import { memo, useState } from 'react';
4
4
 
5
- import SettingButton from '../../features/ChatHeader/SettingButton';
6
- import ShareButton from '../../features/ChatHeader/ShareButton';
5
+ import SettingButton from '../../../features/SettingButton';
6
+ import ShareButton from '../../../features/ShareButton';
7
7
  import ChatHeaderTitle from './ChatHeaderTitle';
8
8
 
9
9
  const MobileHeader = memo(() => {
@@ -4,13 +4,12 @@ import dynamic from 'next/dynamic';
4
4
  import { memo } from 'react';
5
5
  import { Flexbox } from 'react-layout-kit';
6
6
 
7
- import ChatHeader from '@/app/chat/(mobile)/features/ChatHeader';
8
7
  import Conversation from '@/features/Conversation';
9
- import AppLayoutMobile from '@/layout/AppLayout.mobile';
10
8
  import { useSessionStore } from '@/store/session';
11
9
 
12
10
  import TelemetryNotification from '../../features/TelemetryNotification';
13
11
  import ChatInput from '../features/ChatInput';
12
+ import ChatHeader from './ChatHeader';
14
13
 
15
14
  const TopicList = dynamic(() => import('../features/TopicList'));
16
15
 
@@ -21,13 +20,14 @@ const Chat = memo(() => {
21
20
  useFetchSessions();
22
21
 
23
22
  return (
24
- <AppLayoutMobile navBar={<ChatHeader />}>
23
+ <>
24
+ <ChatHeader />
25
25
  <Flexbox height={'calc(100% - 44px)'} horizontal>
26
26
  <Conversation chatInput={<ChatInput />} mobile />
27
27
  <TopicList />
28
28
  <TelemetryNotification mobile />
29
29
  </Flexbox>
30
- </AppLayoutMobile>
30
+ </>
31
31
  );
32
32
  });
33
33
  export default Chat;
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import { DraggablePanelBody } from '@lobehub/ui';
2
4
  import { createStyles } from 'antd-style';
3
5
  import { memo } from 'react';
@@ -3,14 +3,13 @@
3
3
  import { PropsWithChildren, memo } from 'react';
4
4
  import { Flexbox } from 'react-layout-kit';
5
5
 
6
- import AppLayoutDesktop from '@/layout/AppLayout.desktop';
7
- import { SidebarTabKey } from '@/store/global/initialState';
6
+ import ClientResponsiveLayout from '@/components/client/ClientResponsiveLayout';
8
7
 
9
- import ResponsiveSessionList from './features/SessionList';
8
+ import ResponsiveSessionList from './SessionList';
10
9
 
11
- export default memo(({ children }: PropsWithChildren) => {
10
+ const Desktop = memo(({ children }: PropsWithChildren) => {
12
11
  return (
13
- <AppLayoutDesktop sidebarKey={SidebarTabKey.Chat}>
12
+ <>
14
13
  <ResponsiveSessionList />
15
14
  <Flexbox
16
15
  flex={1}
@@ -20,6 +19,8 @@ export default memo(({ children }: PropsWithChildren) => {
20
19
  >
21
20
  {children}
22
21
  </Flexbox>
23
- </AppLayoutDesktop>
22
+ </>
24
23
  );
25
24
  });
25
+
26
+ export default ClientResponsiveLayout({ Desktop, Mobile: () => import('../Mobile') });
@@ -0,0 +1,7 @@
1
+ import { PropsWithChildren } from 'react';
2
+
3
+ const MobileLayout = ({ children }: PropsWithChildren) => {
4
+ return children;
5
+ };
6
+
7
+ export default MobileLayout;
@@ -9,7 +9,7 @@ import ChatList from '@/features/Conversation/components/ChatList';
9
9
  import { useSessionStore } from '@/store/session';
10
10
  import { agentSelectors, sessionSelectors } from '@/store/session/selectors';
11
11
 
12
- import PluginTag from '../../PluginTag';
12
+ import PluginTag from '../PluginTag';
13
13
  import { useStyles } from './style';
14
14
  import { FieldType } from './type';
15
15
 
@@ -0,0 +1,8 @@
1
+ import ServerLayout from '@/components/server/ServerLayout';
2
+
3
+ import Desktop from './_layout/Desktop';
4
+ import Mobile from './_layout/Mobile';
5
+
6
+ const ChatLayout = ServerLayout({ Desktop, Mobile });
7
+
8
+ export default ChatLayout;
@@ -4,6 +4,7 @@ import DesktopPage from './(desktop)';
4
4
  import MobilePage from './(mobile)';
5
5
  import SessionHydration from './components/SessionHydration';
6
6
  import Migration from './features/Migration';
7
+ import PageTitle from './features/PageTitle';
7
8
 
8
9
  const Page = () => {
9
10
  const mobile = isMobileDevice();
@@ -13,6 +14,7 @@ const Page = () => {
13
14
  return (
14
15
  <>
15
16
  <Migration>
17
+ <PageTitle />
16
18
  <Page />
17
19
  </Migration>
18
20
  <SessionHydration />
@@ -1,29 +1,23 @@
1
1
  'use client';
2
2
 
3
- import dynamic from 'next/dynamic';
4
- import { FC, memo } from 'react';
3
+ import { memo } from 'react';
4
+ import { Flexbox } from 'react-layout-kit';
5
5
 
6
- import SessionHydration from '@/app/chat/components/SessionHydration';
7
- import ResponsiveContainer from '@/components/ResponsiveContainer';
8
- import MobileSwitchLoading from '@/features/MobileSwitchLoading';
6
+ import SafeSpacing from '@/components/SafeSpacing';
7
+ import ClientResponsiveContent from '@/components/client/ClientResponsiveContent';
8
+ import { HEADER_HEIGHT } from '@/const/layoutTokens';
9
9
 
10
10
  import EditPage from '../features/EditPage';
11
- import Layout from './layout.desktop';
11
+ import Header from './Header';
12
12
 
13
- const Mobile: FC = dynamic(() => import('../(mobile)'), {
14
- loading: MobileSwitchLoading,
15
- ssr: false,
16
- }) as FC;
17
-
18
- const ChatSettings = memo(() => (
13
+ const Desktop = memo(() => (
19
14
  <>
20
- <ResponsiveContainer Mobile={Mobile}>
21
- <Layout>
22
- <EditPage />
23
- </Layout>
24
- </ResponsiveContainer>
25
- <SessionHydration />
15
+ <Header />
16
+ <Flexbox align={'center'} flex={1} gap={16} padding={24} style={{ overflow: 'scroll' }}>
17
+ <SafeSpacing height={HEADER_HEIGHT - 16} />
18
+ <EditPage />
19
+ </Flexbox>
26
20
  </>
27
21
  ));
28
22
 
29
- export default ChatSettings;
23
+ export default ClientResponsiveContent({ Desktop, Mobile: () => import('../(mobile)') });
@@ -3,9 +3,11 @@ import { useRouter } from 'next/navigation';
3
3
  import { memo } from 'react';
4
4
  import { useTranslation } from 'react-i18next';
5
5
 
6
- import HeaderContent from '@/app/chat/settings/features/HeaderContent';
6
+ import { mobileHeaderSticky } from '@/styles/mobileHeader';
7
7
  import { pathString } from '@/utils/url';
8
8
 
9
+ import HeaderContent from '../features/HeaderContent';
10
+
9
11
  const Header = memo(() => {
10
12
  const { t } = useTranslation('setting');
11
13
  const router = useRouter();
@@ -16,6 +18,7 @@ const Header = memo(() => {
16
18
  onBackClick={() => router.push(pathString('/chat/mobile', { search: location.search }))}
17
19
  right={<HeaderContent />}
18
20
  showBackButton
21
+ style={mobileHeaderSticky}
19
22
  />
20
23
  );
21
24
  });
@@ -3,12 +3,13 @@
3
3
  import { memo } from 'react';
4
4
 
5
5
  import EditPage from '../features/EditPage';
6
- import Layout from './layout.mobile';
6
+ import Header from './Header';
7
7
 
8
8
  const ChatSettings = memo(() => (
9
- <Layout>
9
+ <>
10
+ <Header />
10
11
  <EditPage />
11
- </Layout>
12
+ </>
12
13
  ));
13
14
 
14
15
  export default ChatSettings;
@@ -1,35 +1,30 @@
1
1
  import { SpeedInsights } from '@vercel/speed-insights/next';
2
2
  import { ResolvingViewport } from 'next';
3
- import { SessionProvider } from 'next-auth/react';
4
3
  import { cookies } from 'next/headers';
5
4
  import { PropsWithChildren } from 'react';
6
5
  import { isRtlLang } from 'rtl-detect';
7
6
 
8
7
  import Analytics from '@/components/Analytics';
9
- import { getServerConfig } from '@/config/server';
10
8
  import { DEFAULT_LANG, LOBE_LOCALE_COOKIE } from '@/const/locale';
9
+ import AuthProvider from '@/layout/AuthProvider';
10
+ import GlobalLayout from '@/layout/GlobalLayout';
11
11
  import GlobalProvider from '@/layout/GlobalProvider';
12
- import { API_ENDPOINTS } from '@/services/_url';
13
12
  import { isMobileDevice } from '@/utils/responsive';
14
13
 
15
- const { ENABLE_OAUTH_SSO = false } = getServerConfig();
16
-
17
14
  const RootLayout = async ({ children }: PropsWithChildren) => {
18
15
  const cookieStore = cookies();
19
16
 
20
17
  const lang = cookieStore.get(LOBE_LOCALE_COOKIE);
21
18
  const direction = isRtlLang(lang?.value || DEFAULT_LANG) ? 'rtl' : 'ltr';
22
19
 
23
- const content = ENABLE_OAUTH_SSO ? (
24
- <SessionProvider basePath={API_ENDPOINTS.oauth}>{children}</SessionProvider>
25
- ) : (
26
- children
27
- );
28
-
29
20
  return (
30
21
  <html dir={direction} lang={lang?.value || DEFAULT_LANG} suppressHydrationWarning>
31
22
  <body>
32
- <GlobalProvider>{content}</GlobalProvider>
23
+ <GlobalProvider>
24
+ <AuthProvider>
25
+ <GlobalLayout>{children}</GlobalLayout>
26
+ </AuthProvider>
27
+ </GlobalProvider>
33
28
  <Analytics />
34
29
  <SpeedInsights />
35
30
  </body>
@@ -1,26 +1,18 @@
1
1
  'use client';
2
2
 
3
3
  import { SpotlightCard, SpotlightCardProps } from '@lobehub/ui';
4
- import dynamic from 'next/dynamic';
5
4
  import { FC, memo } from 'react';
6
5
 
7
- import ResponsiveContainer from '@/components/ResponsiveContainer';
8
- import MobileSwitchLoading from '@/features/MobileSwitchLoading';
6
+ import ClientResponsiveContent from '@/components/client/ClientResponsiveContent';
9
7
 
10
8
  import AgentCard from '../features/AgentCard';
11
9
  import Index from '../index';
12
- import Layout from './layout.desktop';
13
10
 
14
- const Mobile: FC = dynamic(() => import('../(mobile)'), {
15
- loading: MobileSwitchLoading,
16
- ssr: false,
17
- }) as FC;
18
-
19
- export default memo(() => (
20
- <ResponsiveContainer Mobile={Mobile}>
21
- <Layout>
22
- <Index />
23
- <AgentCard CardRender={SpotlightCard as FC<SpotlightCardProps>} />
24
- </Layout>
25
- </ResponsiveContainer>
11
+ const Desktop = memo(() => (
12
+ <>
13
+ <Index />
14
+ <AgentCard CardRender={SpotlightCard as FC<SpotlightCardProps>} />
15
+ </>
26
16
  ));
17
+
18
+ export default ClientResponsiveContent({ Desktop, Mobile: () => import('../(mobile)') });
@@ -1,16 +1,21 @@
1
1
  'use client';
2
2
 
3
+ import dynamic from 'next/dynamic';
3
4
  import { memo } from 'react';
5
+ import { Flexbox } from 'react-layout-kit';
4
6
 
5
- import AgentCard from '@/app/market/features/AgentCard';
6
-
7
+ import AgentCard from '../features/AgentCard';
7
8
  import Index from '../index';
8
9
  import CardRender from './features/AgentCard';
9
- import Layout from './layout.mobile';
10
+
11
+ const DetailModal = dynamic(() => import('./features/AgentDetail'), { ssr: false });
10
12
 
11
13
  export default memo(() => (
12
- <Layout>
13
- <Index />
14
- <AgentCard CardRender={CardRender} mobile />
15
- </Layout>
14
+ <>
15
+ <Flexbox flex={1} gap={16} style={{ padding: 16 }}>
16
+ <Index />
17
+ <AgentCard CardRender={CardRender} mobile />{' '}
18
+ </Flexbox>
19
+ <DetailModal />
20
+ </>
16
21
  ));
@@ -0,0 +1,59 @@
1
+ 'use client';
2
+
3
+ import { GridBackground } from '@lobehub/ui';
4
+ import { createStyles } from 'antd-style';
5
+ import dynamic from 'next/dynamic';
6
+ import { PropsWithChildren, memo } from 'react';
7
+ import { Center, Flexbox } from 'react-layout-kit';
8
+
9
+ import SafeSpacing from '@/components/SafeSpacing';
10
+ import ClientResponsiveLayout from '@/components/client/ClientResponsiveLayout';
11
+ import { MAX_WIDTH } from '@/const/layoutTokens';
12
+
13
+ import Header from './Header';
14
+
15
+ const SideBar = dynamic(() => import('./AgentDetail'));
16
+
17
+ const useStyles = createStyles(({ css }) => ({
18
+ background: css`
19
+ width: 80%;
20
+ margin: -60px 0 -20px;
21
+ `,
22
+ title: css`
23
+ z-index: 2;
24
+ margin-top: 24px;
25
+ font-size: 56px;
26
+ font-weight: 800;
27
+ `,
28
+ }));
29
+
30
+ const Desktop = memo<PropsWithChildren>(({ children }) => {
31
+ const { theme, styles } = useStyles();
32
+
33
+ return (
34
+ <Flexbox flex={1} height={'100%'} id={'lobe-market-container'} style={{ position: 'relative' }}>
35
+ <Header />
36
+ <Flexbox flex={1} height={'calc(100% - 64px)'} horizontal>
37
+ <Flexbox align={'center'} flex={1} style={{ overflow: 'scroll', padding: 16 }}>
38
+ <SafeSpacing />
39
+
40
+ <Flexbox gap={16} style={{ maxWidth: MAX_WIDTH, position: 'relative', width: '100%' }}>
41
+ <Center>
42
+ <h1 className={styles.title}>Find & Use The Best Agents</h1>
43
+ <GridBackground
44
+ animation
45
+ className={styles.background}
46
+ colorFront={theme.colorText}
47
+ random
48
+ />
49
+ </Center>
50
+ {children}
51
+ </Flexbox>
52
+ </Flexbox>
53
+ <SideBar />
54
+ </Flexbox>
55
+ </Flexbox>
56
+ );
57
+ });
58
+
59
+ export default ClientResponsiveLayout({ Desktop, Mobile: () => import('../Mobile') });
@@ -0,0 +1,20 @@
1
+ 'use client';
2
+
3
+ import { Logo, MobileNavBar } from '@lobehub/ui';
4
+ import { memo } from 'react';
5
+
6
+ import { mobileHeaderSticky } from '@/styles/mobileHeader';
7
+
8
+ import ShareAgentButton from '../../features/ShareAgentButton';
9
+
10
+ const Header = memo(() => {
11
+ return (
12
+ <MobileNavBar
13
+ center={<Logo type={'text'} />}
14
+ right={<ShareAgentButton mobile />}
15
+ style={mobileHeaderSticky}
16
+ />
17
+ );
18
+ });
19
+
20
+ export default Header;
@@ -0,0 +1,14 @@
1
+ import { PropsWithChildren } from 'react';
2
+
3
+ import Header from './Header';
4
+
5
+ const MobileLayout = ({ children }: PropsWithChildren) => {
6
+ return (
7
+ <>
8
+ <Header />
9
+ {children}
10
+ </>
11
+ );
12
+ };
13
+
14
+ export default MobileLayout;
@@ -0,0 +1,8 @@
1
+ import ServerLayout from '@/components/server/ServerLayout';
2
+
3
+ import Desktop from './_layout/Desktop';
4
+ import Mobile from './_layout/Mobile';
5
+
6
+ const MarketLayout = ServerLayout({ Desktop, Mobile });
7
+
8
+ export default MarketLayout;
@@ -3,23 +3,21 @@
3
3
  import dynamic from 'next/dynamic';
4
4
  import { FC, memo } from 'react';
5
5
 
6
- import ResponsiveContainer from '@/components/ResponsiveContainer';
7
6
  import MobileSwitchLoading from '@/features/MobileSwitchLoading';
8
- import { SettingsTabs } from '@/store/global/initialState';
7
+ import { useIsMobile } from '@/hooks/useIsMobile';
9
8
 
10
9
  import Common from '../common';
11
10
  import { SettingsCommonProps } from '../common/Common';
12
- import DesktopLayout from './layout.desktop';
13
11
 
14
12
  const Mobile: FC = dynamic(() => import('../(mobile)'), {
15
13
  loading: MobileSwitchLoading,
16
14
  ssr: false,
17
15
  }) as FC;
18
16
 
19
- export default memo<SettingsCommonProps>((props) => (
20
- <ResponsiveContainer Mobile={Mobile}>
21
- <DesktopLayout activeTab={SettingsTabs.Common}>
22
- <Common {...props} />
23
- </DesktopLayout>
24
- </ResponsiveContainer>
25
- ));
17
+ const Desktop = memo<SettingsCommonProps>((props) => {
18
+ const mobile = useIsMobile();
19
+
20
+ return mobile ? <Mobile /> : <Common {...props} />;
21
+ });
22
+
23
+ export default Desktop;
@@ -1 +1,53 @@
1
- export { default } from './mobile';
1
+ 'use client';
2
+
3
+ import { Divider } from 'antd';
4
+ import { createStyles } from 'antd-style';
5
+ import { memo } from 'react';
6
+ import { Center, Flexbox } 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
+
17
+ const useStyles = createStyles(({ css, token }) => ({
18
+ divider: css`
19
+ height: 6px;
20
+ background: ${token.colorFillTertiary};
21
+ `,
22
+ footer: css`
23
+ font-size: 12px;
24
+ color: ${token.colorTextQuaternary};
25
+ `,
26
+ }));
27
+
28
+ const Setting = memo(() => {
29
+ const avatar = useGlobalStore(commonSelectors.userAvatar);
30
+ const { styles } = useStyles();
31
+
32
+ return (
33
+ <Flexbox style={{ overflow: 'scroll' }}>
34
+ <AvatarBanner avatar={avatar}>
35
+ <Center style={{ marginTop: 32, position: 'absolute', zIndex: 2 }}>
36
+ <AvatarWithUpload size={88} />
37
+ </Center>
38
+ </AvatarBanner>
39
+ <div style={{ width: '100%' }}>
40
+ <SettingList />
41
+ <div className={styles.divider} />
42
+ <ExtraList />
43
+ <Center style={{ paddingInline: 64 }}>
44
+ <Divider>
45
+ <span className={styles.footer}>LobeChat v{CURRENT_VERSION}</span>
46
+ </Divider>
47
+ </Center>
48
+ </div>
49
+ </Flexbox>
50
+ );
51
+ });
52
+
53
+ export default Setting;