From d3908f107a722f4e1faa18dfd6c0cd8b698f886c Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 2 Oct 2021 15:39:12 -0500 Subject: [PATCH] AccountHeader: refactor Follow button, remove Message button in favor of a menu item This is better on mobile and simpler to newcomers --- app/soapbox/features/account/components/header.js | 14 ++++++-------- .../features/ui/components/action_button.js | 9 ++++++--- app/styles/components/buttons.scss | 12 ++++++++++++ 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/app/soapbox/features/account/components/header.js b/app/soapbox/features/account/components/header.js index de3e74a1d..2b8110d95 100644 --- a/app/soapbox/features/account/components/header.js +++ b/app/soapbox/features/account/components/header.js @@ -5,8 +5,6 @@ import { connect } from 'react-redux'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; -import Icon from 'soapbox/components/icon'; -import Button from 'soapbox/components/button'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { isStaff, @@ -35,6 +33,7 @@ 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.' }, mention: { id: 'account.mention', defaultMessage: 'Mention' }, + chat: { id: 'account.chat', defaultMessage: 'Chat with @{name}' }, direct: { id: 'account.direct', defaultMessage: 'Direct message @{name}' }, unmute: { id: 'account.unmute', defaultMessage: 'Unmute @{name}' }, block: { id: 'account.block', defaultMessage: 'Block @{name}' }, @@ -181,6 +180,11 @@ class Header extends ImmutablePureComponent { menu.push({ text: intl.formatMessage(messages.domain_blocks), to: '/domain_blocks' }); } else { menu.push({ text: intl.formatMessage(messages.mention, { name: account.get('username') }), action: this.props.onMention }); + + if (account.getIn(['pleroma', 'accepts_chat_messages'], false) === true) { + menu.push({ text: intl.formatMessage(messages.chat, { name: account.get('username') }), action: this.props.onChat }); + } + if (account.getIn(['relationship', 'following'])) { if (account.getIn(['relationship', 'showing_reblogs'])) { menu.push({ text: intl.formatMessage(messages.hideReblogs, { name: account.get('username') }), action: this.props.onReblogToggle }); @@ -355,12 +359,6 @@ class Header extends ImmutablePureComponent {
- {me && account.get('id') !== me && account.getIn(['pleroma', 'accepts_chat_messages'], false) === true && - - } {me && }
diff --git a/app/soapbox/features/ui/components/action_button.js b/app/soapbox/features/ui/components/action_button.js index 47dfb30b1..7161b2e7a 100644 --- a/app/soapbox/features/ui/components/action_button.js +++ b/app/soapbox/features/ui/components/action_button.js @@ -3,6 +3,7 @@ import { connect } from 'react-redux'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; +import Icon from 'soapbox/components/icon'; import Button from 'soapbox/components/button'; import ImmutablePureComponent from 'react-immutable-pure-component'; import classNames from 'classnames'; @@ -103,12 +104,14 @@ class ActionButton extends ImmutablePureComponent { // Follow & Unfollow return (); } else if (account.getIn(['relationship', 'blocking'])) { // Unblock return