'use strict'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import Button from 'gabsocial/components/button'; import ImmutablePureComponent from 'react-immutable-pure-component'; import Icon from 'gabsocial/components/icon'; import VerificationBadge from 'gabsocial/components/verification_badge'; import ProBadge from 'gabsocial/components/pro_badge'; import DonorBadge from 'gabsocial/components/donor_badge'; import InvestorBadge from 'gabsocial/components/investor_badge'; import { List as ImmutableList } from 'immutable'; const messages = defineMessages({ linkVerifiedOn: { id: 'account.link_verified_on', defaultMessage: 'Ownership of this link was checked on {date}' }, account_locked: { id: 'account.locked_info', defaultMessage: 'This account privacy status is set to locked. The owner manually reviews who can follow them.' }, }); const dateFormatOptions = { month: 'short', day: 'numeric', year: 'numeric', hour12: false, hour: '2-digit', minute: '2-digit', }; class ProfileInfoPanel extends ImmutablePureComponent { static propTypes = { account: ImmutablePropTypes.map, identity_proofs: ImmutablePropTypes.list, intl: PropTypes.object.isRequired, username: PropTypes.string, }; render () { const { account, intl, identity_proofs, username } = this.props; if (!account) { return (

@{username}

); } const lockedIcon = account.get('locked') ? () : ''; const badge = account.get('bot') ? (
) : null; const content = { __html: account.get('note_emojified') }; const fields = account.get('fields'); const acct = account.get('acct'); const displayNameHtml = { __html: account.get('display_name_html') }; const memberSinceDate = intl.formatDate(account.get('created_at'), { month: 'long', year: 'numeric' }); return (

{account.get('is_verified') && } {badge} @{acct} {lockedIcon}

{account.get('is_pro') && } {account.get('is_donor') && } {account.get('is_investor') && }
{ (account.get('note').length > 0 && account.get('note') !== '

') &&
} {(fields.size > 0 || identity_proofs.size > 0) && (
{identity_proofs.map((proof, i) => (
))} {fields.map((pair, i) => (
{pair.get('verified_at') && }
))}
)}
); } } const mapStateToProps = (state, { account }) => { const identity_proofs = account ? state.getIn(['identity_proofs', account.get('id')], ImmutableList()) : ImmutableList(); return { identity_proofs, domain: state.getIn(['meta', 'domain']), }; }; export default injectIntl( connect(mapStateToProps, null, null, { forwardRef: true, } )(ProfileInfoPanel))