2022-06-20 09:50:40 +00:00
|
|
|
import React, { Fragment } from 'react';
|
2021-07-13 06:50:08 +00:00
|
|
|
|
|
|
|
import { ReactionEmoji } from '../../../../reactions/components';
|
|
|
|
import { getReactionsQueue } from '../../../../reactions/functions.any';
|
2019-03-21 16:38:29 +00:00
|
|
|
import { connect } from '../../../redux';
|
2018-12-21 04:01:27 +00:00
|
|
|
import AbstractDialogContainer, {
|
|
|
|
abstractMapStateToProps
|
|
|
|
} from '../AbstractDialogContainer';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements a DialogContainer responsible for showing all dialogs. We will
|
|
|
|
* need a separate container so we can handle multiple dialogs by showing them
|
|
|
|
* simultaneously or queueing them.
|
|
|
|
*
|
2021-11-04 21:10:43 +00:00
|
|
|
* @augments AbstractDialogContainer
|
2018-12-21 04:01:27 +00:00
|
|
|
*/
|
|
|
|
class DialogContainer extends AbstractDialogContainer {
|
2021-07-13 06:50:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the reactions to be displayed.
|
|
|
|
*
|
|
|
|
* @returns {Array<React$Element>}
|
|
|
|
*/
|
|
|
|
_renderReactions() {
|
|
|
|
const { _reactionsQueue } = this.props;
|
|
|
|
|
|
|
|
return _reactionsQueue.map(({ reaction, uid }, index) => (<ReactionEmoji
|
|
|
|
index = { index }
|
|
|
|
key = { uid }
|
|
|
|
reaction = { reaction }
|
|
|
|
uid = { uid } />));
|
|
|
|
}
|
|
|
|
|
2018-12-21 04:01:27 +00:00
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
2022-06-20 09:50:40 +00:00
|
|
|
return (
|
|
|
|
<Fragment>
|
|
|
|
{this._renderReactions()}
|
|
|
|
{this._renderDialogContent()}
|
|
|
|
</Fragment>
|
|
|
|
);
|
2018-12-21 04:01:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-13 06:50:08 +00:00
|
|
|
const mapStateToProps = state => {
|
|
|
|
return {
|
|
|
|
...abstractMapStateToProps(state),
|
|
|
|
_reactionsQueue: getReactionsQueue(state)
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export default connect(mapStateToProps)(DialogContainer);
|