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

rebase/4.0.0rc2
Thibaut Girka 2019-04-19 20:14:32 +02:00 committed by ThibG
parent 8933e8cb1d
commit eed2c9dd44
11 changed files with 41 additions and 50 deletions

View File

@ -1,8 +1,9 @@
// Package imports. // Package imports.
import PropTypes from 'prop-types';
import React from 'react'; import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import { defineMessages } from 'react-intl'; import { injectIntl, defineMessages } from 'react-intl';
import classNames from 'classnames'; import classNames from 'classnames';
// Actions. // Actions.
@ -69,12 +70,33 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
}); });
// The component. // The component.
class Drawer extends React.Component { export default @connect(mapStateToProps, mapDispatchToProps)
@injectIntl
class Compose extends React.PureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
isSearchPage: PropTypes.bool,
multiColumn: PropTypes.bool,
// Constructor. // State props.
constructor (props) { account: ImmutablePropTypes.map,
super(props); 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. // Rendering.
render () { render () {
@ -103,7 +125,7 @@ class Drawer extends React.Component {
// The result. // The result.
return ( return (
<div className={computedClass} role='region' aria-label={intl.formatMessage(messages.compose)}> <div className={computedClass} role='region' aria-label={intl.formatMessage(messages.compose)}>
{multiColumn ? ( {multiColumn && (
<DrawerHeader <DrawerHeader
columns={columns} columns={columns}
unreadNotifications={unreadNotifications} unreadNotifications={unreadNotifications}
@ -111,7 +133,7 @@ class Drawer extends React.Component {
intl={intl} intl={intl}
onSettingsClick={onOpenSettings} onSettingsClick={onOpenSettings}
/> />
) : null} )}
{(multiColumn || isSearchPage) && <DrawerSearch {(multiColumn || isSearchPage) && <DrawerSearch
intl={intl} intl={intl}
onChange={onChange} onChange={onChange}
@ -141,35 +163,4 @@ class Drawer extends React.Component {
</div> </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);

View File

@ -12,13 +12,13 @@ import BundleContainer from '../containers/bundle_container';
import ColumnLoading from './column_loading'; import ColumnLoading from './column_loading';
import DrawerLoading from './drawer_loading'; import DrawerLoading from './drawer_loading';
import BundleColumnError from './bundle_column_error'; 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 detectPassiveEvents from 'detect-passive-events';
import { scrollRight } from 'flavours/glitch/util/scroll'; import { scrollRight } from 'flavours/glitch/util/scroll';
const componentMap = { const componentMap = {
'COMPOSE': Drawer, 'COMPOSE': Compose,
'HOME': HomeTimeline, 'HOME': HomeTimeline,
'NOTIFICATIONS': Notifications, 'NOTIFICATIONS': Notifications,
'PUBLIC': PublicTimeline, 'PUBLIC': PublicTimeline,

View File

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

View File

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

View File

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

View File

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