|
|
@ -4,14 +4,22 @@ import PropTypes from 'prop-types';
|
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
|
|
import { injectIntl } from 'react-intl';
|
|
|
|
import { injectIntl } from 'react-intl';
|
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
|
|
|
|
|
|
|
import Avatar from 'soapbox/components/avatar';
|
|
|
|
|
|
|
|
import { acctFull } from 'soapbox/utils/accounts';
|
|
|
|
import { fetchChat } from 'soapbox/actions/chats';
|
|
|
|
import { fetchChat } from 'soapbox/actions/chats';
|
|
|
|
import ChatBox from './components/chat_box';
|
|
|
|
import ChatBox from './components/chat_box';
|
|
|
|
import Column from 'soapbox/features/ui/components/column';
|
|
|
|
import Column from 'soapbox/components/column';
|
|
|
|
|
|
|
|
import ColumnBackButton from 'soapbox/components/column_back_button';
|
|
|
|
|
|
|
|
import { makeGetChat } from 'soapbox/selectors';
|
|
|
|
|
|
|
|
|
|
|
|
const mapStateToProps = (state, { params }) => ({
|
|
|
|
const mapStateToProps = (state, { params }) => {
|
|
|
|
me: state.get('me'),
|
|
|
|
const getChat = makeGetChat();
|
|
|
|
chat: state.getIn(['chats', params.chatId]),
|
|
|
|
|
|
|
|
});
|
|
|
|
return {
|
|
|
|
|
|
|
|
me: state.get('me'),
|
|
|
|
|
|
|
|
chat: getChat(state, { id: params.chatId }),
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export default @connect(mapStateToProps)
|
|
|
|
export default @connect(mapStateToProps)
|
|
|
|
@injectIntl
|
|
|
|
@injectIntl
|
|
|
@ -42,9 +50,19 @@ class ChatRoom extends ImmutablePureComponent {
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
const { chat } = this.props;
|
|
|
|
const { chat } = this.props;
|
|
|
|
if (!chat) return null;
|
|
|
|
if (!chat) return null;
|
|
|
|
|
|
|
|
const account = chat.get('account');
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<Column>
|
|
|
|
<Column>
|
|
|
|
|
|
|
|
<div className='chatroom__back'>
|
|
|
|
|
|
|
|
<ColumnBackButton />
|
|
|
|
|
|
|
|
<div className='chatroom__header'>
|
|
|
|
|
|
|
|
<Avatar account={account} size={18} />
|
|
|
|
|
|
|
|
<div className='chatroom__title'>
|
|
|
|
|
|
|
|
@{acctFull(account)}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<ChatBox
|
|
|
|
<ChatBox
|
|
|
|
chatId={chat.get('id')}
|
|
|
|
chatId={chat.get('id')}
|
|
|
|
onSetInputRef={this.handleInputRef}
|
|
|
|
onSetInputRef={this.handleInputRef}
|
|
|
|