Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 0 additions & 158 deletions app/api/docs/history/route.ts

This file was deleted.

2 changes: 2 additions & 0 deletions app/components/AuthNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export function AuthNav() {
name: user.displayName,
email: user.email ?? null,
image: user.avatarUrl ?? null,
// 透传 githubId,让 UserMenu 渲染"我的主页"入口
githubId: user.githubId ?? null,
}}
provider="github"
logout={logout}
Expand Down
22 changes: 15 additions & 7 deletions app/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,32 @@ export function Header() {
</div>

<div className="flex items-center justify-between h-10">
{/*
导航对齐当前信息架构(2026-04 重构后):
- 去掉"首页":左上角 BrandMark 已经是回首页入口,避免冗余
- 去掉"特点":Features 组件已经删除,旧的 /#features 锚点不存在
- 文档 / 排行榜:站点两大主路由,提到顶
- 社区:保留 /#community 锚点(指向首页底部 DispatchNetwork 的 GitHub/Discord/Zotero bar)
- 联系:缩写自"联系我们",/#contact 还在 Footer 里
*/}
<nav className="hidden md:flex items-center gap-8 font-sans text-xs font-bold uppercase tracking-widest text-[var(--foreground)]">
<Link
href="/"
href="/docs"
className="hover:text-[#CC0000] transition-colors"
data-umami-event="navigation_click"
data-umami-event-region="header"
data-umami-event-label="home"
data-umami-event-label="docs"
>
首页
文档
</Link>
<Link
href="/#features"
href="/rank"
className="hover:text-[#CC0000] transition-colors"
data-umami-event="navigation_click"
data-umami-event-region="header"
data-umami-event-label="features"
data-umami-event-label="rank"
>
特点
排行榜
</Link>
<Link
href="/#community"
Expand All @@ -65,7 +73,7 @@ export function Header() {
data-umami-event-region="header"
data-umami-event-label="contact"
>
联系我们
联系
</Link>
</nav>

Expand Down
13 changes: 13 additions & 0 deletions app/components/UserMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ interface UserMenuProps {
name?: string | null;
email?: string | null;
image?: string | null;
/** GitHub 数字 ID,用于拼个人主页 URL /u/{githubId} */
githubId?: number | null;
};
provider?: string;
// 退出登录回调,由父组件传入(来自 useAuth().logout)
Expand Down Expand Up @@ -58,6 +60,17 @@ export function UserMenu({ user, provider, logout }: UserMenuProps) {
) : null}
</div>

{/* 个人主页入口:只有拿到 githubId 的登录用户才显示,避免老账号 githubId 为 null 时跳 404 */}
{user.githubId != null && (
<Link
href={`/u/${user.githubId}`}
className="block px-4 py-2 text-sm text-neutral-900 dark:text-neutral-100 transition hover:bg-neutral-100 dark:hover:bg-neutral-800"
data-umami-event="user_menu_profile_click"
>
我的主页
</Link>
)}

{/* 设置入口:登录用户均可见,指向 /settings 偏好页 */}
<Link
href="/settings"
Expand Down
32 changes: 21 additions & 11 deletions app/components/rank/ContributorRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,27 @@ export function ContributorRow({
Contributions Dossier
</Dialog.Description>

{/* GitHub 个人主页跳转链接,带有 Umami 点击事件追踪埋点 */}
<a
href={`https://github.com/${user.name}`}
target="_blank"
rel="noopener noreferrer"
className="inline-flex items-center gap-1 font-mono text-xs uppercase tracking-widest text-[var(--foreground)]/70 hover:text-[#CC0000] transition-colors w-max"
data-umami-event="click_github_profile"
data-umami-event-user={user.name}
>
GITHUB PROFILE <ExternalLink className="w-3 h-3" />
</a>
{/* 本站个人主页 + GitHub 主页两个入口 */}
<div className="flex flex-wrap items-center gap-x-4 gap-y-1">
<Link
href={`/u/${user.id}`}
className="inline-flex items-center gap-1 font-mono text-xs uppercase tracking-widest text-[var(--foreground)] hover:text-[#CC0000] transition-colors w-max font-bold"
data-umami-event="click_site_profile"
data-umami-event-user={user.name}
>
VIEW DOSSIER →
</Link>
<a
href={`https://github.com/${user.name}`}
target="_blank"
rel="noopener noreferrer"
className="inline-flex items-center gap-1 font-mono text-xs uppercase tracking-widest text-[var(--foreground)]/70 hover:text-[#CC0000] transition-colors w-max"
data-umami-event="click_github_profile"
data-umami-event-user={user.name}
>
GITHUB <ExternalLink className="w-3 h-3" />
</a>
</div>
</div>

{/* 贡献统计数据展示 */}
Expand Down
46 changes: 27 additions & 19 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// import { SearchWrapper } from "@/app/components/SearchWrapper";
import { CustomSearchDialog } from "@/app/components/CustomSearchDialog";
import { cookies } from "next/headers";
import { LocaleProvider } from "@/lib/i18n/client";

const geistSans = localFont({
src: "./fonts/GeistVF.woff",
Expand Down Expand Up @@ -141,7 +142,7 @@
href="https://fonts.gstatic.com"
crossOrigin="anonymous"
/>
<link

Check warning on line 145 in app/layout.tsx

View workflow job for this annotation

GitHub Actions / build

Custom fonts not added in `pages/_document.js` will only load for a single page. This is discouraged. See: https://nextjs.org/docs/messages/no-page-custom-font
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&family=Playfair+Display:ital,wght@0,400;0,600;0,700;0,900;1,400&family=Lora:ital,wght@0,400;0,600;1,400&display=swap"
/>
Expand Down Expand Up @@ -209,25 +210,32 @@
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
<div className="site-bg site-bg--stars" aria-hidden />
<ThemeProvider defaultTheme="dark" storageKey="ih-theme">
<AuthProvider>
<RootProvider
// 禁用 fumadocs 内置的 next-themes,避免与我们自己的 ThemeProvider(storageKey: ih-theme)
// 同时往 <html class> 写 light/dark 导致闪烁和状态不同步
theme={{ enabled: false }}
search={{
SearchDialog: CustomSearchDialog,
// 使用静态索引,兼容 next export 与本地开发
options: { type: "static", api: searchApi },
}}
>
<main id="main-content" className="relative z-10">
{children}
</main>
<UmamiIdentity />
</RootProvider>
</AuthProvider>
</ThemeProvider>
{/*
LocaleProvider 把服务端读出的 locale 注入客户端 Context,
客户端组件通过 useT() 拿到翻译函数,保持 SSR/CSR 一致,
不在客户端重新读 cookie 避免水合抖动。
*/}
<LocaleProvider locale={locale}>
<ThemeProvider defaultTheme="dark" storageKey="ih-theme">
<AuthProvider>
<RootProvider
// 禁用 fumadocs 内置的 next-themes,避免与我们自己的 ThemeProvider(storageKey: ih-theme)
// 同时往 <html class> 写 light/dark 导致闪烁和状态不同步
theme={{ enabled: false }}
search={{
SearchDialog: CustomSearchDialog,
// 使用静态索引,兼容 next export 与本地开发
options: { type: "static", api: searchApi },
}}
>
<main id="main-content" className="relative z-10">
{children}
</main>
<UmamiIdentity />
</RootProvider>
</AuthProvider>
</ThemeProvider>
</LocaleProvider>
{/* 谷歌分析 */}
<Script
src="https://www.googletagmanager.com/gtag/js?id=G-ED4GVN8YVW"
Expand Down
Loading
Loading