"use client"; import { useState, useEffect } from "react"; import MatchDays from "./ui/MatchDays"; import MatchPrediction from "./ui/MatchPrediction"; import Image from "next/image"; import { useRouter } from "next/navigation"; import ActivityModal from "./ui/components/ActivityModal"; export default function Home() { const [selectedDayMatches, setSelectedDayMatches] = useState([]); const [currentUser, setCurrentUser] = useState(null); const router = useRouter(); useEffect(() => { const user = JSON.parse(localStorage.getItem("currentUser") || "null"); setCurrentUser(user); }, []); const handlePersonalCenterClick = () => { console.log("Personal center clicked"); router.push("/personal-center"); }; const handleLogout = () => { setCurrentUser(null); localStorage.removeItem("currentUser"); router.push("/"); }; return (
Logo
{currentUser ? (
{currentUser.avatar ? ( User Avatar ) : (
User Avatar
)} {currentUser.username}
退出登录
) : ( )}
); }