import classNames from 'classnames'; import React from 'react'; import { defineMessages, useIntl, FormattedMessage, FormatDateOptions } from 'react-intl'; import { Widget, Stack, Icon, Text } from 'soapbox/components/ui'; import BundleContainer from 'soapbox/features/ui/containers/bundle_container'; import { CryptoAddress } from 'soapbox/features/ui/util/async-components'; import type { Account, Field } from 'soapbox/types/entities'; const getTicker = (value: string): string => (value.match(/\$([a-zA-Z]*)/i) || [])[1]; const isTicker = (value: string): boolean => Boolean(getTicker(value)); 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.' }, deactivated: { id: 'account.deactivated', defaultMessage: 'Deactivated' }, bot: { id: 'account.badges.bot', defaultMessage: 'Bot' }, }); const dateFormatOptions: FormatDateOptions = { month: 'short', day: 'numeric', year: 'numeric', hour12: false, hour: '2-digit', minute: '2-digit', }; interface IProfileField { field: Field, } /** Renders a single profile field. */ const ProfileField: React.FC = ({ field }) => { const intl = useIntl(); if (isTicker(field.name)) { return ( {Component => ( )} ); } return (
{field.verified_at && ( )}
); }; interface IProfileFieldsPanel { account: Account, } /** Custom profile fields for sidebar. */ const ProfileFieldsPanel: React.FC = ({ account }) => { return ( }> {account.fields.map((field, i) => ( ))} ); }; export default ProfileFieldsPanel;