From eed2c9dd44d7f58bbb54554c2271c465b67b827c Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Fri, 19 Apr 2019 20:14:32 +0200 Subject: [PATCH] Rename flavours/glitch/features/drawer to flavours/glitch/features/compose --- .../{drawer => compose}/account/index.js | 0 .../{drawer => compose}/header/index.js | 0 .../features/{drawer => compose}/index.js | 71 ++++++++----------- .../{drawer => compose}/results/index.js | 0 .../{drawer => compose}/search/index.js | 0 .../search/popout/index.js | 0 .../features/ui/components/columns_area.js | 4 +- .../ui/components/onboarding_modal.js | 4 +- .../flavours/glitch/features/ui/index.js | 6 +- app/javascript/flavours/glitch/theme.yml | 2 +- .../flavours/glitch/util/async-components.js | 4 +- 11 files changed, 41 insertions(+), 50 deletions(-) rename app/javascript/flavours/glitch/features/{drawer => compose}/account/index.js (100%) rename app/javascript/flavours/glitch/features/{drawer => compose}/header/index.js (100%) rename app/javascript/flavours/glitch/features/{drawer => compose}/index.js (79%) rename app/javascript/flavours/glitch/features/{drawer => compose}/results/index.js (100%) rename app/javascript/flavours/glitch/features/{drawer => compose}/search/index.js (100%) rename app/javascript/flavours/glitch/features/{drawer => compose}/search/popout/index.js (100%) diff --git a/app/javascript/flavours/glitch/features/drawer/account/index.js b/app/javascript/flavours/glitch/features/compose/account/index.js similarity index 100% rename from app/javascript/flavours/glitch/features/drawer/account/index.js rename to app/javascript/flavours/glitch/features/compose/account/index.js diff --git a/app/javascript/flavours/glitch/features/drawer/header/index.js b/app/javascript/flavours/glitch/features/compose/header/index.js similarity index 100% rename from app/javascript/flavours/glitch/features/drawer/header/index.js rename to app/javascript/flavours/glitch/features/compose/header/index.js diff --git a/app/javascript/flavours/glitch/features/drawer/index.js b/app/javascript/flavours/glitch/features/compose/index.js similarity index 79% rename from app/javascript/flavours/glitch/features/drawer/index.js rename to app/javascript/flavours/glitch/features/compose/index.js index c8121b8e55..cb261f9d63 100644 --- a/app/javascript/flavours/glitch/features/drawer/index.js +++ b/app/javascript/flavours/glitch/features/compose/index.js @@ -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 { +export default @connect(mapStateToProps, mapDispatchToProps) +@injectIntl +class Compose extends React.PureComponent { + static propTypes = { + intl: PropTypes.object.isRequired, + isSearchPage: PropTypes.bool, + multiColumn: PropTypes.bool, - // Constructor. - constructor (props) { - super(props); - } + // 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 (
- {multiColumn ? ( + {multiColumn && ( - ) : null} + )} {(multiColumn || isSearchPage) && ); } - } - -// 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); diff --git a/app/javascript/flavours/glitch/features/drawer/results/index.js b/app/javascript/flavours/glitch/features/compose/results/index.js similarity index 100% rename from app/javascript/flavours/glitch/features/drawer/results/index.js rename to app/javascript/flavours/glitch/features/compose/results/index.js diff --git a/app/javascript/flavours/glitch/features/drawer/search/index.js b/app/javascript/flavours/glitch/features/compose/search/index.js similarity index 100% rename from app/javascript/flavours/glitch/features/drawer/search/index.js rename to app/javascript/flavours/glitch/features/compose/search/index.js diff --git a/app/javascript/flavours/glitch/features/drawer/search/popout/index.js b/app/javascript/flavours/glitch/features/compose/search/popout/index.js similarity index 100% rename from app/javascript/flavours/glitch/features/drawer/search/popout/index.js rename to app/javascript/flavours/glitch/features/compose/search/popout/index.js diff --git a/app/javascript/flavours/glitch/features/ui/components/columns_area.js b/app/javascript/flavours/glitch/features/ui/components/columns_area.js index 83b7973057..0fe580b9b2 100644 --- a/app/javascript/flavours/glitch/features/ui/components/columns_area.js +++ b/app/javascript/flavours/glitch/features/ui/components/columns_area.js @@ -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, diff --git a/app/javascript/flavours/glitch/features/ui/components/onboarding_modal.js b/app/javascript/flavours/glitch/features/ui/components/onboarding_modal.js index 16355a4462..e9c634a505 100644 --- a/app/javascript/flavours/glitch/features/ui/components/onboarding_modal.js +++ b/app/javascript/flavours/glitch/features/ui/components/onboarding_modal.js @@ -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'; diff --git a/app/javascript/flavours/glitch/features/ui/index.js b/app/javascript/flavours/glitch/features/ui/index.js index 348125c97e..dd527d5286 100644 --- a/app/javascript/flavours/glitch/features/ui/index.js +++ b/app/javascript/flavours/glitch/features/ui/index.js @@ -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 { - + - + diff --git a/app/javascript/flavours/glitch/theme.yml b/app/javascript/flavours/glitch/theme.yml index 587cc0f1ed..06e26ade26 100644 --- a/app/javascript/flavours/glitch/theme.yml +++ b/app/javascript/flavours/glitch/theme.yml @@ -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 diff --git a/app/javascript/flavours/glitch/util/async-components.js b/app/javascript/flavours/glitch/util/async-components.js index e96af845f0..0949522045 100644 --- a/app/javascript/flavours/glitch/util/async-components.js +++ b/app/javascript/flavours/glitch/util/async-components.js @@ -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 () {