diff --git a/web/src/components/blog-home.tsx b/web/src/components/blog-home.tsx index 5e4f94f..be27d4d 100644 --- a/web/src/components/blog-home.tsx +++ b/web/src/components/blog-home.tsx @@ -14,7 +14,6 @@ import { useStoredState } from '@/hooks/use-storage-state'; import { listLabels } from "@/api/label"; import { POST_SORT_TYPE } from "@/localstore"; - // 定义排序类型 type SortType = 'latest' | 'popular'; diff --git a/web/src/components/blog-post.tsx b/web/src/components/blog-post.tsx index 8e7fa14..f172abb 100644 --- a/web/src/components/blog-post.tsx +++ b/web/src/components/blog-post.tsx @@ -4,6 +4,7 @@ import { Calendar, Clock, FileText, Flame, Heart, MessageCircle, PenLine, Square import { MDXRemote } from "next-mdx-remote-client/rsc"; import ScrollToTop from "@/components/scroll-to-top.client"; import { RenderMarkdown } from "@/components/markdown"; +import { isMobileByUA } from "@/utils/server/device"; function PostMeta({ post }: { post: Post }) { return ( @@ -59,9 +60,10 @@ function PostMeta({ post }: { post: Post }) { ); } -function PostHeader({ post }: { post: Post }) { +async function PostHeader({ post }: { post: Post }) { + const isMobile = await isMobileByUA(); return ( -
+
{/* 背景层 */}
+ {navbarMenuComponents.map((item) => ( @@ -123,62 +121,57 @@ function ListItem({ } function SidebarMenuClientOnly() { - const [mounted, setMounted] = useState(false); - useEffect(() => setMounted(true), []); - if (!mounted) return null; return ; } function SidebarMenu() { const [open, setOpen] = useState(false) - const { isMobile } = useDevice() - - if (!isMobile) return null - return ( - - - - - - {/* 可访问性要求的标题,视觉上隐藏 */} - 侧边栏菜单 - - - + ) : null + )} + + +
+ ) } \ No newline at end of file