Removed floating action button from columns area
This commit is contained in:
parent
42e9d5a360
commit
b163726651
@ -1,13 +1,12 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { defineMessages, injectIntl } from 'react-intl';
|
import { injectIntl } from 'react-intl';
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
|
|
||||||
import ReactSwipeableViews from 'react-swipeable-views';
|
import ReactSwipeableViews from 'react-swipeable-views';
|
||||||
import { links, getIndex, getLink } from './tabs_bar';
|
import { links, getIndex, getLink } from './tabs_bar';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { me } from 'gabsocial/initial_state';
|
|
||||||
|
|
||||||
import BundleContainer from '../containers/bundle_container';
|
import BundleContainer from '../containers/bundle_container';
|
||||||
import ColumnLoading from './column_loading';
|
import ColumnLoading from './column_loading';
|
||||||
@ -16,33 +15,20 @@ import BundleColumnError from './bundle_column_error';
|
|||||||
import { Compose, Notifications, HomeTimeline, CommunityTimeline, HashtagTimeline, DirectTimeline, FavouritedStatuses, ListTimeline } from '../../ui/util/async-components';
|
import { Compose, Notifications, HomeTimeline, CommunityTimeline, HashtagTimeline, DirectTimeline, FavouritedStatuses, ListTimeline } from '../../ui/util/async-components';
|
||||||
import Icon from 'gabsocial/components/icon';
|
import Icon from 'gabsocial/components/icon';
|
||||||
|
|
||||||
const messages = defineMessages({
|
|
||||||
publish: { id: 'compose_form.publish', defaultMessage: 'Gab' },
|
|
||||||
});
|
|
||||||
|
|
||||||
const shouldHideFAB = path => path.match(/^\/statuses\/|^\/search|^\/getting-started/);
|
|
||||||
|
|
||||||
export default @(component => injectIntl(component, { withRef: true }))
|
export default @(component => injectIntl(component, { withRef: true }))
|
||||||
class ColumnsArea extends ImmutablePureComponent {
|
class ColumnsArea extends ImmutablePureComponent {
|
||||||
|
|
||||||
static contextTypes = {
|
|
||||||
router: PropTypes.object.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
columns: ImmutablePropTypes.list.isRequired,
|
columns: ImmutablePropTypes.list.isRequired,
|
||||||
isModalOpen: PropTypes.bool.isRequired,
|
|
||||||
children: PropTypes.node,
|
children: PropTypes.node,
|
||||||
layout: PropTypes.object,
|
layout: PropTypes.object,
|
||||||
};
|
};
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { columns, children, isModalOpen, intl, onOpenCompose } = this.props;
|
const { columns, children, intl } = this.props;
|
||||||
const layout = this.props.layout || {LEFT:null,RIGHT:null};
|
const layout = this.props.layout || {LEFT:null,RIGHT:null};
|
||||||
|
|
||||||
const floatingActionButton = shouldHideFAB(this.context.router.history.location.pathname) ? null : <button key='floating-action-button' onClick={onOpenCompose} className='floating-action-button' aria-label={intl.formatMessage(messages.publish)}></button>;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='page'>
|
<div className='page'>
|
||||||
<div className='page__columns'>
|
<div className='page__columns'>
|
||||||
@ -65,7 +51,6 @@ class ColumnsArea extends ImmutablePureComponent {
|
|||||||
{layout.RIGHT}
|
{layout.RIGHT}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{me && floatingActionButton}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,17 +1,8 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import ColumnsArea from '../components/columns_area';
|
import ColumnsArea from '../components/columns_area';
|
||||||
import { openModal } from '../../../actions/modal';
|
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
columns: state.getIn(['settings', 'columns']),
|
columns: state.getIn(['settings', 'columns']),
|
||||||
isModalOpen: !!state.get('modal').modalType,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export default connect(mapStateToProps, null, null, { forwardRef: true })(ColumnsArea);
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
|
||||||
onOpenCompose() {
|
|
||||||
dispatch(openModal('COMPOSE'));
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps, null, { forwardRef: true })(ColumnsArea);
|
|
||||||
|
Loading…
Reference in New Issue
Block a user