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

17
frontend/lib/toast.ts Normal file
View File

@@ -0,0 +1,17 @@
// 零依赖的事件总线式 toast,避免在每个交互组件里包 Context
export type ToastVariant = "error" | "ok";
export interface ToastDetail {
id: number;
message: string;
variant: ToastVariant;
}
export function toast(message: string, variant: ToastVariant = "error") {
if (typeof window === "undefined") return;
window.dispatchEvent(
new CustomEvent<ToastDetail>("j13-toast", {
detail: { id: Date.now() + Math.random(), message, variant },
})
);
}