import { CustomPreference, User } from "~/lib/api/user"; import { Member } from "~/lib/api/member"; import { defaultAvatarUrl } from "~/lib/utils"; import ProfileFlag from "~/components/profile/ProfileFlag"; import ProfileLink from "~/components/profile/ProfileLink"; import ProfileField from "~/components/profile/ProfileField"; import { useTranslation } from "react-i18next"; import { renderMarkdown } from "~/lib/markdown"; import AvatarImage from "~/components/profile/AvatarImage"; export type Props = { name: string; fullName?: string; userI18nKeys: boolean; profile: User | Member; customPreferences: Record; }; export default function BaseProfile({ name, userI18nKeys, fullName, profile, customPreferences, }: Props) { const { t } = useTranslation(); const bio = renderMarkdown(profile.bio); return ( <>
{userI18nKeys ? ( ) : ( )} {profile.flags && profile.bio && (
{profile.flags.map((f, i) => ( ))}
)}
{profile.display_name || fullName ? ( <>

{profile.display_name || name}

{fullName || `@${name}`}

) : ( <>

{fullName || `@${name}`}

)} {bio && ( <>

)}
{profile.links.length > 0 && (
    {profile.links.map((l, i) => ( ))}
)}
{profile.names.length > 0 && ( )} {profile.pronouns.length > 0 && ( )} {profile.fields.map((f, i) => ( ))}
{/* If a user or member has no bio, flags are displayed in a row below the other profile info, rather than just below the avatar */} {profile.flags && !profile.bio && (
{profile.flags.map((f, i) => ( ))}
)} ); }