mirror of
https://github.com/labring/FastGPT.git
synced 2026-02-27 01:02:22 +08:00
fix(document): improve mobile sidebar style and UX (#6464)
* fix(document): improve mobile sidebar style and UX - Add icons to 6 navigation tabs (BookOpen, Code, Lightbulb, CircleHelp, Scale, History) - Reduce mobile sidebar padding and separator spacing - Fix icon container size in RootToggle dropdown (36px → 20px) - Keep sidebar open when switching between top-level tabs - Remove top gradient mask on mobile sidebar viewport - Fix long URL overflow in article content on mobile - Fix TOC popover trigger text overflow on mobile * docs: 中国大陆 → 中国大陆版 * docs: 海外版→国际版, 国内版→中国大陆版 --------- Co-authored-by: archer <archer@archerdeMac-mini.local>
This commit is contained in:
@@ -7,10 +7,12 @@ import LogoLight from '@/components/docs/logo';
|
|||||||
import LogoDark from '@/components/docs/logoDark';
|
import LogoDark from '@/components/docs/logoDark';
|
||||||
import '@/app/global.css';
|
import '@/app/global.css';
|
||||||
import { CustomSidebarComponents } from '@/components/sideBar';
|
import { CustomSidebarComponents } from '@/components/sideBar';
|
||||||
|
import { SidebarKeepOpen } from '@/components/sidebarKeepOpen';
|
||||||
import FeishuLogoLight from '@/components/docs/feishuLogoLIght';
|
import FeishuLogoLight from '@/components/docs/feishuLogoLIght';
|
||||||
import FeishuLogoDark from '@/components/docs/feishuLogoDark';
|
import FeishuLogoDark from '@/components/docs/feishuLogoDark';
|
||||||
import GithubLogoLight from '@/components/docs/githubLogoLight';
|
import GithubLogoLight from '@/components/docs/githubLogoLight';
|
||||||
import GithubLogoDark from '@/components/docs/githubLogoDark';
|
import GithubLogoDark from '@/components/docs/githubLogoDark';
|
||||||
|
import { BookOpen, Code, Lightbulb, CircleHelp, Scale, History } from 'lucide-react';
|
||||||
|
|
||||||
export default async function Layout({
|
export default async function Layout({
|
||||||
params,
|
params,
|
||||||
@@ -21,33 +23,42 @@ export default async function Layout({
|
|||||||
}) {
|
}) {
|
||||||
const { lang } = await params;
|
const { lang } = await params;
|
||||||
|
|
||||||
|
const iconClass = 'size-4';
|
||||||
const tab = [
|
const tab = [
|
||||||
{
|
{
|
||||||
|
icon: <BookOpen className={iconClass} />,
|
||||||
title: t('common:introduction', lang),
|
title: t('common:introduction', lang),
|
||||||
url: lang === 'zh-CN' ? '/docs/introduction' : '/en/docs/introduction'
|
url: lang === 'zh-CN' ? '/docs/introduction' : '/en/docs/introduction'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
icon: <Code className={iconClass} />,
|
||||||
title: t('common:api_reference', lang),
|
title: t('common:api_reference', lang),
|
||||||
url: lang === 'zh-CN' ? '/docs/openapi' : '/en/docs/openapi'
|
url: lang === 'zh-CN' ? '/docs/openapi' : '/en/docs/openapi'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
icon: <Lightbulb className={iconClass} />,
|
||||||
title: t('common:use-cases', lang),
|
title: t('common:use-cases', lang),
|
||||||
url: lang === 'zh-CN' ? '/docs/use-cases' : '/en/docs/use-cases'
|
url: lang === 'zh-CN' ? '/docs/use-cases' : '/en/docs/use-cases'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
icon: <CircleHelp className={iconClass} />,
|
||||||
title: t('common:faq', lang),
|
title: t('common:faq', lang),
|
||||||
url: lang === 'zh-CN' ? '/docs/faq' : '/en/docs/faq'
|
url: lang === 'zh-CN' ? '/docs/faq' : '/en/docs/faq'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
icon: <Scale className={iconClass} />,
|
||||||
title: t('common:protocol', lang),
|
title: t('common:protocol', lang),
|
||||||
url: lang === 'zh-CN' ? '/docs/protocol' : '/en/docs/protocol'
|
url: lang === 'zh-CN' ? '/docs/protocol' : '/en/docs/protocol'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
icon: <History className={iconClass} />,
|
||||||
title: t('common:upgrading', lang),
|
title: t('common:upgrading', lang),
|
||||||
url: lang === 'zh-CN' ? '/docs/upgrading' : '/en/docs/upgrading'
|
url: lang === 'zh-CN' ? '/docs/upgrading' : '/en/docs/upgrading'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const tabUrls = tab.map((t) => t.url);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DocsLayout
|
<DocsLayout
|
||||||
{...baseOptions(lang)}
|
{...baseOptions(lang)}
|
||||||
@@ -107,6 +118,7 @@ export default async function Layout({
|
|||||||
}}
|
}}
|
||||||
tabMode="navbar"
|
tabMode="navbar"
|
||||||
>
|
>
|
||||||
|
<SidebarKeepOpen tabUrls={tabUrls} />
|
||||||
{children}
|
{children}
|
||||||
</DocsLayout>
|
</DocsLayout>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -475,3 +475,65 @@ button[role='tab'] {
|
|||||||
padding-top: 16px;
|
padding-top: 16px;
|
||||||
padding-bottom: 16px;
|
padding-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 移动端侧边栏 padding 缩小 */
|
||||||
|
@media (max-width: 767px) {
|
||||||
|
#nd-sidebar-mobile [data-radix-scroll-area-viewport] {
|
||||||
|
padding-left: 8px;
|
||||||
|
padding-right: 8px;
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* SidebarHeader 底部 padding */
|
||||||
|
#nd-sidebar-mobile > div:first-child {
|
||||||
|
padding-top: 8px;
|
||||||
|
padding-bottom: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 去掉 viewport 内部的顶部渐变遮罩 */
|
||||||
|
#nd-sidebar-mobile [data-radix-scroll-area-viewport] > div {
|
||||||
|
mask-image: linear-gradient(transparent, #fff 0px, #fff calc(100% - 12px), transparent) !important;
|
||||||
|
-webkit-mask-image: linear-gradient(transparent, #fff 0px, #fff calc(100% - 12px), transparent) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* RootToggle 图标容器:缩小到与图标匹配,修复对齐和间距 */
|
||||||
|
#nd-sidebar-mobile .size-9,
|
||||||
|
[data-radix-popper-content-wrapper] .size-9 {
|
||||||
|
width: 20px !important;
|
||||||
|
height: 20px !important;
|
||||||
|
flex-shrink: 0;
|
||||||
|
display: flex !important;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* RootToggle 下拉菜单:增加两侧 padding + 选中项浅蓝背景 */
|
||||||
|
[data-radix-popper-content-wrapper] > div {
|
||||||
|
padding: 6px 8px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-radix-popper-content-wrapper] a {
|
||||||
|
padding-left: 12px !important;
|
||||||
|
padding-right: 12px !important;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 移动端目录下拉框(TOC Popover Trigger):文本溢出省略号 */
|
||||||
|
@media (max-width: 767px) {
|
||||||
|
button[class*="tocnav"] {
|
||||||
|
max-width: 100vw;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
button[class*="tocnav"] > span.grid {
|
||||||
|
overflow: hidden;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 文章内超长链接/文本自动换行 */
|
||||||
|
article {
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ const CustomFolder: FC<{ item: PageTree.Folder; level: number; children: ReactNo
|
|||||||
};
|
};
|
||||||
|
|
||||||
const CustomSeparator: FC<{ item: PageTree.Separator }> = ({ item }) => (
|
const CustomSeparator: FC<{ item: PageTree.Separator }> = ({ item }) => (
|
||||||
<div className="text-sm font-semibold px-2 py-2 mt-4 mb-2">{item.name}</div>
|
<div className="text-sm font-semibold px-2 py-1.5 mt-1 mb-1 first:mt-0">{item.name}</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
export const CustomSidebarComponents: SidebarComponents = {
|
export const CustomSidebarComponents: SidebarComponents = {
|
||||||
|
|||||||
33
document/components/sidebarKeepOpen.tsx
Normal file
33
document/components/sidebarKeepOpen.tsx
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { usePathname } from 'next/navigation';
|
||||||
|
import { useRef } from 'react';
|
||||||
|
import { useSidebar } from 'fumadocs-ui/provider';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移动端:点击一级 tab 切换时不关闭 sidebar,点击二级路由时正常关闭。
|
||||||
|
*
|
||||||
|
* 在渲染阶段检测是否为 tab 间切换,是则设 closeOnRedirect = false。
|
||||||
|
*/
|
||||||
|
export function SidebarKeepOpen({ tabUrls }: { tabUrls: string[] }) {
|
||||||
|
const pathname = usePathname();
|
||||||
|
const prevPathname = useRef(pathname);
|
||||||
|
const { closeOnRedirect } = useSidebar();
|
||||||
|
|
||||||
|
if (prevPathname.current !== pathname) {
|
||||||
|
const prev = prevPathname.current;
|
||||||
|
prevPathname.current = pathname;
|
||||||
|
|
||||||
|
// 判断是否是 tab 间切换(从一个 tab 根路径跳到另一个 tab 根路径)
|
||||||
|
const prevTab = tabUrls.find((url) => prev.startsWith(url));
|
||||||
|
const currTab = tabUrls.find((url) => pathname.startsWith(url));
|
||||||
|
|
||||||
|
if (prevTab && currTab && prevTab !== currTab) {
|
||||||
|
// 一级 tab 切换 → 不关闭 sidebar
|
||||||
|
closeOnRedirect.current = false;
|
||||||
|
}
|
||||||
|
// 否则(二级路由跳转)→ 保持默认行为(关闭 sidebar)
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@ description: FastGPT 云服务
|
|||||||
|
|
||||||
## 服务地址
|
## 服务地址
|
||||||
|
|
||||||
- [中国大陆: https://fastgpt.cn](https://fastgpt.cn)
|
- [中国大陆版: https://fastgpt.cn](https://fastgpt.cn)
|
||||||
- [国际版: https://fastgpt.io](https://fastgpt.io)
|
- [国际版: https://fastgpt.io](https://fastgpt.io)
|
||||||
|
|
||||||
请按需注册,两个版本账号不互通。
|
请按需注册,两个版本账号不互通。
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ FastGPT 是一个基于 LLM 大语言模型的知识库问答系统,将智能
|
|||||||
|
|
||||||
<Alert icon="🤖" context="success">
|
<Alert icon="🤖" context="success">
|
||||||
快速开始体验
|
快速开始体验
|
||||||
- 海外版:[https://fastgpt.io](https://fastgpt.io)
|
- 国际版:[https://fastgpt.io](https://fastgpt.io)
|
||||||
- 国内版:[https://fastgpt.cn](https://fastgpt.cn)
|
- 中国大陆版:[https://fastgpt.cn](https://fastgpt.cn)
|
||||||
</Alert>
|
</Alert>
|
||||||
|
|
||||||
| | |
|
| | |
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ EVAL_LINE_LIMIT=1000 # 评估文件最大行数
|
|||||||
|
|
||||||
1. 移除所有**开源功能**的限制,包括:应用数量和知识库数量上限。
|
1. 移除所有**开源功能**的限制,包括:应用数量和知识库数量上限。
|
||||||
2. 调整 RoadMap,增加`上下文管理`,`AI 生成工作流`,`高级编排 DeBug 调试模式`等计划。
|
2. 调整 RoadMap,增加`上下文管理`,`AI 生成工作流`,`高级编排 DeBug 调试模式`等计划。
|
||||||
3. 海外版域名将`fastgpt.io`调整成`fastgpt.io`。
|
3. 国际版域名将`fastgpt.io`调整成`fastgpt.io`。
|
||||||
|
|
||||||
## 🚀 新增内容
|
## 🚀 新增内容
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ description: FastGPT 接入微信公众号教程
|
|||||||
|
|
||||||
私有部署的用户可自行查阅自己的 IP 地址。
|
私有部署的用户可自行查阅自己的 IP 地址。
|
||||||
|
|
||||||
海外版用户(cloud.fastgpt.io)可以填写下面的 IP 白名单:
|
国际版用户(cloud.fastgpt.io)可以填写下面的 IP 白名单:
|
||||||
|
|
||||||
```
|
```
|
||||||
35.240.227.100
|
35.240.227.100
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"document/content/docs/faq/index.mdx": "2025-08-02T19:38:37+08:00",
|
"document/content/docs/faq/index.mdx": "2025-08-02T19:38:37+08:00",
|
||||||
"document/content/docs/faq/other.mdx": "2025-08-04T22:07:52+08:00",
|
"document/content/docs/faq/other.mdx": "2025-08-04T22:07:52+08:00",
|
||||||
"document/content/docs/faq/points_consumption.mdx": "2025-08-02T19:38:37+08:00",
|
"document/content/docs/faq/points_consumption.mdx": "2025-08-02T19:38:37+08:00",
|
||||||
"document/content/docs/introduction/cloud.mdx": "2026-02-12T18:45:30+08:00",
|
"document/content/docs/introduction/cloud.mdx": "2026-02-26T00:22:01+08:00",
|
||||||
"document/content/docs/introduction/commercial.mdx": "2025-09-21T23:09:46+08:00",
|
"document/content/docs/introduction/commercial.mdx": "2025-09-21T23:09:46+08:00",
|
||||||
"document/content/docs/introduction/development/configuration.mdx": "2025-08-05T23:20:39+08:00",
|
"document/content/docs/introduction/development/configuration.mdx": "2025-08-05T23:20:39+08:00",
|
||||||
"document/content/docs/introduction/development/custom-models/bge-rerank.mdx": "2025-07-23T21:35:03+08:00",
|
"document/content/docs/introduction/development/custom-models/bge-rerank.mdx": "2025-07-23T21:35:03+08:00",
|
||||||
@@ -123,8 +123,8 @@
|
|||||||
"document/content/docs/upgrading/4-14/4145.mdx": "2026-01-18T23:59:15+08:00",
|
"document/content/docs/upgrading/4-14/4145.mdx": "2026-01-18T23:59:15+08:00",
|
||||||
"document/content/docs/upgrading/4-14/41451.mdx": "2026-01-20T11:53:27+08:00",
|
"document/content/docs/upgrading/4-14/41451.mdx": "2026-01-20T11:53:27+08:00",
|
||||||
"document/content/docs/upgrading/4-14/4146.mdx": "2026-02-12T16:37:50+08:00",
|
"document/content/docs/upgrading/4-14/4146.mdx": "2026-02-12T16:37:50+08:00",
|
||||||
"document/content/docs/upgrading/4-14/4147.mdx": "2026-02-13T11:23:02+08:00",
|
"document/content/docs/upgrading/4-14/4147.mdx": "2026-02-24T19:54:14+08:00",
|
||||||
"document/content/docs/upgrading/4-14/4148.mdx": "2026-02-24T13:48:31+08:00",
|
"document/content/docs/upgrading/4-14/4148.mdx": "2026-02-25T18:28:16+08:00",
|
||||||
"document/content/docs/upgrading/4-8/40.mdx": "2025-08-02T19:38:37+08:00",
|
"document/content/docs/upgrading/4-8/40.mdx": "2025-08-02T19:38:37+08:00",
|
||||||
"document/content/docs/upgrading/4-8/41.mdx": "2025-08-02T19:38:37+08:00",
|
"document/content/docs/upgrading/4-8/41.mdx": "2025-08-02T19:38:37+08:00",
|
||||||
"document/content/docs/upgrading/4-8/42.mdx": "2025-08-02T19:38:37+08:00",
|
"document/content/docs/upgrading/4-8/42.mdx": "2025-08-02T19:38:37+08:00",
|
||||||
|
|||||||
Reference in New Issue
Block a user