feat: 关于本站对齐站点公告,增加全部与管理入口

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-18 01:47:39 +08:00
parent 184489bca2
commit 2ccfb5f330
15 changed files with 384 additions and 80 deletions

View File

@@ -0,0 +1,32 @@
import Link from "next/link";
import { Info } from "lucide-react";
const linkClass =
"meta text-[12px] font-normal transition-colors hover:text-[var(--accent)]";
/** 关于本站模块标题栏:与站点公告一致,全员「全部」、管理员另见「管理」 */
export default function AboutSiteHeader({
title = "关于本站",
canManage,
}: {
title?: string;
canManage?: boolean;
}) {
return (
<div className="flex items-center justify-between gap-2 shrink-0">
<p className="j13-module-title !mb-0">
<Info size={15} style={{ color: "var(--accent)" }} /> {title}
</p>
<span className="inline-flex items-center gap-2 shrink-0">
<Link href="/about" className={linkClass}>
全部
</Link>
{canManage ? (
<Link href="/admin/pages" className={linkClass}>
管理
</Link>
) : null}
</span>
</div>
);
}

View File

@@ -15,7 +15,7 @@ const META: Record<
},
about: {
title: "关于本站",
href: "/",
href: "/about",
Icon: Info,
fallbackLead: "站点说明与政策文档",
},

View File

@@ -1,57 +1,62 @@
import Link from "next/link";
import { ChevronRight, Info } from "lucide-react";
import { ChevronRight } from "lucide-react";
import type { SidebarPageItem } from "@/lib/api";
import { pageGlyph } from "@/lib/pageGlyph";
import AboutSiteHeader from "./AboutSiteHeader";
/** 侧栏单页兄弟目录(高亮当前 slug) */
/** 侧栏单页兄弟目录(高亮当前 slug);标题栏与首页「关于本站」一致 */
export default function SiteDocPageNav({
pages,
currentSlug,
title = "文档目录",
canManage,
}: {
pages: SidebarPageItem[];
currentSlug?: string;
title?: string;
canManage?: boolean;
}) {
if (pages.length === 0) return null;
if (pages.length === 0 && !canManage) return null;
return (
<section className="j13-module j13-about flex min-h-0 flex-col" aria-label={title}>
<p className="j13-module-title mb-1 shrink-0">
<Info size={15} style={{ color: "var(--accent)" }} /> {title}
</p>
<ul className="j13-about-list j13-rail-scroll">
{pages.map((p) => {
const Icon = pageGlyph(p.slug);
const current = currentSlug === p.slug;
return (
<li key={p.id}>
<Link
href={`/p/${p.slug}`}
className="j13-about-item"
aria-current={current ? "page" : undefined}
style={
current
? {
background: "var(--accent-soft)",
borderColor: "var(--nav-active-line)",
}
: undefined
}
>
<span className="j13-about-ico" aria-hidden="true">
<Icon size={15} strokeWidth={2} />
</span>
<span className="j13-about-body">
<span className="j13-about-name">{p.title}</span>
{p.excerpt ? <span className="j13-about-excerpt">{p.excerpt}</span> : null}
</span>
<ChevronRight className="j13-about-chev" size={15} aria-hidden="true" />
</Link>
</li>
);
})}
</ul>
<AboutSiteHeader title={title} canManage={canManage} />
{pages.length === 0 ? (
<p className="meta mt-2 px-0.5">暂无介绍</p>
) : (
<ul className="j13-about-list j13-rail-scroll">
{pages.map((p) => {
const Icon = pageGlyph(p.slug);
const current = currentSlug === p.slug;
return (
<li key={p.id}>
<Link
href={`/p/${p.slug}`}
className="j13-about-item"
aria-current={current ? "page" : undefined}
style={
current
? {
background: "var(--accent-soft)",
borderColor: "var(--nav-active-line)",
}
: undefined
}
>
<span className="j13-about-ico" aria-hidden="true">
<Icon size={15} strokeWidth={2} />
</span>
<span className="j13-about-body">
<span className="j13-about-name">{p.title}</span>
{p.excerpt ? <span className="j13-about-excerpt">{p.excerpt}</span> : null}
</span>
<ChevronRight className="j13-about-chev" size={15} aria-hidden="true" />
</Link>
</li>
);
})}
</ul>
)}
</section>
);
}

View File

@@ -1,5 +1,6 @@
export { default as SiteDocShell } from "./SiteDocShell";
export { default as SiteDocIdentity } from "./SiteDocIdentity";
export { default as AboutSiteHeader } from "./AboutSiteHeader";
export { default as SiteDocPageNav } from "./SiteDocPageNav";
export { default as SiteDocAnnoNav } from "./SiteDocAnnoNav";
export { default as SiteDocMasthead } from "./SiteDocMasthead";