diff options
Diffstat (limited to 'app/javascript/flavours/glitch/features')
5 files changed, 48 insertions, 39 deletions
diff --git a/app/javascript/flavours/glitch/features/composer/index.js b/app/javascript/flavours/glitch/features/composer/index.js index cae9bf9f2..29a2f4775 100644 --- a/app/javascript/flavours/glitch/features/composer/index.js +++ b/app/javascript/flavours/glitch/features/composer/index.js @@ -350,10 +350,10 @@ class Composer extends React.Component { acceptContentTypes={acceptContentTypes} advancedOptions={advancedOptions} disabled={isSubmitting} - full={media.size >= 4 || media.some( + full={media ? media.size >= 4 || media.some( item => item.get('type') === 'video' - )} - hasMedia={!!media.size} + ) : false} + hasMedia={media && !!media.size} intl={intl} onChangeAdvancedOption={onChangeAdvancedOption} onChangeSensitivity={onChangeSensitivity} @@ -369,7 +369,7 @@ class Composer extends React.Component { spoiler={spoiler} /> <ComposerPublisher - countText={`${spoilerText}${countableText(text)}${advancedOptions.get('do_not_federate') ? ' 👁️' : ''}`} + countText={`${spoilerText}${countableText(text)}${advancedOptions && advancedOptions.get('do_not_federate') ? ' 👁️' : ''}`} disabled={isSubmitting || isUploading || !!text.length && !text.trim().length} intl={intl} onSecondarySubmit={handleSecondarySubmit} diff --git a/app/javascript/flavours/glitch/features/composer/options/dropdown/content/index.js b/app/javascript/flavours/glitch/features/composer/options/dropdown/content/index.js index 28bdfc0db..b3a472999 100644 --- a/app/javascript/flavours/glitch/features/composer/options/dropdown/content/index.js +++ b/app/javascript/flavours/glitch/features/composer/options/dropdown/content/index.js @@ -96,7 +96,7 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent transform: `scale(${scaleX}, ${scaleY})`, }} > - {items.map( + {items ? items.map( ({ name, ...rest @@ -110,7 +110,7 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent options={rest} /> ) - )} + ) : null} </div> )} </Motion> @@ -127,7 +127,7 @@ ComposerOptionsDropdownContent.propTypes = { name: PropTypes.string.isRequired, on: PropTypes.bool, text: PropTypes.node, - })).isRequired, + })), onChange: PropTypes.func, onClose: PropTypes.func, style: PropTypes.object, diff --git a/app/javascript/flavours/glitch/features/composer/options/index.js b/app/javascript/flavours/glitch/features/composer/options/index.js index 954508c11..c129622bc 100644 --- a/app/javascript/flavours/glitch/features/composer/options/index.js +++ b/app/javascript/flavours/glitch/features/composer/options/index.js @@ -292,31 +292,29 @@ export default class ComposerOptions extends React.PureComponent { onClick={onToggleSpoiler} title={intl.formatMessage(messages.spoiler)} /> - {advancedOptions ? ( - <Dropdown - active={advancedOptions.some(value => !!value)} - disabled={disabled} - icon='ellipsis-h' - items={[ - { - meta: <FormattedMessage {...messages.local_only_long} />, - name: 'do_not_federate', - on: advancedOptions.get('do_not_federate'), - text: <FormattedMessage {...messages.local_only_short} />, - }, - { - meta: <FormattedMessage {...messages.threaded_mode_long} />, - name: 'threaded_mode', - on: advancedOptions.get('threaded_mode'), - text: <FormattedMessage {...messages.threaded_mode_short} />, - }, - ]} - onChange={onChangeAdvancedOption} - onModalClose={onModalClose} - onModalOpen={onModalOpen} - title={intl.formatMessage(messages.advanced_options_icon_title)} - /> - ) : null} + <Dropdown + active={advancedOptions && advancedOptions.some(value => !!value)} + disabled={disabled} + icon='ellipsis-h' + items={advancedOptions ? [ + { + meta: <FormattedMessage {...messages.local_only_long} />, + name: 'do_not_federate', + on: advancedOptions.get('do_not_federate'), + text: <FormattedMessage {...messages.local_only_short} />, + }, + { + meta: <FormattedMessage {...messages.threaded_mode_long} />, + name: 'threaded_mode', + on: advancedOptions.get('threaded_mode'), + text: <FormattedMessage {...messages.threaded_mode_short} />, + }, + ] : null} + onChange={onChangeAdvancedOption} + onModalClose={onModalClose} + onModalOpen={onModalOpen} + title={intl.formatMessage(messages.advanced_options_icon_title)} + /> </div> ); } diff --git a/app/javascript/flavours/glitch/features/drawer/index.js b/app/javascript/flavours/glitch/features/drawer/index.js index 9ade1f87a..375954cb6 100644 --- a/app/javascript/flavours/glitch/features/drawer/index.js +++ b/app/javascript/flavours/glitch/features/drawer/index.js @@ -2,6 +2,7 @@ import PropTypes from 'prop-types'; import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; +import classNames from 'classnames'; // Actions. import { openModal } from 'flavours/glitch/actions/modal'; @@ -11,6 +12,7 @@ import { showSearch, submitSearch, } from 'flavours/glitch/actions/search'; +import { cycleElefriendCompose } from 'flavours/glitch/actions/compose'; // Components. import Composer from 'flavours/glitch/features/composer'; @@ -27,6 +29,7 @@ import { wrap } from 'flavours/glitch/util/redux_helpers'; const mapStateToProps = state => ({ account: state.getIn(['accounts', me]), columns: state.getIn(['settings', 'columns']), + elefriend: state.getIn(['compose', 'elefriend']), results: state.getIn(['search', 'results']), searchHidden: state.getIn(['search', 'hidden']), searchValue: state.getIn(['search', 'value']), @@ -37,6 +40,7 @@ const mapStateToProps = state => ({ const mapDispatchToProps = { onChange: changeSearch, onClear: clearSearch, + onClickElefriend: cycleElefriendCompose, onShow: showSearch, onSubmit: submitSearch, onOpenSettings: openModal.bind(null, 'SETTINGS', {}), @@ -55,10 +59,12 @@ class Drawer extends React.Component { const { account, columns, + elefriend, intl, multiColumn, onChange, onClear, + onClickElefriend, onOpenSettings, onShow, onSubmit, @@ -68,6 +74,10 @@ class Drawer extends React.Component { submitted, } = this.props; + let innerDrawerAttrs = { + className: classNames('drawer--inner', 'mbstobon-' + elefriend), + }; + // The result. return ( <div className='drawer'> @@ -89,7 +99,10 @@ class Drawer extends React.Component { /> <div className='contents'> <DrawerAccount account={account} /> - <Composer /> + <div {...innerDrawerAttrs}> + <Composer /> + {multiColumn && <button className='mastodon' onClick={onClickElefriend} />} + </div> <DrawerResults results={results} visible={submitted && !searchHidden} @@ -110,6 +123,7 @@ Drawer.propTypes = { account: ImmutablePropTypes.map, columns: ImmutablePropTypes.list, results: ImmutablePropTypes.map, + elefriend: PropTypes.number, searchHidden: PropTypes.bool, searchValue: PropTypes.string, submitted: PropTypes.bool, @@ -117,6 +131,7 @@ Drawer.propTypes = { // Dispatch props. onChange: PropTypes.func, onClear: PropTypes.func, + onClickElefriend: PropTypes.func, onShow: PropTypes.func, onSubmit: PropTypes.func, onOpenSettings: PropTypes.func, 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 91a83f330..4c910daec 100644 --- a/app/javascript/flavours/glitch/features/ui/components/onboarding_modal.js +++ b/app/javascript/flavours/glitch/features/ui/components/onboarding_modal.js @@ -38,11 +38,6 @@ PageOne.propTypes = { domain: PropTypes.string.isRequired, }; -const composerState = { - showSearch: true, - text: 'Awoo! #introductions', -}; - const PageTwo = ({ intl, myAccount }) => ( <div className='onboarding-modal__page onboarding-modal__page-two'> <div className='figure non-interactive'> @@ -50,7 +45,8 @@ const PageTwo = ({ intl, myAccount }) => ( <DrawerAccount account={myAccount} /> <RawComposer intl={intl} - state={composerState} + privacy='public' + text='Awoo! #introductions' /> </div> </div> |