import { Avatar } from "@mui/material";
import type { UserProfile } from "../../api/matrix/MatrixApiProfile";
import { MatrixApiMedia } from "../../api/matrix/MatrixApiMedia";

export function AccountIcon(p: { user: UserProfile }): React.ReactElement {
  return (
    <Avatar
      src={
        p.user.avatar ? MatrixApiMedia.MediaURL(p.user.avatar, true) : undefined
      }
    >
      {p.user.display_name?.slice(0, 1)}
    </Avatar>
  );
}
