feat: 关于本站对齐站点公告,增加全部与管理入口
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -11,7 +11,6 @@ import {
|
||||
PenLine,
|
||||
Activity,
|
||||
TrendingUp,
|
||||
Info,
|
||||
Pin,
|
||||
ChevronRight,
|
||||
} from "lucide-react";
|
||||
@@ -29,6 +28,7 @@ import { PulseCheckin } from "./CheckinCard";
|
||||
import { FRIEND_LINKS } from "@/lib/friendLinks";
|
||||
import { formatCompact, formatShortDate } from "@/lib/format";
|
||||
import { pageGlyph } from "@/lib/pageGlyph";
|
||||
import { AboutSiteHeader } from "@/components/site-doc";
|
||||
|
||||
/* ---------- 站点数据(2×2 bento 统计瓦片) ---------- */
|
||||
|
||||
@@ -127,38 +127,42 @@ function PulseCard({
|
||||
function AboutSite({
|
||||
pages,
|
||||
siteDescription,
|
||||
canManagePages,
|
||||
}: {
|
||||
pages: SidebarPageItem[];
|
||||
siteDescription?: string;
|
||||
canManagePages?: boolean;
|
||||
}) {
|
||||
if (pages.length === 0) return null;
|
||||
if (pages.length === 0 && !canManagePages) return null;
|
||||
const lead = siteDescription?.trim() ?? "";
|
||||
|
||||
return (
|
||||
<section className="j13-module j13-about" aria-label="关于本站">
|
||||
<p className="j13-module-title">
|
||||
<Info size={15} style={{ color: "var(--accent)" }} /> 关于本站
|
||||
</p>
|
||||
<AboutSiteHeader canManage={canManagePages} />
|
||||
{lead ? <p className="j13-about-lead">{lead}</p> : null}
|
||||
<ul className="j13-about-list">
|
||||
{pages.map((p) => {
|
||||
const Icon = pageGlyph(p.slug);
|
||||
return (
|
||||
<li key={p.id}>
|
||||
<Link href={`/p/${p.slug}`} className="j13-about-item">
|
||||
<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>
|
||||
{pages.length === 0 ? (
|
||||
<p className="meta mt-2 px-0.5">暂无介绍</p>
|
||||
) : (
|
||||
<ul className="j13-about-list">
|
||||
{pages.map((p) => {
|
||||
const Icon = pageGlyph(p.slug);
|
||||
return (
|
||||
<li key={p.id}>
|
||||
<Link href={`/p/${p.slug}`} className="j13-about-item">
|
||||
<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>
|
||||
);
|
||||
}
|
||||
@@ -419,6 +423,7 @@ type PanelsProps = {
|
||||
checkin?: CheckinStatus | null;
|
||||
allowComments: boolean;
|
||||
canManageAnnouncements?: boolean;
|
||||
canManagePages?: boolean;
|
||||
sidebarPages?: SidebarPageItem[];
|
||||
siteDescription?: string;
|
||||
};
|
||||
@@ -432,6 +437,7 @@ function CommunityPanelsBody({
|
||||
checkin,
|
||||
allowComments,
|
||||
canManageAnnouncements,
|
||||
canManagePages,
|
||||
sidebarPages = [],
|
||||
siteDescription,
|
||||
}: PanelsProps) {
|
||||
@@ -443,7 +449,11 @@ function CommunityPanelsBody({
|
||||
<NewUsers users={newUsers} />
|
||||
<ActiveUsers users={activeUsers} allowComments={allowComments} />
|
||||
<FriendLinks />
|
||||
<AboutSite pages={sidebarPages} siteDescription={siteDescription} />
|
||||
<AboutSite
|
||||
pages={sidebarPages}
|
||||
siteDescription={siteDescription}
|
||||
canManagePages={canManagePages}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user