|
|
|
@ -17,8 +17,8 @@ export default class StatusReactions extends ImmutablePureComponent {
|
|
|
|
|
reactions: ImmutablePropTypes.list.isRequired,
|
|
|
|
|
numVisible: PropTypes.number,
|
|
|
|
|
addReaction: PropTypes.func.isRequired,
|
|
|
|
|
canReact: PropTypes.bool.isRequired,
|
|
|
|
|
removeReaction: PropTypes.func.isRequired,
|
|
|
|
|
emojiMap: ImmutablePropTypes.map.isRequired,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
willEnter() {
|
|
|
|
@ -57,7 +57,7 @@ export default class StatusReactions extends ImmutablePureComponent {
|
|
|
|
|
style={{ transform: `scale(${style.scale})`, position: style.scale < 0.5 ? 'absolute' : 'static' }}
|
|
|
|
|
addReaction={this.props.addReaction}
|
|
|
|
|
removeReaction={this.props.removeReaction}
|
|
|
|
|
emojiMap={this.props.emojiMap}
|
|
|
|
|
canReact={this.props.canReact}
|
|
|
|
|
/>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
@ -75,7 +75,7 @@ class Reaction extends ImmutablePureComponent {
|
|
|
|
|
reaction: ImmutablePropTypes.map.isRequired,
|
|
|
|
|
addReaction: PropTypes.func.isRequired,
|
|
|
|
|
removeReaction: PropTypes.func.isRequired,
|
|
|
|
|
emojiMap: ImmutablePropTypes.map.isRequired,
|
|
|
|
|
canReact: PropTypes.bool.isRequired,
|
|
|
|
|
style: PropTypes.object,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -85,14 +85,11 @@ class Reaction extends ImmutablePureComponent {
|
|
|
|
|
|
|
|
|
|
handleClick = () => {
|
|
|
|
|
const { reaction, statusId, addReaction, removeReaction } = this.props;
|
|
|
|
|
const { signedIn } = this.context.identity;
|
|
|
|
|
|
|
|
|
|
if (signedIn) {
|
|
|
|
|
if (reaction.get('me')) {
|
|
|
|
|
removeReaction(statusId, reaction.get('name'));
|
|
|
|
|
} else {
|
|
|
|
|
addReaction(statusId, reaction.get('name'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (reaction.get('me')) {
|
|
|
|
|
removeReaction(statusId, reaction.get('name'));
|
|
|
|
|
} else {
|
|
|
|
|
addReaction(statusId, reaction.get('name'));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -109,10 +106,16 @@ class Reaction extends ImmutablePureComponent {
|
|
|
|
|
onClick={this.handleClick}
|
|
|
|
|
onMouseEnter={this.handleMouseEnter}
|
|
|
|
|
onMouseLeave={this.handleMouseLeave}
|
|
|
|
|
disabled={!this.props.canReact}
|
|
|
|
|
style={this.props.style}
|
|
|
|
|
>
|
|
|
|
|
<span className='reactions-bar__item__emoji'>
|
|
|
|
|
<Emoji hovered={this.state.hovered} emoji={reaction.get('name')} emojiMap={this.props.emojiMap} />
|
|
|
|
|
<Emoji
|
|
|
|
|
hovered={this.state.hovered}
|
|
|
|
|
emoji={reaction.get('name')}
|
|
|
|
|
url={reaction.get('url')}
|
|
|
|
|
staticUrl={reaction.get('static_url')}
|
|
|
|
|
/>
|
|
|
|
|
</span>
|
|
|
|
|
<span className='reactions-bar__item__count'>
|
|
|
|
|
<AnimatedNumber value={reaction.get('count')} />
|
|
|
|
@ -127,12 +130,13 @@ class Emoji extends React.PureComponent {
|
|
|
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
|
emoji: PropTypes.string.isRequired,
|
|
|
|
|
emojiMap: ImmutablePropTypes.map.isRequired,
|
|
|
|
|
hovered: PropTypes.bool.isRequired,
|
|
|
|
|
url: PropTypes.string,
|
|
|
|
|
staticUrl: PropTypes.string,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
const { emoji, emojiMap, hovered } = this.props;
|
|
|
|
|
const { emoji, hovered, url, staticUrl } = this.props;
|
|
|
|
|
|
|
|
|
|
if (unicodeMapping[emoji]) {
|
|
|
|
|
const { filename, shortCode } = unicodeMapping[this.props.emoji];
|
|
|
|
@ -147,10 +151,8 @@ class Emoji extends React.PureComponent {
|
|
|
|
|
src={`${assetHost}/emoji/${filename}.svg`}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
} else if (emojiMap.get(emoji)) {
|
|
|
|
|
const filename = (autoPlayGif || hovered)
|
|
|
|
|
? emojiMap.getIn([emoji, 'url'])
|
|
|
|
|
: emojiMap.getIn([emoji, 'static_url']);
|
|
|
|
|
} else {
|
|
|
|
|
const filename = (autoPlayGif || hovered) ? url : staticUrl;
|
|
|
|
|
const shortCode = `:${emoji}:`;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
@ -162,8 +164,6 @@ class Emoji extends React.PureComponent {
|
|
|
|
|
src={filename}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|