import { useEffect, useState } from "react"; import { AuthProvider } from "../auth"; import { useFirstStore } from "./store"; // @ts-ignore import UserNameBg from '../../assets/user-name-bg.jpg' import { ToastContainer } from "react-toastify"; console.log(UserNameBg); const src = UserNameBg.src; // 炫光边框卡片组件 - 黑白色系 const GlowingCard = ({ children, className = "" }: { children: React.ReactNode; className?: string }) => { return (
{/* 炫光边框 - 外层发光(黑白色系) */}
{/* 边框渐变层(半透明白色) */}
{/* 内容层 - 更透明 */}
{children}
); }; export const App = () => { const firstStore = useFirstStore(); const [username, setUsername] = useState(""); const [nickname, setNickname] = useState(""); const [password, setPassword] = useState(""); const [isLoading, setIsLoading] = useState(true); useEffect(() => { firstStore.getMe().finally(() => setIsLoading(false)); }, []); useEffect(() => { if (firstStore.userInfo) { setUsername(firstStore.userInfo.username); setNickname(firstStore.userInfo.nickname); } }, [firstStore.userInfo]); const canChange = firstStore.userInfo?.canChangeUsername ?? false; const handleSubmit = async () => { // TODO: 实现更新用户名和昵称的逻辑 // console.log("Update username to:", username, "nickname to:", nickname); const res = await firstStore.updateUserInfo({ username, nickname, password, }); }; if (isLoading) { return (
{/* 背景图层 */}
{/* 模糊和遮罩层 */}
{/* 内容层 */}
加载中...
); } return (
{/* 背景图层 */}
{/* 模糊和遮罩层 */}
{/* 内容层 */}
{/* 头像 */}
{firstStore.userInfo?.nickname
{/* 用户信息卡片 - 炫光边框效果 */}

{nickname || firstStore.userInfo?.username}

{'只有第一次可以修改用户名哦~'}

{/* 用户名输入表单 */}
setNickname(e.target.value)} disabled={!canChange} className="w-full px-5 py-3 rounded-xl border-2 focus:outline-none focus:ring-2 focus:ring-white/50 focus:border-white/50 backdrop-blur-sm bg-white/5 text-white placeholder-white/40 border-white/20 disabled:bg-white/5 disabled:cursor-not-allowed disabled:border-white/10 disabled:text-white/40 transition-all duration-200" placeholder="输入昵称" />
setUsername(e.target.value)} disabled={!canChange} className="w-full px-5 py-3 rounded-xl border-2 focus:outline-none focus:ring-2 focus:ring-white/50 focus:border-white/50 backdrop-blur-sm bg-white/5 text-white placeholder-white/40 border-white/20 disabled:bg-white/5 disabled:cursor-not-allowed disabled:border-white/10 disabled:text-white/40 transition-all duration-200" placeholder="输入用户名" />
setPassword(e.target.value)} disabled={!canChange} className="w-full px-5 py-3 rounded-xl border-2 focus:outline-none focus:ring-2 focus:ring-white/50 focus:border-white/50 backdrop-blur-sm bg-white/5 text-white placeholder-white/40 border-white/20 disabled:bg-white/5 disabled:cursor-not-allowed disabled:border-white/10 disabled:text-white/40 transition-all duration-200" placeholder="输入密码" />
); }; export const AppProvider = () => { return ; }