2020-04-23 07:13:29 +01:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl'
|
2020-05-14 21:45:39 +01:00
|
|
|
import { me } from '../initial_state'
|
2020-05-15 23:49:54 +01:00
|
|
|
import { CX } from '../constants'
|
2020-04-23 07:13:29 +01:00
|
|
|
import { openModal } from '../actions/modal'
|
2020-02-24 21:56:07 +00:00
|
|
|
import Button from './button'
|
2020-01-27 22:20:07 +00:00
|
|
|
|
2020-04-23 07:13:29 +01:00
|
|
|
const messages = defineMessages({
|
|
|
|
gab: { id: 'gab', defaultMessage: 'Gab' },
|
|
|
|
})
|
|
|
|
|
|
|
|
const mapDispatchToProps = (dispatch) => ({
|
|
|
|
onOpenCompose: () => dispatch(openModal('COMPOSE')),
|
|
|
|
})
|
|
|
|
|
|
|
|
export default
|
|
|
|
@injectIntl
|
|
|
|
@connect(null, mapDispatchToProps)
|
|
|
|
class FloatingActionButton extends PureComponent {
|
2020-05-14 21:45:39 +01:00
|
|
|
|
2019-08-07 06:02:36 +01:00
|
|
|
static propTypes = {
|
2020-04-23 07:13:29 +01:00
|
|
|
intl: PropTypes.object.isRequired,
|
|
|
|
onOpenCompose: PropTypes.func.isRequired,
|
2020-05-15 23:49:54 +01:00
|
|
|
isDesktop: PropTypes.bool,
|
2020-04-11 23:29:19 +01:00
|
|
|
}
|
2019-08-07 06:02:36 +01:00
|
|
|
|
|
|
|
render() {
|
2020-05-15 23:49:54 +01:00
|
|
|
const {
|
|
|
|
intl,
|
|
|
|
onOpenCompose,
|
|
|
|
isDesktop,
|
|
|
|
} = this.props
|
2020-04-23 07:13:29 +01:00
|
|
|
|
2020-05-14 21:45:39 +01:00
|
|
|
if (!me) return null
|
|
|
|
|
2020-04-23 07:13:29 +01:00
|
|
|
const message = intl.formatMessage(messages.gab)
|
2020-03-26 03:11:32 +00:00
|
|
|
|
2020-05-15 23:49:54 +01:00
|
|
|
const containerClasses = CX({
|
|
|
|
posFixed: 1,
|
|
|
|
z3: 1,
|
|
|
|
mb15: 1,
|
|
|
|
mr15: 1,
|
|
|
|
right0: 1,
|
|
|
|
bottom55PX: !isDesktop,
|
|
|
|
bottom0: isDesktop,
|
|
|
|
pb15: isDesktop,
|
|
|
|
pr15: isDesktop,
|
|
|
|
})
|
|
|
|
|
2019-08-07 06:02:36 +01:00
|
|
|
return (
|
2020-05-14 22:47:33 +01:00
|
|
|
<div
|
2020-05-15 23:49:54 +01:00
|
|
|
className={containerClasses}
|
2020-05-14 22:47:33 +01:00
|
|
|
>
|
|
|
|
<Button
|
2020-05-15 23:49:54 +01:00
|
|
|
to={isDesktop ? undefined : '/compose'}
|
|
|
|
onClick={isDesktop ? onOpenCompose : undefined}
|
2020-05-14 22:47:33 +01:00
|
|
|
className={[_s.py15, _s.height60PX, _s.saveAreaInsetMR, _s.saveAreaInsetMB, _s.width60PX, _s.justifyContentCenter, _s.alignItemsCenter].join(' ')}
|
|
|
|
title={message}
|
|
|
|
aria-label={message}
|
|
|
|
icon='pencil'
|
|
|
|
iconSize='20px'
|
|
|
|
/>
|
|
|
|
</div>
|
2019-08-07 06:02:36 +01:00
|
|
|
)
|
|
|
|
}
|
2020-05-14 21:45:39 +01:00
|
|
|
|
2019-08-07 06:02:36 +01:00
|
|
|
}
|