"use client"; import { useState } from "react"; import styles from "./workspace.module.css"; export function UserAvatar({ name, url, large = false }: { name: string; url?: string | null; large?: boolean; }) { const [failedUrl, setFailedUrl] = useState(null); const showImage = Boolean(url && url !== failedUrl); return ( {showImage ? ( {`${name}的头像`} setFailedUrl(url!)} /> ) : } ); }