diff options
Diffstat (limited to 'app/javascript/flavours/glitch/features/account')
-rw-r--r-- | app/javascript/flavours/glitch/features/account/components/account_note.jsx (renamed from app/javascript/flavours/glitch/features/account/components/account_note.js) | 11 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/account/components/action_bar.jsx (renamed from app/javascript/flavours/glitch/features/account/components/action_bar.js) | 7 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/account/components/featured_tags.jsx (renamed from app/javascript/flavours/glitch/features/account/components/featured_tags.js) | 3 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/account/components/follow_request_note.jsx (renamed from app/javascript/flavours/glitch/features/account/components/follow_request_note.js) | 0 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/account/components/header.jsx (renamed from app/javascript/flavours/glitch/features/account/components/header.js) | 28 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/account/components/profile_column_header.jsx (renamed from app/javascript/flavours/glitch/features/account/components/profile_column_header.js) | 3 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/account/navigation.jsx (renamed from app/javascript/flavours/glitch/features/account/navigation.js) | 3 |
7 files changed, 34 insertions, 21 deletions
diff --git a/app/javascript/flavours/glitch/features/account/components/account_note.js b/app/javascript/flavours/glitch/features/account/components/account_note.jsx index 6e5ed7703..8ab00f6d4 100644 --- a/app/javascript/flavours/glitch/features/account/components/account_note.js +++ b/app/javascript/flavours/glitch/features/account/components/account_note.jsx @@ -10,7 +10,6 @@ const messages = defineMessages({ placeholder: { id: 'account_note.glitch_placeholder', defaultMessage: 'No comment provided' }, }); -export default @injectIntl class Header extends ImmutablePureComponent { static propTypes = { @@ -41,7 +40,7 @@ class Header extends ImmutablePureComponent { } else if (e.keyCode === 27) { this.props.onCancelAccountNote(); } - } + }; render () { const { account, accountNote, isEditing, isSubmitting, intl } = this.props; @@ -54,11 +53,11 @@ class Header extends ImmutablePureComponent { if (isEditing) { action_buttons = ( <div className='account__header__account-note__buttons'> - <button className='icon-button' tabIndex='0' onClick={this.props.onCancelAccountNote} disabled={isSubmitting}> + <button className='icon-button' tabIndex={0} onClick={this.props.onCancelAccountNote} disabled={isSubmitting}> <Icon id='times' size={15} /> <FormattedMessage id='account_note.cancel' defaultMessage='Cancel' /> </button> <div className='flex-spacer' /> - <button className='icon-button' tabIndex='0' onClick={this.props.onSaveAccountNote} disabled={isSubmitting}> + <button className='icon-button' tabIndex={0} onClick={this.props.onSaveAccountNote} disabled={isSubmitting}> <Icon id='check' size={15} /> <FormattedMessage id='account_note.save' defaultMessage='Save' /> </button> </div> @@ -66,7 +65,7 @@ class Header extends ImmutablePureComponent { } else { action_buttons = ( <div className='account__header__account-note__buttons'> - <button className='icon-button' tabIndex='0' onClick={this.props.onEditAccountNote} disabled={isSubmitting}> + <button className='icon-button' tabIndex={0} onClick={this.props.onEditAccountNote} disabled={isSubmitting}> <Icon id='pencil' size={15} /> <FormattedMessage id='account_note.edit' defaultMessage='Edit' /> </button> </div> @@ -102,3 +101,5 @@ class Header extends ImmutablePureComponent { } } + +export default injectIntl(Header); diff --git a/app/javascript/flavours/glitch/features/account/components/action_bar.js b/app/javascript/flavours/glitch/features/account/components/action_bar.jsx index ce0584124..e32bc0141 100644 --- a/app/javascript/flavours/glitch/features/account/components/action_bar.js +++ b/app/javascript/flavours/glitch/features/account/components/action_bar.jsx @@ -8,7 +8,6 @@ import { me, isStaff } from 'flavours/glitch/initial_state'; import { profileLink, accountAdminLink } from 'flavours/glitch/utils/backend_links'; import Icon from 'flavours/glitch/components/icon'; -export default @injectIntl class ActionBar extends React.PureComponent { static propTypes = { @@ -21,7 +20,7 @@ class ActionBar extends React.PureComponent { return false; } return !location.pathname.match(/\/(followers|following)\/?$/); - } + }; render () { const { account, intl } = this.props; @@ -32,7 +31,7 @@ class ActionBar extends React.PureComponent { <div className='account__disclaimer'> <Icon id='info-circle' fixedWidth /> <FormattedMessage id='account.suspended_disclaimer_full' - defaultMessage="This user has been suspended by a moderator." + defaultMessage='This user has been suspended by a moderator.' /> </div> </div> @@ -83,3 +82,5 @@ class ActionBar extends React.PureComponent { } } + +export default injectIntl(ActionBar); diff --git a/app/javascript/flavours/glitch/features/account/components/featured_tags.js b/app/javascript/flavours/glitch/features/account/components/featured_tags.jsx index d646b08b2..42e0a8d2f 100644 --- a/app/javascript/flavours/glitch/features/account/components/featured_tags.js +++ b/app/javascript/flavours/glitch/features/account/components/featured_tags.jsx @@ -10,7 +10,6 @@ const messages = defineMessages({ empty: { id: 'account.featured_tags.last_status_never', defaultMessage: 'No posts' }, }); -export default @injectIntl class FeaturedTags extends ImmutablePureComponent { static contextTypes = { @@ -51,3 +50,5 @@ class FeaturedTags extends ImmutablePureComponent { } } + +export default injectIntl(FeaturedTags); diff --git a/app/javascript/flavours/glitch/features/account/components/follow_request_note.js b/app/javascript/flavours/glitch/features/account/components/follow_request_note.jsx index 73c1737a6..73c1737a6 100644 --- a/app/javascript/flavours/glitch/features/account/components/follow_request_note.js +++ b/app/javascript/flavours/glitch/features/account/components/follow_request_note.jsx diff --git a/app/javascript/flavours/glitch/features/account/components/header.js b/app/javascript/flavours/glitch/features/account/components/header.jsx index ec4a192bc..6f918abcf 100644 --- a/app/javascript/flavours/glitch/features/account/components/header.js +++ b/app/javascript/flavours/glitch/features/account/components/header.jsx @@ -45,6 +45,7 @@ const messages = defineMessages({ follow_requests: { id: 'navigation_bar.follow_requests', defaultMessage: 'Follow requests' }, favourites: { id: 'navigation_bar.favourites', defaultMessage: 'Favourites' }, lists: { id: 'navigation_bar.lists', defaultMessage: 'Lists' }, + followed_tags: { id: 'navigation_bar.followed_tags', defaultMessage: 'Followed hashtags' }, blocks: { id: 'navigation_bar.blocks', defaultMessage: 'Blocked users' }, domain_blocks: { id: 'navigation_bar.domain_blocks', defaultMessage: 'Blocked domains' }, mutes: { id: 'navigation_bar.mutes', defaultMessage: 'Muted users' }, @@ -75,7 +76,6 @@ const dateFormatOptions = { minute: '2-digit', }; -export default @injectIntl class Header extends ImmutablePureComponent { static contextTypes = { @@ -108,7 +108,7 @@ class Header extends ImmutablePureComponent { openEditProfile = () => { window.open(profileLink, '_blank'); - } + }; handleMouseEnter = ({ currentTarget }) => { if (autoPlayGif) { @@ -121,7 +121,7 @@ class Header extends ImmutablePureComponent { let emoji = emojis[i]; emoji.src = emoji.getAttribute('data-original'); } - } + }; handleMouseLeave = ({ currentTarget }) => { if (autoPlayGif) { @@ -134,14 +134,14 @@ class Header extends ImmutablePureComponent { let emoji = emojis[i]; emoji.src = emoji.getAttribute('data-static'); } - } + }; handleAvatarClick = e => { if (e.button === 0 && !(e.ctrlKey || e.metaKey)) { e.preventDefault(); this.props.onOpenAvatar(); } - } + }; handleShare = () => { const { account } = this.props; @@ -152,7 +152,7 @@ class Header extends ImmutablePureComponent { }).catch((e) => { if (e.name !== 'AbortError') console.error(e); }); - } + }; render () { const { account, hidden, intl, domain } = this.props; @@ -176,8 +176,7 @@ class Header extends ImmutablePureComponent { if (me !== account.get('id') && account.getIn(['relationship', 'followed_by'])) { info.push(<span className='relationship-tag'><FormattedMessage id='account.follows_you' defaultMessage='Follows you' /></span>); - } - else if (me !== account.get('id') && account.getIn(['relationship', 'blocking'])) { + } else if (me !== account.get('id') && account.getIn(['relationship', 'blocking'])) { info.push(<span className='relationship-tag'><FormattedMessage id='account.blocked' defaultMessage='Blocked' /></span>); } @@ -188,7 +187,7 @@ class Header extends ImmutablePureComponent { } if (account.getIn(['relationship', 'requested']) || account.getIn(['relationship', 'following'])) { - bellBtn = <IconButton icon='bell-o' size={24} active={account.getIn(['relationship', 'notifying'])} title={intl.formatMessage(account.getIn(['relationship', 'notifying']) ? messages.disableNotifications : messages.enableNotifications, { name: account.get('username') })} onClick={this.props.onNotifyToggle} />; + bellBtn = <IconButton icon={account.getIn(['relationship', 'notifying']) ? 'bell' : 'bell-o'} size={24} active={account.getIn(['relationship', 'notifying'])} title={intl.formatMessage(account.getIn(['relationship', 'notifying']) ? messages.disableNotifications : messages.enableNotifications, { name: account.get('username') })} onClick={this.props.onNotifyToggle} />; } if (me !== account.get('id')) { @@ -245,6 +244,7 @@ class Header extends ImmutablePureComponent { menu.push({ text: intl.formatMessage(messages.follow_requests), to: '/follow_requests' }); menu.push({ text: intl.formatMessage(messages.favourites), to: '/favourites' }); menu.push({ text: intl.formatMessage(messages.lists), to: '/lists' }); + menu.push({ text: intl.formatMessage(messages.followed_tags), to: '/followed_tags' }); menu.push(null); menu.push({ text: intl.formatMessage(messages.mutes), to: '/mutes' }); menu.push({ text: intl.formatMessage(messages.blocks), to: '/blocks' }); @@ -319,6 +319,11 @@ class Header extends ImmutablePureComponent { badge = null; } + let role = null; + if (account.getIn(['roles', 0])) { + role = (<div key='role' className={`account-role user-role-${account.getIn(['roles', 0, 'id'])}`}>{account.getIn(['roles', 0, 'name'])}</div>); + } + return ( <div className={classNames('account__header', { inactive: !!account.get('moved') })} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave}> {!(suspended || hidden || account.get('moved')) && account.getIn(['relationship', 'requested_by']) && <FollowRequestNoteContainer account={account} />} @@ -335,6 +340,7 @@ class Header extends ImmutablePureComponent { <div className='account__header__tabs'> <a className='avatar' href={account.get('avatar')} rel='noopener noreferrer' target='_blank' onClick={this.handleAvatarClick}> <Avatar account={suspended || hidden ? undefined : account} size={90} /> + {role} </a> {!suspended && ( @@ -370,7 +376,7 @@ class Header extends ImmutablePureComponent { {fields.map((pair, i) => ( <dl key={i}> <dt dangerouslySetInnerHTML={{ __html: pair.get('name_emojified') }} title={pair.get('name')} /> - + <dd className={pair.get('verified_at') && 'verified'} title={pair.get('value_plain')}> {pair.get('verified_at') && <span title={intl.formatMessage(messages.linkVerifiedOn, { date: intl.formatDate(pair.get('verified_at'), dateFormatOptions) })}><Icon id='check' className='verified__mark' /></span>} <span dangerouslySetInnerHTML={{ __html: pair.get('value_emojified') }} className='translate' /> </dd> @@ -396,3 +402,5 @@ class Header extends ImmutablePureComponent { } } + +export default injectIntl(Header); diff --git a/app/javascript/flavours/glitch/features/account/components/profile_column_header.js b/app/javascript/flavours/glitch/features/account/components/profile_column_header.jsx index 17c08e375..62a459fff 100644 --- a/app/javascript/flavours/glitch/features/account/components/profile_column_header.js +++ b/app/javascript/flavours/glitch/features/account/components/profile_column_header.jsx @@ -7,7 +7,6 @@ const messages = defineMessages({ profile: { id: 'column_header.profile', defaultMessage: 'Profile' }, }); -export default @injectIntl class ProfileColumnHeader extends React.PureComponent { static propTypes = { @@ -31,3 +30,5 @@ class ProfileColumnHeader extends React.PureComponent { } } + +export default injectIntl(ProfileColumnHeader); diff --git a/app/javascript/flavours/glitch/features/account/navigation.js b/app/javascript/flavours/glitch/features/account/navigation.jsx index edae38ce5..b8b8e54de 100644 --- a/app/javascript/flavours/glitch/features/account/navigation.js +++ b/app/javascript/flavours/glitch/features/account/navigation.jsx @@ -19,7 +19,6 @@ const mapStateToProps = (state, { match: { params: { acct } } }) => { }; }; -export default @connect(mapStateToProps) class AccountNavigation extends React.PureComponent { static propTypes = { @@ -50,3 +49,5 @@ class AccountNavigation extends React.PureComponent { } } + +export default connect(mapStateToProps)(AccountNavigation); |