import React from 'react'; import { FormattedMessage, useIntl } from 'react-intl'; import { Link } from 'react-router-dom'; import StillImage from 'soapbox/components/still-image'; import { Avatar, HStack, Stack, Text } from 'soapbox/components/ui'; import VerificationBadge from 'soapbox/components/verification-badge'; import { useAppSelector } from 'soapbox/hooks'; import { makeGetAccount } from 'soapbox/selectors'; import { getAcct } from 'soapbox/utils/accounts'; import { shortNumberFormat } from 'soapbox/utils/numbers'; import { displayFqn } from 'soapbox/utils/state'; const getAccount = makeGetAccount(); interface IUserPanel { accountId: string, action?: JSX.Element, badges?: JSX.Element[], domain?: string, } const UserPanel: React.FC = ({ accountId, action, badges, domain }) => { const intl = useIntl(); const account = useAppSelector((state) => getAccount(state, accountId)); const fqn = useAppSelector((state) => displayFqn(state)); if (!account) return null; const displayNameHtml = { __html: account.display_name_html }; const acct = !account.acct.includes('@') && domain ? `${account.acct}@${domain}` : account.acct; const header = account.header; const verified = account.verified; return (
{header && ( )}
{action && (
{action}
)}
{verified && } {badges && badges.length > 0 && ( {badges} )} @{getAcct(account, fqn)} {account.followers_count >= 0 && ( {shortNumberFormat(account.followers_count)} )} {account.following_count >= 0 && ( {shortNumberFormat(account.following_count)} )}
); }; export default UserPanel;