From 6aeaca77b88c9b7b503976dcf25fce45fe32f2d4 Mon Sep 17 00:00:00 2001 From: yile Date: Thu, 26 Nov 2026 14:56:07 +0800 Subject: [PATCH] =?UTF-8?q?feat(web):=20=E9=A1=B6=E6=A0=8F=20DeepWiki=20?= =?UTF-8?q?=E5=85=A5=E5=8F=A3=E6=8D=A2=E6=88=90=E6=96=87=E6=A1=A3=E7=AB=99?= =?UTF-8?q?=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 去掉顶栏的 DeepWiki 图标(外站 favicon 常加载不出来,按钮成了空白块), DeepWiki 入口留在文档站顶栏,地址改动只改文档站一处 - 新增「查看文档」按钮,指向文档站;界面是英文时进 /en/ - GitHub 按钮保留 - brand.ts:deepwikiUrl 换成 docsUrl Co-Authored-By: Claude Opus 5.5 --- apps/web/src/components/deepwiki-link.tsx | 46 ----------------------- apps/web/src/components/docs-link.tsx | 39 +++++++++++++++++++ apps/web/src/lib/brand.ts | 7 +++- apps/web/src/routes/_auth.tsx | 4 +- packages/i18n/src/locales/en-US.json | 2 +- packages/i18n/src/locales/zh-CN.json | 2 +- 6 files changed, 48 insertions(+), 52 deletions(-) delete mode 100644 apps/web/src/components/deepwiki-link.tsx create mode 100644 apps/web/src/components/docs-link.tsx diff --git a/apps/web/src/components/deepwiki-link.tsx b/apps/web/src/components/deepwiki-link.tsx deleted file mode 100644 index e377b57a..00000000 --- a/apps/web/src/components/deepwiki-link.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import * as React from "react" -import { useTranslation } from "react-i18next" -import { IconBook2 } from "@tabler/icons-react" - -import { buttonVariants } from "@admin/ui/components/button" -import { Tooltip, TooltipContent, TooltipTrigger } from "@admin/ui/components/tooltip" -import { cn } from "@admin/ui/lib/utils" - -import { BRAND } from "@/lib/brand" - -/** 演示站顶栏的 DeepWiki 项目解析入口,优先展示 DeepWiki 站点图标。 */ -export function DeepWikiLink() { - const { t } = useTranslation() - const [iconUnavailable, setIconUnavailable] = React.useState(false) - const label = t("用 DeepWiki 理解项目") - - return ( - - - } - > - {iconUnavailable ? ( - - {label} - - ) -} diff --git a/apps/web/src/components/docs-link.tsx b/apps/web/src/components/docs-link.tsx new file mode 100644 index 00000000..d74599d9 --- /dev/null +++ b/apps/web/src/components/docs-link.tsx @@ -0,0 +1,39 @@ +import { useTranslation } from "react-i18next" +import { IconBook2 } from "@tabler/icons-react" + +import { buttonVariants } from "@admin/ui/components/button" +import { Tooltip, TooltipContent, TooltipTrigger } from "@admin/ui/components/tooltip" +import { cn } from "@admin/ui/lib/utils" + +import { BRAND } from "@/lib/brand" + +/** + * 顶栏的文档站入口。DeepWiki 这类第三方解析挂在文档站的顶栏上,后台不再单独摆图标—— + * 那些地址改了只改文档站一处。GitHub 仓库入口照旧在旁边(`github-link.tsx`)。 + * + * 界面是英文时直接进英文版(文档站中文在根路径、英文在 `/en/`)。 + */ +export function DocsLink() { + const { t, i18n } = useTranslation() + const label = t("查看文档") + const href = i18n.language?.startsWith("en") ? `${BRAND.docsUrl}en/` : BRAND.docsUrl + return ( + + + } + > + + + {label} + + ) +} diff --git a/apps/web/src/lib/brand.ts b/apps/web/src/lib/brand.ts index 8d9da6da..5a8d9950 100644 --- a/apps/web/src/lib/brand.ts +++ b/apps/web/src/lib/brand.ts @@ -52,6 +52,9 @@ export const BRAND = { commit: import.meta.env.VITE_GIT_SHA || null, /** 仓库地址。顶栏的 GitHub 图标(`components/github-link.tsx`)读它,fork 出去改这一处就行 */ repoUrl: "https://github.com/yile2020/fastapi-react-admin", - /** DeepWiki 的项目解析页,给演示站访客一个 AI 架构导览入口 */ - deepwikiUrl: "https://deepwiki.com/yile2020/fastapi-react-admin", + /** + * 文档站地址(以 `/` 结尾,英文版在其下的 `en/`)。顶栏的文档图标(`components/docs-link.tsx`)读它, + * fork 出去改这一处就行。DeepWiki 的入口在文档站顶栏上,后台不再单独挂 + */ + docsUrl: "https://yile2020.github.io/fastapi-react-admin/", } as const diff --git a/apps/web/src/routes/_auth.tsx b/apps/web/src/routes/_auth.tsx index e986e27d..307d6053 100644 --- a/apps/web/src/routes/_auth.tsx +++ b/apps/web/src/routes/_auth.tsx @@ -34,8 +34,8 @@ import { NotificationBell } from "@admin/platform/pages/notification/bell" import { NoticeBanner } from "@admin/platform/pages/notice/banner" import { NoticePopupHost } from "@admin/platform/pages/notice/popup-host" import { AiDrawer, AiDrawerTrigger } from "@admin/platform/pages/ai-chat/drawer" +import { DocsLink } from "@/components/docs-link" import { GithubLink } from "@/components/github-link" -import { DeepWikiLink } from "@/components/deepwiki-link" import { UserMenu } from "@/components/user-menu" export const Route = createFileRoute("/_auth")({ @@ -129,7 +129,7 @@ function AuthLayout() { {/* 命令面板入口:⌘K 也能开,但快捷键不摆出来就等于只有作者知道 */}
- + {/* 帮助:重看功能引导 / 快捷键清单。没有这个按钮,那两样只有知道的人才找得到 */} diff --git a/packages/i18n/src/locales/en-US.json b/packages/i18n/src/locales/en-US.json index 7337bc29..27019992 100644 --- a/packages/i18n/src/locales/en-US.json +++ b/packages/i18n/src/locales/en-US.json @@ -1985,6 +1985,7 @@ "查看全部审批单,处理卡住的待办。": "View all approval requests and handle stuck tasks.", "查看全部通知": "View all notifications", "查看已装插件、启停与打包下载。": "Inspect installed plugins, toggle them, download a bundle.", + "查看文档": "Documentation", "查看详情": "View details", "查询": "Query", "标准": "Standard", @@ -2260,7 +2261,6 @@ "生成一把新密钥。旧的那把还会一起签名 24 小时,对方在这一天里换成新的就不会丢事件。": "A new secret will be generated. The old one keeps signing alongside it for 24 hours, so the receiver loses no events as long as it switches within that day.", "生成中": "Generating", "生成中,通常要半分钟左右。关掉弹窗就不要这次的结果。": "Generating, usually takes about half a minute. Closing the dialog discards this result.", - "用 DeepWiki 理解项目": "Explore the project with DeepWiki", "用 {{name}} 验证身份": "Verify with {{name}}", "用于发布系统内部通知、公告": "Publishes internal notices and announcements", "用于安全审计:确认是谁、从哪里、用什么设备登录,失败时看清原因。": "For security audits: who signed in, from where, on what device, and why it failed.", diff --git a/packages/i18n/src/locales/zh-CN.json b/packages/i18n/src/locales/zh-CN.json index 1d9049f1..792426ae 100644 --- a/packages/i18n/src/locales/zh-CN.json +++ b/packages/i18n/src/locales/zh-CN.json @@ -1985,6 +1985,7 @@ "查看全部审批单,处理卡住的待办。": "查看全部审批单,处理卡住的待办。", "查看全部通知": "查看全部通知", "查看已装插件、启停与打包下载。": "查看已装插件、启停与打包下载。", + "查看文档": "查看文档", "查看详情": "查看详情", "查询": "查询", "标准": "标准", @@ -2260,7 +2261,6 @@ "生成一把新密钥。旧的那把还会一起签名 24 小时,对方在这一天里换成新的就不会丢事件。": "生成一把新密钥。旧的那把还会一起签名 24 小时,对方在这一天里换成新的就不会丢事件。", "生成中": "生成中", "生成中,通常要半分钟左右。关掉弹窗就不要这次的结果。": "生成中,通常要半分钟左右。关掉弹窗就不要这次的结果。", - "用 DeepWiki 理解项目": "用 DeepWiki 理解项目", "用 {{name}} 验证身份": "用 {{name}} 验证身份", "用于发布系统内部通知、公告": "用于发布系统内部通知、公告", "用于安全审计:确认是谁、从哪里、用什么设备登录,失败时看清原因。": "用于安全审计:确认是谁、从哪里、用什么设备登录,失败时看清原因。",