Fixes onboarding modal (#318)

main
kibi! 7 years ago
parent a5931e1f48
commit 1fa03e026a

@ -350,10 +350,10 @@ class Composer extends React.Component {
acceptContentTypes={acceptContentTypes} acceptContentTypes={acceptContentTypes}
advancedOptions={advancedOptions} advancedOptions={advancedOptions}
disabled={isSubmitting} disabled={isSubmitting}
full={media.size >= 4 || media.some( full={media ? media.size >= 4 || media.some(
item => item.get('type') === 'video' item => item.get('type') === 'video'
)} ) : false}
hasMedia={!!media.size} hasMedia={media && !!media.size}
intl={intl} intl={intl}
onChangeAdvancedOption={onChangeAdvancedOption} onChangeAdvancedOption={onChangeAdvancedOption}
onChangeSensitivity={onChangeSensitivity} onChangeSensitivity={onChangeSensitivity}
@ -369,7 +369,7 @@ class Composer extends React.Component {
spoiler={spoiler} spoiler={spoiler}
/> />
<ComposerPublisher <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} disabled={isSubmitting || isUploading || !!text.length && !text.trim().length}
intl={intl} intl={intl}
onSecondarySubmit={handleSecondarySubmit} onSecondarySubmit={handleSecondarySubmit}

@ -96,7 +96,7 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent
transform: `scale(${scaleX}, ${scaleY})`, transform: `scale(${scaleX}, ${scaleY})`,
}} }}
> >
{items.map( {items ? items.map(
({ ({
name, name,
...rest ...rest
@ -110,7 +110,7 @@ export default class ComposerOptionsDropdownContent extends React.PureComponent
options={rest} options={rest}
/> />
) )
)} ) : null}
</div> </div>
)} )}
</Motion> </Motion>
@ -127,7 +127,7 @@ ComposerOptionsDropdownContent.propTypes = {
name: PropTypes.string.isRequired, name: PropTypes.string.isRequired,
on: PropTypes.bool, on: PropTypes.bool,
text: PropTypes.node, text: PropTypes.node,
})).isRequired, })),
onChange: PropTypes.func, onChange: PropTypes.func,
onClose: PropTypes.func, onClose: PropTypes.func,
style: PropTypes.object, style: PropTypes.object,

@ -292,12 +292,11 @@ export default class ComposerOptions extends React.PureComponent {
onClick={onToggleSpoiler} onClick={onToggleSpoiler}
title={intl.formatMessage(messages.spoiler)} title={intl.formatMessage(messages.spoiler)}
/> />
{advancedOptions ? (
<Dropdown <Dropdown
active={advancedOptions.some(value => !!value)} active={advancedOptions && advancedOptions.some(value => !!value)}
disabled={disabled} disabled={disabled}
icon='ellipsis-h' icon='ellipsis-h'
items={[ items={advancedOptions ? [
{ {
meta: <FormattedMessage {...messages.local_only_long} />, meta: <FormattedMessage {...messages.local_only_long} />,
name: 'do_not_federate', name: 'do_not_federate',
@ -310,13 +309,12 @@ export default class ComposerOptions extends React.PureComponent {
on: advancedOptions.get('threaded_mode'), on: advancedOptions.get('threaded_mode'),
text: <FormattedMessage {...messages.threaded_mode_short} />, text: <FormattedMessage {...messages.threaded_mode_short} />,
}, },
]} ] : null}
onChange={onChangeAdvancedOption} onChange={onChangeAdvancedOption}
onModalClose={onModalClose} onModalClose={onModalClose}
onModalOpen={onModalOpen} onModalOpen={onModalOpen}
title={intl.formatMessage(messages.advanced_options_icon_title)} title={intl.formatMessage(messages.advanced_options_icon_title)}
/> />
) : null}
</div> </div>
); );
} }

@ -38,11 +38,6 @@ PageOne.propTypes = {
domain: PropTypes.string.isRequired, domain: PropTypes.string.isRequired,
}; };
const composerState = {
showSearch: true,
text: 'Awoo! #introductions',
};
const PageTwo = ({ intl, myAccount }) => ( const PageTwo = ({ intl, myAccount }) => (
<div className='onboarding-modal__page onboarding-modal__page-two'> <div className='onboarding-modal__page onboarding-modal__page-two'>
<div className='figure non-interactive'> <div className='figure non-interactive'>
@ -50,7 +45,9 @@ const PageTwo = ({ intl, myAccount }) => (
<DrawerAccount account={myAccount} /> <DrawerAccount account={myAccount} />
<RawComposer <RawComposer
intl={intl} intl={intl}
state={composerState} privacy='public'
showSearch
text='Awoo! #introductions'
/> />
</div> </div>
</div> </div>

Loading…
Cancel
Save