refactor: repartition server-side and client-side code

This commit is contained in:
LIlGG
2025-10-11 18:26:07 +08:00
parent 7acc4949fb
commit e9b573a276
309 changed files with 631 additions and 962 deletions

View File

@@ -0,0 +1,31 @@
import { useAuth } from '~/.client/hooks/useAuth';
export function UserProfile({ className }: { className?: string }) {
const { isAuthenticated, userInfo, isLoading } = useAuth();
if (!isAuthenticated) {
return <div className={className}></div>;
}
if (isLoading) {
return <div className={className}>...</div>;
}
if (!userInfo) {
return <div className={className}></div>;
}
return (
<div className={className}>
{userInfo.picture && (
<img
src={userInfo.picture}
alt={userInfo.name || userInfo.username || '用户头像'}
className="size-10 rounded-full mb-2"
/>
)}
<h3 className="text-lg font-semibold">{userInfo.name || userInfo.username || '用户'}</h3>
{userInfo.email && <p className="text-sm text-gray-600">{userInfo.email}</p>}
</div>
);
}