import React, { ComponentType, useCallback, useRef } from 'react'; import { FormattedMessage as Message } from 'react-intl'; import { Link } from 'react-router-dom'; import { Helmet } from 'react-helmet-async'; import { ChangeLanguageLink } from 'app/components/languageSwitcher'; import { RelativeTime } from 'app/components/ui'; import { Button } from 'app/components/ui/form'; import { User } from 'app/components/user'; import RulesPage from 'app/pages/rules/RulesPage'; import ProfileField from './ProfileField'; import styles from './profile.scss'; import profileForm from './profileForm.scss'; type Props = { user: User; activeLocale: string; }; const Profile: ComponentType = ({ user, activeLocale }) => { const uuidRef = useRef(); const onUuidMouseOver = useCallback(() => { if (!uuidRef.current) { return; } try { const selection = window.getSelection(); if (!selection) { return; } const range = document.createRange(); range.selectNodeContents(uuidRef.current); selection.removeAllRanges(); selection.addRange(range); } catch (err) { // the browser does not support an API } }, []); return (
{(pageTitle: string) => (

{pageTitle}

)}

} value={user.username} warningMessage={ user.hasMojangUsernameCollision ? ( ), }} /> ) : ( '' ) } /> } value={user.email} /> } value={} warningMessage={ user.lang === activeLocale ? ( '' ) : ( ), }} /> ) } /> } value={ (uuidRef.current = ref!)} onMouseOver={onUuidMouseOver} > {user.uuid} } />

} value={ , }} /> } /> } value={ user.isOtpEnabled ? ( ) : ( ) } /> } />
); }; export default Profile;