Files
jitsi-meet/react/features/reactions/components/web/ReactionEmoji.js
robertpin 601ee219e7 feat(reactions) Added Reactions (#9465)
* Created desktop reactions menu

Moved raise hand functionality to reactions menu

* Added reactions to chat

* Added animations

* Added reactions to the web mobile version

Redesigned the overflow menu. Added the reactions menu and reactions animations

* Make toolbar visible on animation start

* Bug fix

* Cleanup

* Fixed overflow menu desktop

* Revert mobile menu changes

* Removed unused CSS

* Fixed iOS safari issue

* Fixed overflow issue on mobile

* Added keyboard shortcuts for reactions

* Disabled double tap zoom on reaction buttons

* Refactored actions

* Updated option symbol for keyboard shortcuts

* Actions refactor

* Refactor

* Fixed linting errors

* Updated BottomSheet

* Added reactions on native

* Code cleanup

* Code review refactor

* Color fix

* Hide reactions on one participant

* Removed console log

* Lang fix

* Update schortcuts
2021-07-13 09:50:08 +03:00

97 lines
1.8 KiB
JavaScript

// @flow
import React, { Component } from 'react';
import { connect } from '../../../base/redux';
import { removeReaction } from '../../actions.any';
import { REACTIONS } from '../../constants';
type Props = {
/**
* Reaction to be displayed.
*/
reaction: string,
/**
* Id of the reaction.
*/
uid: Number,
/**
* Removes reaction from redux state.
*/
removeReaction: Function,
/**
* Index of the reaction in the queue.
*/
index: number
};
type State = {
/**
* Index of CSS animation. Number between 0-20.
*/
index: number
}
/**
* Used to display animated reactions.
*
* @returns {ReactElement}
*/
class ReactionEmoji extends Component<Props, State> {
/**
* Initializes a new {@code ReactionEmoji} instance.
*
* @param {Props} props - The read-only React {@code Component} props with
* which the new instance is to be initialized.
*/
constructor(props: Props) {
super(props);
this.state = {
index: props.index % 21
};
}
/**
* Implements React Component's componentDidMount.
*
* @inheritdoc
*/
componentDidMount() {
setTimeout(() => this.props.removeReaction(this.props.uid), 5000);
}
/**
* Implements React's {@link Component#render}.
*
* @inheritdoc
*/
render() {
const { reaction, uid } = this.props;
const { index } = this.state;
return (
<div
className = { `reaction-emoji reaction-${index}` }
id = { uid }>
{ REACTIONS[reaction].emoji }
</div>
);
}
}
const mapDispatchToProps = {
removeReaction
};
export default connect(
null,
mapDispatchToProps,
)(ReactionEmoji);