Rename flavours/glitch/features/drawer to flavours/glitch/features/compose

th-downstream
Thibaut Girka 6 years ago committed by ThibG
parent 3316cc1722
commit e41c4ad61b

@ -1,8 +1,9 @@
// 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.
@ -69,12 +70,33 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
});
// 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 () {
@ -103,7 +125,7 @@ class Drawer extends React.Component {
// The result.
return (
<div className={computedClass} role='region' aria-label={intl.formatMessage(messages.compose)}>
{multiColumn ? (
{multiColumn && (
<DrawerHeader
columns={columns}
unreadNotifications={unreadNotifications}
@ -111,7 +133,7 @@ class Drawer extends React.Component {
intl={intl}
onSettingsClick={onOpenSettings}
/>
) : null}
)}
{(multiColumn || isSearchPage) && <DrawerSearch
intl={intl}
onChange={onChange}
@ -141,35 +163,4 @@ class Drawer extends React.Component {
</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);

@ -12,13 +12,13 @@ import BundleContainer from '../containers/bundle_container';
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,

@ -7,8 +7,8 @@ import ReactSwipeableViews from 'react-swipeable-views';
import classNames from 'classnames';
import Permalink from 'flavours/glitch/components/permalink';
import { WrappedComponent as RawComposer } from 'flavours/glitch/features/composer';
import DrawerAccount from 'flavours/glitch/features/drawer/account';
import DrawerSearch from 'flavours/glitch/features/drawer/search';
import DrawerAccount from 'flavours/glitch/features/compose/account';
import DrawerSearch from 'flavours/glitch/features/compose/search';
import ColumnHeader from './column_header';
import { me } from 'flavours/glitch/util/initial_state';

@ -19,7 +19,7 @@ import ColumnsAreaContainer from './containers/columns_area_container';
import classNames from 'classnames';
import Favico from 'favico.js';
import {
Drawer,
Compose,
Status,
GettingStarted,
KeyboardShortcuts,
@ -488,9 +488,9 @@ export default class UI extends React.Component {
<WrappedRoute path='/bookmarks' component={BookmarkedStatuses} content={children} />
<WrappedRoute path='/pinned' component={PinnedStatuses} content={children} />
<WrappedRoute path='/search' component={Drawer} content={children} componentParams={{ isSearchPage: true }} />
<WrappedRoute path='/search' component={Compose} content={children} componentParams={{ isSearchPage: true }} />
<WrappedRoute path='/statuses/new' component={Drawer} content={children} />
<WrappedRoute path='/statuses/new' component={Compose} content={children} />
<WrappedRoute path='/statuses/:statusId' exact component={Status} content={children} />
<WrappedRoute path='/statuses/:statusId/reblogs' component={Reblogs} content={children} />
<WrappedRoute path='/statuses/:statusId/favourites' component={Favourites} content={children} />

@ -11,7 +11,7 @@ pack:
home:
filename: packs/home.js
preload:
- flavours/glitch/async/drawer
- flavours/glitch/async/compose
- flavours/glitch/async/getting_started
- flavours/glitch/async/home_timeline
- flavours/glitch/async/notifications

@ -2,8 +2,8 @@ export function EmojiPicker () {
return import(/* webpackChunkName: "flavours/glitch/async/emoji_picker" */'flavours/glitch/util/emoji/emoji_picker');
}
export function Drawer () {
return import(/* webpackChunkName: "flavours/glitch/async/drawer" */'flavours/glitch/features/drawer');
export function Compose () {
return import(/* webpackChunkName: "flavours/glitch/async/compose" */'flavours/glitch/features/compose');
}
export function Notifications () {

Loading…
Cancel
Save