import { useCallback, useId, useRef, useState } from 'react'; import type { FC } from 'react'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; import classNames from 'classnames'; import Overlay from 'react-overlays/esm/Overlay'; import { useAccount } from '@/mastodon/hooks/useAccount'; import { useRelationship } from '@/mastodon/hooks/useRelationship'; import { useAppSelector } from '@/mastodon/store'; import AtIcon from '@/material-icons/400-24px/alternate_email.svg?react'; import ContentCopyIcon from '@/material-icons/400-24px/content_copy.svg?react'; import HelpIcon from '@/material-icons/400-24px/help.svg?react'; import DomainIcon from '@/material-icons/400-24px/language.svg?react'; import { FollowsYouBadge } from '../badge'; import { CopyButton } from '../copy_button'; import { DisplayName } from '../display_name'; import { Icon } from '../icon'; import { NavigationFocusTarget } from '../navigation_focus_target'; import { AccountBadges } from './badges'; import classes from './styles.module.scss'; const messages = defineMessages({ lockedInfo: { id: 'account.locked_info', defaultMessage: 'This account privacy status is set to locked. The owner manually reviews who can follow them.', }, nameInfo: { id: 'account.name_info', defaultMessage: 'What does this mean?', }, copied: { id: 'copy_icon_button.copied', defaultMessage: 'Copied to clipboard', }, }); export const AccountName: FC<{ accountId: string }> = ({ accountId }) => { const account = useAccount(accountId); const me = useAppSelector((state) => state.meta.get('me') as string); const localDomain = useAppSelector( (state) => state.meta.get('domain') as string, ); const relationship = useRelationship(accountId); if (!account) { return null; } const [username = '', domain = localDomain] = account.acct.split('@'); return (