import React from 'react'; import { connect } from 'react-redux'; import { FormattedMessage as Message } from 'react-intl'; import { Link } from 'react-router-dom'; import Helmet from 'react-helmet'; import { ChangeLanguageLink } from 'app/components/languageSwitcher'; import { RelativeTime } from 'app/components/ui'; import { User } from 'app/components/user'; import RulesPage from 'app/pages/rules/RulesPage'; import { RootState } from 'app/reducers'; import ProfileField from './ProfileField'; import styles from './profile.scss'; import profileForm from './profileForm.scss'; import messages from './Profile.intl.json'; type Props = { user: User; interfaceLocale: string; }; class Profile extends React.PureComponent { UUID: HTMLElement | null; render() { const { user, interfaceLocale } = this.props; return (
{(pageTitle: string) => (

{pageTitle}

)}

} value={user.username} warningMessage={ user.hasMojangUsernameCollision ? ( ), }} /> ) : ( '' ) } /> } value={user.email} /> } value={ ), }} /> } /> } value={} warningMessage={ user.lang === interfaceLocale ? ( '' ) : ( ), }} /> ) } /> } value={ user.isOtpEnabled ? ( ) : ( ) } /> } value={ {user.uuid} } />
); } handleUUIDMouseOver() { if (!this.UUID) { return; } const el = this.UUID; try { const selection = window.getSelection(); if (!selection) { return; } const range = document.createRange(); range.selectNodeContents(el); selection.removeAllRanges(); selection.addRange(range); } catch (err) { // the browser does not support an API } } setUUID(el: HTMLElement | null) { this.UUID = el; } } export default connect(({ user, i18n }: RootState) => ({ user, interfaceLocale: i18n.locale, }))(Profile);