From 083170bec755920b80c64f9cca2cc419831f66c8 Mon Sep 17 00:00:00 2001 From: kibigo! Date: Fri, 29 Dec 2017 14:55:06 -0800 Subject: WIP Refactor; SCSS ed. --- .../glitch/features/drawer/account/index.js | 70 ++++++++++++++++++++++ .../flavours/glitch/features/drawer/index.js | 33 ++++------ .../glitch/features/drawer/pager/account/index.js | 70 ---------------------- .../flavours/glitch/features/drawer/pager/index.js | 43 ------------- 4 files changed, 80 insertions(+), 136 deletions(-) create mode 100644 app/javascript/flavours/glitch/features/drawer/account/index.js delete mode 100644 app/javascript/flavours/glitch/features/drawer/pager/account/index.js delete mode 100644 app/javascript/flavours/glitch/features/drawer/pager/index.js (limited to 'app/javascript/flavours/glitch/features/drawer') diff --git a/app/javascript/flavours/glitch/features/drawer/account/index.js b/app/javascript/flavours/glitch/features/drawer/account/index.js new file mode 100644 index 000000000..9afe8ba3e --- /dev/null +++ b/app/javascript/flavours/glitch/features/drawer/account/index.js @@ -0,0 +1,70 @@ +// Package imports. +import React from 'react'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import { + FormattedMessage, + defineMessages, +} from 'react-intl'; + +// Components. +import Avatar from 'flavours/glitch/components/avatar'; +import Permalink from 'flavours/glitch/components/permalink'; + +// Utils. +import { hiddenComponent } from 'flavours/glitch/util/react_helpers'; + +// Messages. +const messages = defineMessages({ + edit: { + defaultMessage: 'Edit profile', + id: 'navigation_bar.edit_profile', + }, +}); + +// The component. +export default function DrawerAccount ({ account }) { + + // We need an account to render. + if (!account) { + return ( +
+ + + +
+ ); + } + + // The result. + return ( +
+ + {account.get('acct')} + + + + @{account.get('acct')} + + +
+ ); +} + +DrawerAccount.propTypes = { account: ImmutablePropTypes.map }; diff --git a/app/javascript/flavours/glitch/features/drawer/index.js b/app/javascript/flavours/glitch/features/drawer/index.js index 1b7a8a0b5..d184dfd9b 100644 --- a/app/javascript/flavours/glitch/features/drawer/index.js +++ b/app/javascript/flavours/glitch/features/drawer/index.js @@ -4,7 +4,6 @@ import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; // Actions. -import { changeComposing } from 'flavours/glitch/actions/compose'; import { openModal } from 'flavours/glitch/actions/modal'; import { changeSearch, @@ -14,8 +13,9 @@ import { } from 'flavours/glitch/actions/search'; // Components. +import Composer from 'flavours/glitch/features/composer'; +import DrawerAccount from './account'; import DrawerHeader from './header'; -import DrawerPager from './pager'; import DrawerResults from './results'; import DrawerSearch from './search'; @@ -27,7 +27,6 @@ import { wrap } from 'flavours/glitch/util/redux_helpers'; const mapStateToProps = state => ({ account: state.getIn(['accounts', me]), columns: state.getIn(['settings', 'columns']), - isComposing: state.getIn(['compose', 'is_composing']), results: state.getIn(['search', 'results']), searchHidden: state.getIn(['search', 'hidden']), searchValue: state.getIn(['search', 'value']), @@ -39,12 +38,6 @@ const mapDispatchToProps = dispatch => ({ change (value) { dispatch(changeSearch(value)); }, - changeComposingOff () { - dispatch(changeComposing(false)); - }, - changeComposingOn () { - dispatch(changeComposing(true)); - }, clear () { dispatch(clearSearch()); }, @@ -72,8 +65,6 @@ class Drawer extends React.Component { const { dispatch: { change, - changeComposingOff, - changeComposingOn, clear, openSettings, show, @@ -84,7 +75,6 @@ class Drawer extends React.Component { state: { account, columns, - isComposing, results, searchHidden, searchValue, @@ -111,16 +101,14 @@ class Drawer extends React.Component { submitted={submitted} value={searchValue} /> - - +
+ + + +
); } @@ -135,7 +123,6 @@ Drawer.propTypes = { state: PropTypes.shape({ account: ImmutablePropTypes.map, columns: ImmutablePropTypes.list, - isComposing: PropTypes.bool, results: ImmutablePropTypes.map, searchHidden: PropTypes.bool, searchValue: PropTypes.string, diff --git a/app/javascript/flavours/glitch/features/drawer/pager/account/index.js b/app/javascript/flavours/glitch/features/drawer/pager/account/index.js deleted file mode 100644 index 2ee95d5b9..000000000 --- a/app/javascript/flavours/glitch/features/drawer/pager/account/index.js +++ /dev/null @@ -1,70 +0,0 @@ -// Package imports. -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import { - FormattedMessage, - defineMessages, -} from 'react-intl'; - -// Components. -import Avatar from 'flavours/glitch/components/avatar'; -import Permalink from 'flavours/glitch/components/permalink'; - -// Utils. -import { hiddenComponent } from 'flavours/glitch/util/react_helpers'; - -// Messages. -const messages = defineMessages({ - edit: { - defaultMessage: 'Edit profile', - id: 'navigation_bar.edit_profile', - }, -}); - -// The component. -export default function DrawerPagerAccount ({ account }) { - - // We need an account to render. - if (!account) { - return ( -
- - - -
- ); - } - - // The result. - return ( -
- - {account.get('acct')} - - - - @{account.get('acct')} - - -
- ); -} - -DrawerPagerAccount.propTypes = { account: ImmutablePropTypes.map }; diff --git a/app/javascript/flavours/glitch/features/drawer/pager/index.js b/app/javascript/flavours/glitch/features/drawer/pager/index.js deleted file mode 100644 index 8dc2d3ee9..000000000 --- a/app/javascript/flavours/glitch/features/drawer/pager/index.js +++ /dev/null @@ -1,43 +0,0 @@ -// Package imports. -import classNames from 'classnames'; -import PropTypes from 'prop-types'; -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; - -// Components. -import IconButton from 'flavours/glitch/components/icon_button'; -import Composer from 'flavours/glitch/features/composer'; -import DrawerPagerAccount from './account'; - -// The component. -export default function DrawerPager ({ - account, - active, - onClose, - onFocus, -}) { - const computedClass = classNames('drawer--pager', { active }); - - // The result. - return ( -
- - - -
- ); -} - -DrawerPager.propTypes = { - account: ImmutablePropTypes.map, - active: PropTypes.bool, - onClose: PropTypes.func, - onFocus: PropTypes.func, -}; -- cgit