gab-social/app/javascript/gabsocial/pages/messages_page.js

50 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-11-15 18:48:32 +00:00
import React from 'react'
import PropTypes from 'prop-types'
2020-12-03 22:13:11 +00:00
import { connect } from 'react-redux'
import isObject from 'lodash.isobject'
import { setChatConversationSelected } from '../actions/chats'
2020-11-15 18:48:32 +00:00
import PageTitle from '../features/ui/util/page_title'
import MessagesLayout from '../layouts/messages_layout'
class MessagesPage extends React.PureComponent {
2020-12-03 22:13:11 +00:00
componentDidMount() {
if (isObject(this.props.params)) {
const { chatConversationId } = this.props.params
if (chatConversationId) {
this.props.dispatch(setChatConversationSelected(chatConversationId))
}
}
}
2020-11-15 18:48:32 +00:00
render() {
const {
children,
isSettings,
source,
} = this.props
2020-11-15 18:48:32 +00:00
return (
<MessagesLayout
showBackBtn
isSettings={isSettings}
title='Chats'
source={source}
2020-11-15 18:48:32 +00:00
>
<PageTitle path='Chats' />
{children}
2020-11-15 18:48:32 +00:00
</MessagesLayout>
)
}
}
MessagesPage.propTypes = {
children: PropTypes.node.isRequired,
isSettings: PropTypes.func,
source: PropTypes.string,
2020-11-15 18:48:32 +00:00
}
2020-12-03 22:13:11 +00:00
export default connect()(MessagesPage)