@lobehub/lobehub 2.0.0-next.162 → 2.0.0-next.163

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## [Version 2.0.0-next.163](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.162...v2.0.0-next.163)
6
+
7
+ <sup>Released on **2025-12-06**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Add smooth scroll to top on 'More' button click in Title component.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Add smooth scroll to top on 'More' button click in Title component, closes [#10178](https://github.com/lobehub/lobe-chat/issues/10178) ([5ad4f0c](https://github.com/lobehub/lobe-chat/commit/5ad4f0c))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
5
30
  ## [Version 2.0.0-next.162](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.161...v2.0.0-next.162)
6
31
 
7
32
  <sup>Released on **2025-12-05**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,13 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "fixes": [
5
+ "Add smooth scroll to top on 'More' button click in Title component."
6
+ ]
7
+ },
8
+ "date": "2025-12-06",
9
+ "version": "2.0.0-next.163"
10
+ },
2
11
  {
3
12
  "children": {},
4
13
  "date": "2025-12-05",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/lobehub",
3
- "version": "2.0.0-next.162",
3
+ "version": "2.0.0-next.163",
4
4
  "description": "LobeHub - an open-source,comprehensive AI Agent 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",
@@ -13,6 +13,15 @@ import { DiscoverTab } from '@/types/discover';
13
13
 
14
14
  import { useNav } from '../../../features/useNav';
15
15
 
16
+ const SCROLL_CONTAINER_ID = 'lobe-mobile-scroll-container';
17
+
18
+ const scrollToTop = () => {
19
+ const scrollableElement = document?.querySelector(`#${SCROLL_CONTAINER_ID}`);
20
+
21
+ if (!scrollableElement) return;
22
+ scrollableElement.scrollTo({ behavior: 'smooth', top: 0 });
23
+ };
24
+
16
25
  export const useStyles = createStyles(({ css, token }) => ({
17
26
  activeNavItem: css`
18
27
  background: ${token.colorFillTertiary};
@@ -44,7 +53,9 @@ const Nav = memo(() => {
44
53
  <ActionIcon
45
54
  color={theme.colorText}
46
55
  icon={MenuIcon}
47
- onClick={() => setOpen(true)}
56
+ onClick={() => {
57
+ setOpen(true);
58
+ }}
48
59
  size={{ blockSize: 32, size: 18 }}
49
60
  />
50
61
  {activeItem?.label}
@@ -76,6 +87,7 @@ const Nav = memo(() => {
76
87
  compact
77
88
  items={items}
78
89
  onClick={({ key }) => {
90
+ scrollToTop();
79
91
  if (key === DiscoverTab.Home) {
80
92
  navigate('/discover');
81
93
  } else {
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { Pagination as Page } from 'antd';
4
- import { createStyles } from 'antd-style';
4
+ import { createStyles, useResponsive } from 'antd-style';
5
5
  import { memo } from 'react';
6
6
  import { useLocation, useNavigate } from 'react-router-dom';
7
7
 
@@ -9,6 +9,8 @@ import { SCROLL_PARENT_ID } from '@/app/[variants]/(main)/discover/features/cons
9
9
  import { useQuery } from '@/hooks/useQuery';
10
10
  import { DiscoverTab } from '@/types/discover';
11
11
 
12
+ const SCROLL_CONTAINER_ID = 'lobe-mobile-scroll-container';
13
+
12
14
  const useStyles = createStyles(({ css, token, prefixCls }) => {
13
15
  return {
14
16
  page: css`
@@ -37,13 +39,15 @@ const Pagination = memo<PaginationProps>(({ tab, currentPage, total, pageSize })
37
39
  const { page } = useQuery();
38
40
  const navigate = useNavigate();
39
41
  const location = useLocation();
42
+ const { mobile } = useResponsive();
40
43
 
41
44
  const handlePageChange = (newPage: number) => {
42
45
  const searchParams = new URLSearchParams(location.search);
43
46
  searchParams.set('page', String(newPage));
44
47
  navigate(`/discover/${tab}?${searchParams.toString()}`);
45
48
 
46
- const scrollableElement = document?.querySelector(`#${SCROLL_PARENT_ID}`);
49
+ const scrollContainerId = mobile ? SCROLL_CONTAINER_ID : SCROLL_PARENT_ID;
50
+ const scrollableElement = document?.querySelector(`#${scrollContainerId}`);
47
51
  if (!scrollableElement) return;
48
52
  scrollableElement.scrollTo({ behavior: 'smooth', top: 0 });
49
53
  };
@@ -1,12 +1,16 @@
1
1
  'use client';
2
2
 
3
3
  import { Button, Icon, Tag } from '@lobehub/ui';
4
- import { createStyles } from 'antd-style';
4
+ import { createStyles, useResponsive } from 'antd-style';
5
5
  import { ChevronRight } from 'lucide-react';
6
6
  import { ReactNode, memo } from 'react';
7
7
  import { Flexbox, FlexboxProps } from 'react-layout-kit';
8
8
  import { Link } from 'react-router-dom';
9
9
 
10
+ import { SCROLL_PARENT_ID } from '../features/const';
11
+
12
+ const SCROLL_CONTAINER_ID = 'lobe-mobile-scroll-container';
13
+
10
14
  const useStyles = createStyles(({ css, responsive, token }) => ({
11
15
  more: css`
12
16
  display: flex;
@@ -47,7 +51,19 @@ interface TitleProps extends FlexboxProps {
47
51
 
48
52
  const Title = memo<TitleProps>(({ tag, children, moreLink, more }) => {
49
53
  const { styles } = useStyles();
54
+ const { mobile } = useResponsive();
50
55
  const title = <h2 className={styles.title}>{children}</h2>;
56
+
57
+ const handleMoreClick = () => {
58
+ if (!moreLink) return;
59
+
60
+ const scrollContainerId = mobile ? SCROLL_CONTAINER_ID : SCROLL_PARENT_ID;
61
+ const scrollableElement = document?.querySelector(`#${scrollContainerId}`);
62
+
63
+ if (!scrollableElement) return;
64
+ scrollableElement.scrollTo({ behavior: 'smooth', top: 0 });
65
+ };
66
+
51
67
  return (
52
68
  <Flexbox align={'center'} gap={16} horizontal justify={'space-between'} width={'100%'}>
53
69
  {tag ? (
@@ -59,7 +75,11 @@ const Title = memo<TitleProps>(({ tag, children, moreLink, more }) => {
59
75
  title
60
76
  )}
61
77
  {moreLink && (
62
- <Link target={moreLink.startsWith('http') ? '_blank' : undefined} to={`/discover${moreLink}`}>
78
+ <Link
79
+ onClick={handleMoreClick}
80
+ target={moreLink.startsWith('http') ? '_blank' : undefined}
81
+ to={moreLink}
82
+ >
63
83
  <Button className={styles.more} style={{ paddingInline: 6 }} type={'text'}>
64
84
  <span>{more}</span>
65
85
  <Icon icon={ChevronRight} />