feat: 新增大量社区功能与基础组件,优化站点整体体验

- 新增事件总线式toast通知系统
- 新增头像、阅读进度、404/500错误页等基础组件
- 重构页脚、布局、分页、点赞按钮等现有组件
- 新增用户个人页、通知中心、帖子编辑/发布/置顶/推荐管理功能
- 优化登录注册页面样式与交互
- 修复路径类型文件引用,更新站点元信息与字体配置
This commit is contained in:
2026-09-12 04:30:02 +08:00
parent a8f6ce4e4f
commit 1eaf3903d4
31 changed files with 2395 additions and 740 deletions

View File

@@ -7,9 +7,9 @@ interface PaginationProps {
total: number;
page: number;
size: number;
basePath: string; // e.g. "/" or "/board/1"
query?: Record<string, string>; // additional query params (e.g. q for search)
onChange?: (page: number) => void; // 客户端分页回调;提供时不渲染 Link 而是按钮
basePath: string;
query?: Record<string, string>;
onChange?: (page: number) => void;
}
export default function Pagination({ total, page, size, basePath, query = {}, onChange }: PaginationProps) {
@@ -29,7 +29,6 @@ export default function Pagination({ total, page, size, basePath, query = {}, on
}
};
// 生成页码按钮(最多显示 7 个,带省略号)
const pages: (number | "...")[] = [];
const add = (p: number | "...") => pages.push(p);
@@ -45,35 +44,33 @@ export default function Pagination({ total, page, size, basePath, query = {}, on
add(totalPages);
}
const cls =
"pager-btn min-w-[38px] h-9 px-1 flex items-center justify-center font-semibold text-[13px] rounded-full border transition-colors duration-150";
return (
<nav className="flex items-center justify-center gap-1 mt-8">
<nav className="flex items-center justify-center gap-1.5 mt-10 flex-wrap" aria-label="分页">
{page > 1 && (
<Link
href={buildHref(page - 1)}
onClick={(e) => handleClick(page - 1, e)}
className="flex items-center gap-1 px-3 py-1.5 rounded-lg text-sm hover:opacity-80"
style={{ background: "var(--bg-secondary)", color: "var(--text)" }}
className={`${cls} px-3 gap-1`}
>
<ChevronLeft size={16} /> 上一页
<ChevronLeft size={14} /> 上一页
</Link>
)}
{pages.map((p, i) =>
p === "..." ? (
<span key={`e${i}`} className="px-2" style={{ color: "var(--text-secondary)" }}>…</span>
<span key={`e${i}`} className="px-1 meta">
—
</span>
) : (
<Link
key={p}
href={buildHref(p)}
onClick={(e) => handleClick(p, e)}
className={`min-w-[36px] h-9 flex items-center justify-center rounded-lg text-sm ${
p === page ? "text-white" : "hover:opacity-80"
}`}
style={
p === page
? { background: "var(--primary)" }
: { background: "var(--bg-secondary)", color: "var(--text)" }
}
aria-current={p === page ? "page" : undefined}
className={`${cls} ${p === page ? "is-current" : ""}`}
>
{p}
</Link>
@@ -84,10 +81,9 @@ export default function Pagination({ total, page, size, basePath, query = {}, on
<Link
href={buildHref(page + 1)}
onClick={(e) => handleClick(page + 1, e)}
className="flex items-center gap-1 px-3 py-1.5 rounded-lg text-sm hover:opacity-80"
style={{ background: "var(--bg-secondary)", color: "var(--text)" }}
className={`${cls} px-3 gap-1`}
>
下一页 <ChevronRight size={16} />
下一页 <ChevronRight size={14} />
</Link>
)}
</nav>