2020-02-21 00:57:29 +00:00
|
|
|
import ImmutablePureComponent from 'react-immutable-pure-component'
|
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes'
|
|
|
|
import { injectIntl, defineMessages } from 'react-intl'
|
|
|
|
import { me } from '../initial_state'
|
|
|
|
import ComposeFormContainer from '../features/compose/containers/compose_form_container'
|
2020-03-31 17:04:50 +01:00
|
|
|
import Avatar from './avatar'
|
2020-02-22 23:26:23 +00:00
|
|
|
import Block from './block'
|
2020-02-21 00:57:29 +00:00
|
|
|
import Heading from './heading'
|
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
createPost: { id: 'column_header.create_post', defaultMessage: 'Create Post' },
|
|
|
|
})
|
2019-08-13 16:54:29 +01:00
|
|
|
|
2020-04-11 23:29:19 +01:00
|
|
|
const mapStateToProps = (state) => ({
|
|
|
|
account: state.getIn(['accounts', me]),
|
|
|
|
})
|
2019-08-13 16:54:29 +01:00
|
|
|
|
2020-02-21 00:57:29 +00:00
|
|
|
export default
|
|
|
|
@connect(mapStateToProps)
|
|
|
|
@injectIntl
|
2019-08-13 16:54:29 +01:00
|
|
|
class TimelineComposeBlock extends ImmutablePureComponent {
|
|
|
|
|
|
|
|
static propTypes = {
|
2020-02-21 00:57:29 +00:00
|
|
|
intl: PropTypes.object.isRequired,
|
2019-08-13 16:54:29 +01:00
|
|
|
account: ImmutablePropTypes.map.isRequired,
|
|
|
|
size: PropTypes.number,
|
2020-03-07 04:53:28 +00:00
|
|
|
modal: PropTypes.bool,
|
2019-08-13 16:54:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static defaultProps = {
|
|
|
|
size: 32,
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2020-03-07 04:53:28 +00:00
|
|
|
const {
|
|
|
|
account,
|
|
|
|
size,
|
|
|
|
intl,
|
|
|
|
modal,
|
|
|
|
...rest
|
|
|
|
} = this.props
|
|
|
|
|
|
|
|
if (modal) {
|
|
|
|
return (
|
|
|
|
<section className={_s.default}>
|
|
|
|
<div className={[_s.default, _s.flexRow].join(' ')}>
|
|
|
|
<ComposeFormContainer {...rest} />
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
)
|
|
|
|
}
|
2019-08-13 16:54:29 +01:00
|
|
|
|
|
|
|
return (
|
2020-03-11 23:56:18 +00:00
|
|
|
<section className={[_s.default, _s.mb15].join(' ')}>
|
2020-02-22 23:26:23 +00:00
|
|
|
<Block>
|
2020-04-29 23:32:49 +01:00
|
|
|
<div className={[_s.default, _s.bgSubtle, _s.borderTop1PX, _s.borderBottom1PX, _s.borderColorSecondary, _s.px15, _s.py2, _s.alignItemsCenter, _s.flexRow].join(' ')}>
|
2020-03-31 17:04:50 +01:00
|
|
|
<div className={_s.mr10}>
|
2020-04-24 04:17:27 +01:00
|
|
|
<Avatar account={account} size={20} noHover />
|
2020-03-31 17:04:50 +01:00
|
|
|
</div>
|
2020-02-22 23:26:23 +00:00
|
|
|
<Heading size='h5'>
|
|
|
|
{intl.formatMessage(messages.createPost)}
|
|
|
|
</Heading>
|
2020-02-08 22:57:09 +00:00
|
|
|
</div>
|
2020-04-02 04:17:21 +01:00
|
|
|
<ComposeFormContainer {...rest} />
|
2020-02-22 23:26:23 +00:00
|
|
|
</Block>
|
2020-02-08 22:57:09 +00:00
|
|
|
</section>
|
2019-08-13 16:54:29 +01:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|