@lobehub/chat 0.57.0 → 0.58.0

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 (38) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/package.json +1 -1
  3. package/src/components/SafeSpacing/index.tsx +27 -0
  4. package/src/const/layoutTokens.ts +2 -0
  5. package/src/features/AvatarWithUpload/index.tsx +4 -3
  6. package/src/features/MobileTabBar/index.tsx +60 -0
  7. package/src/features/SideBar/TopActions.tsx +1 -1
  8. package/src/layout/AppMobileLayout.tsx +76 -0
  9. package/src/locales/default/common.ts +3 -1
  10. package/src/pages/chat/SessionList/Header.tsx +26 -2
  11. package/src/pages/chat/SessionList/index.tsx +10 -1
  12. package/src/pages/chat/[id]/index.page.tsx +19 -7
  13. package/src/pages/chat/[id]/mobile.tsx +31 -0
  14. package/src/pages/chat/[id]/setting/Header.tsx +25 -2
  15. package/src/pages/chat/[id]/setting/index.page.tsx +33 -16
  16. package/src/pages/chat/[id]/setting/mobile.tsx +11 -0
  17. package/src/pages/chat/features/Conversation/index.tsx +5 -5
  18. package/src/pages/chat/features/Header/Mobile.tsx +47 -0
  19. package/src/pages/chat/features/Header/PC.tsx +101 -0
  20. package/src/pages/chat/features/Header/index.tsx +7 -93
  21. package/src/pages/chat/features/Sidebar/Header.tsx +6 -4
  22. package/src/pages/chat/features/Sidebar/Mobile.tsx +36 -0
  23. package/src/pages/chat/features/Sidebar/SystemRole.tsx +2 -2
  24. package/src/pages/chat/features/Sidebar/index.tsx +33 -15
  25. package/src/pages/chat/index.page.tsx +14 -8
  26. package/src/pages/chat/layout.tsx +12 -8
  27. package/src/pages/chat/mobile.tsx +25 -0
  28. package/src/pages/settings/index.page.tsx +40 -8
  29. package/src/pages/settings/layout.tsx +5 -27
  30. package/src/pages/settings/mobile.tsx +20 -0
  31. package/src/pages/welcome/Banner/Hero.tsx +3 -5
  32. package/src/pages/welcome/Banner/index.tsx +5 -5
  33. package/src/pages/welcome/index.page.tsx +13 -4
  34. package/src/pages/welcome/mobile.tsx +20 -0
  35. package/src/pages/welcome/style.ts +2 -2
  36. package/src/store/global/initialState.ts +2 -0
  37. package/src/store/global/slices/common.ts +7 -0
  38. package/src/components/HeaderSpacing/index.tsx +0 -9
@@ -1,3 +1,4 @@
1
+ import { useResponsive } from 'antd-style';
1
2
  import Head from 'next/head';
2
3
  import { memo } from 'react';
3
4
  import { useTranslation } from 'react-i18next';
@@ -7,8 +8,10 @@ import { genSiteHeadTitle } from '@/utils/genSiteHeadTitle';
7
8
  import Banner from './Banner';
8
9
  import Footer from './Footer';
9
10
  import Layout from './layout';
11
+ import Mobile from './mobile';
10
12
 
11
13
  const Welcome = memo(() => {
14
+ const { mobile } = useResponsive();
12
15
  const { t } = useTranslation('welcome');
13
16
  const pageTitle = genSiteHeadTitle(t('header'));
14
17
 
@@ -17,10 +20,16 @@ const Welcome = memo(() => {
17
20
  <Head>
18
21
  <title>{pageTitle}</title>
19
22
  </Head>
20
- <Layout>
21
- <Banner />
22
- <Footer />
23
- </Layout>
23
+ {mobile ? (
24
+ <Mobile>
25
+ <Banner />
26
+ </Mobile>
27
+ ) : (
28
+ <Layout>
29
+ <Banner />
30
+ <Footer />
31
+ </Layout>
32
+ )}
24
33
  </>
25
34
  );
26
35
  });
@@ -0,0 +1,20 @@
1
+ import { Logo, MobileNavBar } from '@lobehub/ui';
2
+ import { useTheme } from 'antd-style';
3
+ import { PropsWithChildren, memo } from 'react';
4
+
5
+ import AppMobileLayout from '../../layout/AppMobileLayout';
6
+
7
+ const WelcomeLayout = memo<PropsWithChildren>(({ children }) => {
8
+ const theme = useTheme();
9
+ return (
10
+ <AppMobileLayout
11
+ navBar={<MobileNavBar center={<Logo type={'text'} />} />}
12
+ showTabBar
13
+ style={{ background: theme.colorBgContainer }}
14
+ >
15
+ {children}
16
+ </AppMobileLayout>
17
+ );
18
+ });
19
+
20
+ export default WelcomeLayout;
@@ -41,9 +41,9 @@ export const useStyles = createStyles(({ css, token, stylish, cx }) => {
41
41
  padding: 16px;
42
42
  `,
43
43
  title: css`
44
- margin-bottom: 0.2em;
44
+ margin-bottom: 0.25em;
45
45
  font-weight: 800;
46
- line-height: 1.2;
46
+ line-height: 1.4;
47
47
  text-align: center;
48
48
  `,
49
49
  view: cx(
@@ -25,6 +25,7 @@ export interface GlobalState {
25
25
  export interface GlobalPreference {
26
26
  guide?: Guide;
27
27
  inputHeight: number;
28
+ mobileShowTopic?: boolean;
28
29
  sessionsWidth: number;
29
30
  showChatSideBar?: boolean;
30
31
  showSessionPanel?: boolean;
@@ -34,6 +35,7 @@ export const initialState: GlobalState = {
34
35
  preference: {
35
36
  guide: {},
36
37
  inputHeight: 200,
38
+ mobileShowTopic: false,
37
39
  sessionsWidth: 320,
38
40
  showChatSideBar: true,
39
41
  showSessionPanel: true,
@@ -19,6 +19,7 @@ export interface CommonAction {
19
19
  */
20
20
  switchSideBar: (key: SidebarTabKey) => void;
21
21
  toggleChatSideBar: (visible?: boolean) => void;
22
+ toggleMobileTopic: (visible?: boolean) => void;
22
23
  updateGuideState: (guide: Partial<Guide>) => void;
23
24
  updatePreference: (preference: Partial<GlobalPreference>, action?: string) => void;
24
25
  }
@@ -38,6 +39,12 @@ export const createCommonSlice: StateCreator<
38
39
 
39
40
  get().updatePreference({ showChatSideBar }, t('toggleAgentPanel', newValue) as string);
40
41
  },
42
+ toggleMobileTopic: (newValue) => {
43
+ const mobileShowTopic =
44
+ typeof newValue === 'boolean' ? newValue : !get().preference.mobileShowTopic;
45
+
46
+ get().updatePreference({ mobileShowTopic }, t('toggleMobileTopic', newValue) as string);
47
+ },
41
48
  updateGuideState: (guide) => {
42
49
  const { updatePreference } = get();
43
50
  const nextGuide = merge({}, get().preference.guide, guide);
@@ -1,9 +0,0 @@
1
- import { memo } from 'react';
2
-
3
- import { HEADER_HEIGHT } from '@/const/layoutTokens';
4
-
5
- const HeaderSpacing = memo<{ height?: number }>(({ height = HEADER_HEIGHT }) => (
6
- <div style={{ flex: 'none', height }} />
7
- ));
8
-
9
- export default HeaderSpacing;