"use client"; import { useEffect, useState } from "react"; import { useSearchParams } from "next/navigation"; import { BlurFade } from "@/components/magicui/blur-fade"; import { HomeDock } from "./home-dock"; import { Dialog, DialogContent, DialogHeader, DialogTitle, } from "@/components/ui/dialog"; import { LoginForm } from "./login/login-form"; import { Card, CardContent } from "@/components/ui/card"; import { Globe, ExternalLink, Link2 } from "lucide-react"; import Link from "next/link"; interface Bookmark { id: number; title: string; url: string; description: string; icon: string; category: string; } export function HomePageClient({ isAuthenticated, isAdmin, healthText, hasKeycloak, bookmarks, }: { isAuthenticated: boolean; isAdmin: boolean; healthText: string; hasKeycloak: boolean; bookmarks: Bookmark[]; }) { const searchParams = useSearchParams(); const [loginOpen, setLoginOpen] = useState(false); useEffect(() => { if (searchParams.get("login") === "1" && !isAuthenticated) { setLoginOpen(true); } }, [searchParams, isAuthenticated]); const grouped = bookmarks.reduce>((acc, bm) => { const cat = bm.category || "默认"; if (!acc[cat]) acc[cat] = []; acc[cat].push(bm); return acc; }, {}); return (

EvanPage

个人主页管理中心

后端状态

{healthText}

{bookmarks.length > 0 && (

我的导航

{isAdmin && ( 管理书签 → )}
{Object.entries(grouped).map(([cat, items], catIdx) => (

{cat}

))}
)} {bookmarks.length === 0 && (

还没有书签

{isAdmin && ( 添加第一个书签 → )}
)} !isAuthenticated && setLoginOpen(true)} /> 登录 setLoginOpen(false)} />
); }