2020-08-17 21:07:16 +01:00
|
|
|
import React from 'react'
|
2020-08-17 21:59:29 +01:00
|
|
|
import PropTypes from 'prop-types'
|
2020-08-17 21:39:25 +01:00
|
|
|
import { connect } from 'react-redux'
|
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'
|
2020-05-07 05:03:34 +01:00
|
|
|
import { BREAKPOINT_EXTRA_SMALL } from '../constants'
|
2020-02-21 00:57:29 +00:00
|
|
|
import ComposeFormContainer from '../features/compose/containers/compose_form_container'
|
2020-05-06 05:33:54 +01:00
|
|
|
import ResponsiveClassesComponent from '../features/ui/util/responsive_classes_component'
|
2020-05-07 05:03:34 +01:00
|
|
|
import Responsive from '../features/ui/util/responsive_component'
|
2020-03-31 17:04:50 +01:00
|
|
|
import Avatar from './avatar'
|
2020-02-21 00:57:29 +00:00
|
|
|
import Heading from './heading'
|
|
|
|
|
2019-08-13 16:54:29 +01:00
|
|
|
class TimelineComposeBlock extends ImmutablePureComponent {
|
|
|
|
|
|
|
|
render() {
|
2020-03-07 04:53:28 +00:00
|
|
|
const {
|
|
|
|
account,
|
|
|
|
size,
|
|
|
|
intl,
|
|
|
|
modal,
|
|
|
|
...rest
|
|
|
|
} = this.props
|
|
|
|
|
|
|
|
if (modal) {
|
|
|
|
return (
|
2020-08-18 21:49:11 +01:00
|
|
|
<section className={_s.d}>
|
|
|
|
<div className={[_s.d, _s.flexRow].join(' ')}>
|
2020-06-17 18:25:10 +01:00
|
|
|
<ComposeFormContainer {...rest} modal={modal} />
|
2020-03-07 04:53:28 +00:00
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
)
|
|
|
|
}
|
2019-08-13 16:54:29 +01:00
|
|
|
|
|
|
|
return (
|
2020-08-18 21:49:11 +01:00
|
|
|
<section className={[_s.d, _s.mb15].join(' ')}>
|
2020-05-06 05:33:54 +01:00
|
|
|
<ResponsiveClassesComponent
|
2020-08-18 21:49:11 +01:00
|
|
|
classNames={[_s.d, _s.boxShadowBlock, _s.bgPrimary, _s.overflowHidden, _s.radiusSmall].join(' ')}
|
|
|
|
classNamesXS={[_s.d, _s.boxShadowBlock, _s.bgPrimary, _s.overflowHidden].join(' ')}
|
2020-05-06 05:33:54 +01:00
|
|
|
>
|
2020-05-07 05:03:34 +01:00
|
|
|
<Responsive min={BREAKPOINT_EXTRA_SMALL}>
|
2020-08-18 21:49:11 +01:00
|
|
|
<div className={[_s.d, _s.bgSubtle, _s.borderTop1PX, _s.borderBottom1PX, _s.borderColorSecondary, _s.px15, _s.py2, _s.aiCenter, _s.flexRow].join(' ')}>
|
2020-05-07 05:03:34 +01:00
|
|
|
<div className={_s.mr10}>
|
|
|
|
<Avatar account={account} size={20} noHover />
|
|
|
|
</div>
|
|
|
|
<Heading size='h5'>
|
|
|
|
{intl.formatMessage(messages.createPost)}
|
|
|
|
</Heading>
|
2020-03-31 17:04:50 +01:00
|
|
|
</div>
|
2020-05-07 05:03:34 +01:00
|
|
|
</Responsive>
|
2020-04-02 04:17:21 +01:00
|
|
|
<ComposeFormContainer {...rest} />
|
2020-05-06 05:33:54 +01:00
|
|
|
</ResponsiveClassesComponent>
|
2020-02-08 22:57:09 +00:00
|
|
|
</section>
|
2019-08-13 16:54:29 +01:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-08-18 01:57:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
createPost: { id: 'column_header.create_post', defaultMessage: 'Create Post' },
|
|
|
|
})
|
|
|
|
|
|
|
|
const mapStateToProps = (state) => ({
|
|
|
|
account: state.getIn(['accounts', me]),
|
|
|
|
})
|
|
|
|
|
|
|
|
TimelineComposeBlock.propTypes = {
|
|
|
|
intl: PropTypes.object.isRequired,
|
|
|
|
account: ImmutablePropTypes.map.isRequired,
|
|
|
|
size: PropTypes.number,
|
|
|
|
modal: PropTypes.bool,
|
|
|
|
}
|
|
|
|
|
|
|
|
TimelineComposeBlock.defaultProps = {
|
|
|
|
size: 32,
|
|
|
|
}
|
|
|
|
|
|
|
|
export default injectIntl(connect(mapStateToProps)(TimelineComposeBlock))
|