// Package imports.
-import PropTypes from 'prop-types';
import React from 'react';
+import { connect } from 'react-redux';
+import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
-import { defineMessages } from 'react-intl';
+import { injectIntl, defineMessages } from 'react-intl';
import classNames from 'classnames';
// Actions.
});
// The component.
-class Drawer extends React.Component {
-
- // Constructor.
- constructor (props) {
- super(props);
- }
+export default @connect(mapStateToProps, mapDispatchToProps)
+@injectIntl
+class Compose extends React.PureComponent {
+ static propTypes = {
+ intl: PropTypes.object.isRequired,
+ isSearchPage: PropTypes.bool,
+ multiColumn: PropTypes.bool,
+
+ // State props.
+ account: ImmutablePropTypes.map,
+ columns: ImmutablePropTypes.list,
+ results: ImmutablePropTypes.map,
+ elefriend: PropTypes.number,
+ searchHidden: PropTypes.bool,
+ searchValue: PropTypes.string,
+ submitted: PropTypes.bool,
+ unreadNotifications: PropTypes.number,
+ showNotificationsBadge: PropTypes.bool,
+
+ // Dispatch props.
+ onChange: PropTypes.func,
+ onClear: PropTypes.func,
+ onClickElefriend: PropTypes.func,
+ onShow: PropTypes.func,
+ onSubmit: PropTypes.func,
+ onOpenSettings: PropTypes.func,
+ };
// Rendering.
render () {
// The result.
return (
<div className={computedClass} role='region' aria-label={intl.formatMessage(messages.compose)}>
- {multiColumn ? (
+ {multiColumn && (
<DrawerHeader
columns={columns}
unreadNotifications={unreadNotifications}
intl={intl}
onSettingsClick={onOpenSettings}
/>
- ) : null}
+ )}
{(multiColumn || isSearchPage) && <DrawerSearch
intl={intl}
onChange={onChange}
</div>
);
}
-
}
-
-// Props.
-Drawer.propTypes = {
- intl: PropTypes.object.isRequired,
- isSearchPage: PropTypes.bool,
- multiColumn: PropTypes.bool,
-
- // State props.
- account: ImmutablePropTypes.map,
- columns: ImmutablePropTypes.list,
- results: ImmutablePropTypes.map,
- elefriend: PropTypes.number,
- searchHidden: PropTypes.bool,
- searchValue: PropTypes.string,
- submitted: PropTypes.bool,
- unreadNotifications: PropTypes.number,
- showNotificationsBadge: PropTypes.bool,
-
- // Dispatch props.
- onChange: PropTypes.func,
- onClear: PropTypes.func,
- onClickElefriend: PropTypes.func,
- onShow: PropTypes.func,
- onSubmit: PropTypes.func,
- onOpenSettings: PropTypes.func,
-};
-
-// Connecting and export.
-export { Drawer as WrappedComponent };
-export default wrap(Drawer, mapStateToProps, mapDispatchToProps, true);
import ColumnLoading from './column_loading';
import DrawerLoading from './drawer_loading';
import BundleColumnError from './bundle_column_error';
-import { Drawer, Notifications, HomeTimeline, CommunityTimeline, PublicTimeline, HashtagTimeline, DirectTimeline, FavouritedStatuses, BookmarkedStatuses, ListTimeline } from 'flavours/glitch/util/async-components';
+import { Compose, Notifications, HomeTimeline, CommunityTimeline, PublicTimeline, HashtagTimeline, DirectTimeline, FavouritedStatuses, BookmarkedStatuses, ListTimeline } from 'flavours/glitch/util/async-components';
import detectPassiveEvents from 'detect-passive-events';
import { scrollRight } from 'flavours/glitch/util/scroll';
const componentMap = {
- 'COMPOSE': Drawer,
+ 'COMPOSE': Compose,
'HOME': HomeTimeline,
'NOTIFICATIONS': Notifications,
'PUBLIC': PublicTimeline,