From 1fa03e026adbf0c45bd4384b58a93ddc9838b5ec Mon Sep 17 00:00:00 2001 From: kibi! Date: Sun, 14 Jan 2018 14:13:24 -0800 Subject: [PATCH] Fixes onboarding modal (#318) --- .../glitch/features/composer/index.js | 8 ++-- .../options/dropdown/content/index.js | 6 +-- .../glitch/features/composer/options/index.js | 48 +++++++++---------- .../ui/components/onboarding_modal.js | 9 ++-- 4 files changed, 33 insertions(+), 38 deletions(-) diff --git a/app/javascript/flavours/glitch/features/composer/index.js b/app/javascript/flavours/glitch/features/composer/index.js index cae9bf9f2a..29a2f47753 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} /> - {items.map( + {items ? items.map( ({ name, ...rest @@ -110,7 +110,7 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent options={rest} /> ) - )} + ) : null} )} @@ -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 954508c116..c129622bc2 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 ? ( - !!value)} - disabled={disabled} - icon='ellipsis-h' - items={[ - { - meta: , - name: 'do_not_federate', - on: advancedOptions.get('do_not_federate'), - text: , - }, - { - meta: , - name: 'threaded_mode', - on: advancedOptions.get('threaded_mode'), - text: , - }, - ]} - onChange={onChangeAdvancedOption} - onModalClose={onModalClose} - onModalOpen={onModalOpen} - title={intl.formatMessage(messages.advanced_options_icon_title)} - /> - ) : null} + !!value)} + disabled={disabled} + icon='ellipsis-h' + items={advancedOptions ? [ + { + meta: , + name: 'do_not_federate', + on: advancedOptions.get('do_not_federate'), + text: , + }, + { + meta: , + name: 'threaded_mode', + on: advancedOptions.get('threaded_mode'), + text: , + }, + ] : null} + onChange={onChangeAdvancedOption} + onModalClose={onModalClose} + onModalOpen={onModalOpen} + title={intl.formatMessage(messages.advanced_options_icon_title)} + /> ); } 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 91a83f330a..6ba457974d 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 }) => (
@@ -50,7 +45,9 @@ const PageTwo = ({ intl, myAccount }) => (