From 3280176914f6be64dc081bdd8f6f4417e7e8fdb1 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 13 Oct 2021 13:23:07 -0500 Subject: [PATCH] Add Chat/DM button back to AccountHeader --- .../features/account/components/header.js | 22 ++++++++++++++++++- app/styles/components/account-header.scss | 12 ++++++++-- app/styles/ui.scss | 2 +- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/app/soapbox/features/account/components/header.js b/app/soapbox/features/account/components/header.js index 4904b7e77..a8c173e94 100644 --- a/app/soapbox/features/account/components/header.js +++ b/app/soapbox/features/account/components/header.js @@ -5,6 +5,7 @@ import { connect } from 'react-redux'; import ImmutablePropTypes from 'react-immutable-proptypes'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; +import IconButton from 'soapbox/components/icon_button'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { isStaff, @@ -185,6 +186,8 @@ class Header extends ImmutablePureComponent { if (account.getIn(['pleroma', 'accepts_chat_messages'], false) === true) { menu.push({ text: intl.formatMessage(messages.chat, { name: account.get('username') }), action: this.props.onChat }); + } else { + menu.push({ text: intl.formatMessage(messages.direct, { name: account.get('username') }), action: this.props.onDirect }); } if (account.getIn(['relationship', 'following'])) { @@ -296,6 +299,22 @@ class Header extends ImmutablePureComponent { return info; } + renderMessageButton() { + const { account, me } = this.props; + + if (!me || !account || account.get('id') === me) { + return null; + } + + const canChat = account.getIn(['pleroma', 'accepts_chat_messages'], false) === true; + + if (canChat) { + return ; + } else { + return ; + } + } + render() { const { account, intl, username, me, features } = this.props; const { isSmallScreen } = this.state; @@ -395,8 +414,9 @@ class Header extends ImmutablePureComponent { )}
+ {me && } + {this.renderMessageButton()} - {me && }
diff --git a/app/styles/components/account-header.scss b/app/styles/components/account-header.scss index ce35cf302..401e3fcc5 100644 --- a/app/styles/components/account-header.scss +++ b/app/styles/components/account-header.scss @@ -196,10 +196,15 @@ margin-left: auto; .icon-button { - border: 1px solid var(--brand-color--med); + border: 1px solid var(--primary-text-color--faint); border-radius: 999px; box-sizing: content-box; padding: 7px; + opacity: 0.6; + + &:hover { + opacity: 1; + } .svg-icon { width: 20px; @@ -207,7 +212,10 @@ } } - .button { margin-right: 10px; } + .button, + .icon-button { + margin-left: 10px; + } .button-active { border-color: #008000; diff --git a/app/styles/ui.scss b/app/styles/ui.scss index 2f68412bf..5585134e0 100644 --- a/app/styles/ui.scss +++ b/app/styles/ui.scss @@ -6,7 +6,7 @@ border: 0; background: transparent; cursor: pointer; - transition: color 100ms ease-in; + transition: 100ms ease-in; opacity: 0.4; i.fa {