kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Show 'Follows you' in profile directory
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>strip-front-mentions
rodzic
52dabed829
commit
988552e29b
|
@ -52,6 +52,7 @@ export const ProfileHoverCard = ({ visible }) => {
|
||||||
|
|
||||||
const [popperElement, setPopperElement] = useState(null);
|
const [popperElement, setPopperElement] = useState(null);
|
||||||
|
|
||||||
|
const me = useSelector(state => state.get('me'));
|
||||||
const accountId = useSelector(state => state.getIn(['profile_hover_card', 'accountId']));
|
const accountId = useSelector(state => state.getIn(['profile_hover_card', 'accountId']));
|
||||||
const account = useSelector(state => accountId && getAccount(state, accountId));
|
const account = useSelector(state => accountId && getAccount(state, accountId));
|
||||||
const targetRef = useSelector(state => state.getIn(['profile_hover_card', 'ref', 'current']));
|
const targetRef = useSelector(state => state.getIn(['profile_hover_card', 'ref', 'current']));
|
||||||
|
@ -65,7 +66,7 @@ export const ProfileHoverCard = ({ visible }) => {
|
||||||
|
|
||||||
if (!account) return null;
|
if (!account) return null;
|
||||||
const accountBio = { __html: account.get('note_emojified') };
|
const accountBio = { __html: account.get('note_emojified') };
|
||||||
const followedBy = account.getIn(['relationship', 'followed_by']);
|
const followedBy = me !== account.get('id') && account.getIn(['relationship', 'followed_by']);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames('profile-hover-card', { 'profile-hover-card--visible': visible })} ref={setPopperElement} style={styles.popper} {...attributes.popper} onMouseEnter={handleMouseEnter(dispatch)} onMouseLeave={handleMouseLeave(dispatch)}>
|
<div className={classNames('profile-hover-card', { 'profile-hover-card--visible': visible })} ref={setPopperElement} style={styles.popper} {...attributes.popper} onMouseEnter={handleMouseEnter(dispatch)} onMouseLeave={handleMouseLeave(dispatch)}>
|
||||||
|
|
|
@ -2,6 +2,7 @@ import React from 'react';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import SoapboxPropTypes from 'soapbox/utils/soapbox_prop_types';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { makeGetAccount } from 'soapbox/selectors';
|
import { makeGetAccount } from 'soapbox/selectors';
|
||||||
|
@ -18,6 +19,7 @@ const makeMapStateToProps = () => {
|
||||||
const getAccount = makeGetAccount();
|
const getAccount = makeGetAccount();
|
||||||
|
|
||||||
const mapStateToProps = (state, { id }) => ({
|
const mapStateToProps = (state, { id }) => ({
|
||||||
|
me: state.get('me'),
|
||||||
account: getAccount(state, id),
|
account: getAccount(state, id),
|
||||||
autoPlayGif: getSettings(state).get('autoPlayGif'),
|
autoPlayGif: getSettings(state).get('autoPlayGif'),
|
||||||
});
|
});
|
||||||
|
@ -30,15 +32,24 @@ export default @injectIntl
|
||||||
class AccountCard extends ImmutablePureComponent {
|
class AccountCard extends ImmutablePureComponent {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
me: SoapboxPropTypes.me,
|
||||||
account: ImmutablePropTypes.map.isRequired,
|
account: ImmutablePropTypes.map.isRequired,
|
||||||
autoPlayGif: PropTypes.bool,
|
autoPlayGif: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { account, autoPlayGif } = this.props;
|
const { account, autoPlayGif, me } = this.props;
|
||||||
|
|
||||||
|
const followedBy = me !== account.get('id') && account.getIn(['relationship', 'followed_by']);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='directory__card'>
|
<div className='directory__card'>
|
||||||
|
{followedBy &&
|
||||||
|
<div className='directory__card__info'>
|
||||||
|
<span className='relationship-tag'>
|
||||||
|
<FormattedMessage id='account.follows_you' defaultMessage='Follows you' />
|
||||||
|
</span>
|
||||||
|
</div>}
|
||||||
<div className='directory__card__action-button'>
|
<div className='directory__card__action-button'>
|
||||||
<ActionButton account={account} small />
|
<ActionButton account={account} small />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -39,6 +39,13 @@
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
|
&__info {
|
||||||
|
z-index: 1;
|
||||||
|
position: absolute;
|
||||||
|
top: 10px;
|
||||||
|
left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
&__action-button {
|
&__action-button {
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
Ładowanie…
Reference in New Issue