diff --git a/web/src/components/blog-post-header.client.tsx b/web/src/components/blog-post-header.client.tsx
deleted file mode 100644
index b1ebf5c..0000000
--- a/web/src/components/blog-post-header.client.tsx
+++ /dev/null
@@ -1,94 +0,0 @@
-"use client"
-import { useBackground } from "@/contexts/background-context";
-import type { Post } from "@/models/post";
-import { useEffect, useRef,Suspense } from "react";
-import { Calendar, Clock, FileText, Flame, Heart, MessageCircle, PenLine, SquarePen } from "lucide-react";
-
-function PostMeta({ post }: { post: Post }) {
- return (
-
- {/* 作者 */}
-
-
- {post.user.nickname || "未知作者"}
-
- {/* 字数 */}
-
-
- {post.content.length || 0}
-
- {/* 阅读时间 */}
-
-
- {post.content.length / 100 || 1} 分钟
-
- {/* 发布时间 */}
-
-
- {post.createdAt ? new Date(post.createdAt).toLocaleDateString("zh-CN") : ""}
-
- {/* 最后编辑时间,如果和发布时间不一样 */}
- {post.updatedAt && post.createdAt !== post.updatedAt && (
-
-
- {new Date(post.updatedAt).toLocaleDateString("zh-CN")}
-
- )}
- {/* 浏览数 */}
-
-
- {post.viewCount || 0}
-
- {/* 点赞数 */}
-
-
- {post.likeCount || 0}
-
- {/* 评论数 */}
-
-
- {post.commentCount || 0}
-
- {/* 热度 */}
-
-
- {post.heat || 0}
-
-
- );
-}
-
-export default function PostHeader({ post }: { post: Post }) {
- const { setBackground } = useBackground();
- const headerRef = useRef(null);
- useEffect(() => {
- if (headerRef.current) {
- const { clientHeight } = headerRef.current;
- setBackground();
- }
- }, [headerRef, setBackground]);
- return (
-
- {(post.labels || post.isOriginal) && (
-
- {post.isOriginal && (
-
- 原创
-
- )}
- {(post.labels || []).map(label => (
-
- {label.key}
-
- ))}
-
- )
- }
-
{post.title}
- {/* 元数据区 */}
-
-
- );
-}
\ No newline at end of file
diff --git a/web/src/components/blog-post.tsx b/web/src/components/blog-post.tsx
index 93fd369..ba0be70 100644
--- a/web/src/components/blog-post.tsx
+++ b/web/src/components/blog-post.tsx
@@ -1,12 +1,97 @@
import { Suspense } from "react";
import type { Post } from "@/models/post";
+import { Calendar, Clock, FileText, Flame, Heart, MessageCircle, PenLine, SquarePen } from "lucide-react";
import { MDXRemote } from "next-mdx-remote-client/rsc";
-import PostHeader from "@/components/blog-post-header.client";
+function PostMeta({ post }: { post: Post }) {
+ return (
+
+ {/* 作者 */}
+
+
+ {post.user.nickname || "未知作者"}
+
+ {/* 字数 */}
+
+
+ {post.content.length || 0}
+
+ {/* 阅读时间 */}
+
+
+ {post.content.length / 100 || 1} 分钟
+
+ {/* 发布时间 */}
+
+
+ {post.createdAt ? new Date(post.createdAt).toLocaleDateString("zh-CN") : ""}
+
+ {/* 最后编辑时间,如果和发布时间不一样 */}
+ {post.updatedAt && post.createdAt !== post.updatedAt && (
+
+
+ {new Date(post.updatedAt).toLocaleDateString("zh-CN")}
+
+ )}
+ {/* 浏览数 */}
+
+
+ {post.viewCount || 0}
+
+ {/* 点赞数 */}
+
+
+ {post.likeCount || 0}
+
+ {/* 评论数 */}
+
+
+ {post.commentCount || 0}
+
+ {/* 热度 */}
+
+
+ {post.heat || 0}
+
+
+ );
+}
+
+function PostHeader({ post }: { post: Post }) {
+ return (
+
+ {/* 背景层 */}
+
+ {(post.labels || post.isOriginal) && (
+
+ {post.isOriginal && (
+
+ 原创
+
+ )}
+ {(post.labels || []).map(label => (
+
+ {label.key}
+
+ ))}
+
+ )}
+
{post.title}
+ {/* 元数据区 */}
+
+
+ );
+}
async function PostContent({ post }: { post: Post }) {
return (
-
+
{post.type === "html" && (
)}
{post.type === "markdown" && (
-
-
-
-
-
+
+
+
)}
{post.type === "text" && (