diff options
Diffstat (limited to 'app/javascript/flavours/glitch/features')
3 files changed, 25 insertions, 14 deletions
diff --git a/app/javascript/flavours/glitch/features/account/components/header.js b/app/javascript/flavours/glitch/features/account/components/header.js index f0d36947d..dc5b1447b 100644 --- a/app/javascript/flavours/glitch/features/account/components/header.js +++ b/app/javascript/flavours/glitch/features/account/components/header.js @@ -7,7 +7,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component'; import Avatar from 'flavours/glitch/components/avatar'; import IconButton from 'flavours/glitch/components/icon_button'; -import { me } from 'flavours/glitch/util/initial_state'; +import { autoPlayGif, me } from 'flavours/glitch/util/initial_state'; import classNames from 'classnames'; const messages = defineMessages({ @@ -108,7 +108,7 @@ export default class Header extends ImmutablePureComponent { return ( <div className='account__header__wrapper'> - <div className={classNames('account__header', { inactive: !!account.get('moved') })} style={{ backgroundImage: `url(${account.get('header')})` }}> + <div className={classNames('account__header', { inactive: !!account.get('moved') })} style={{ backgroundImage: `url(${autoPlayGif ? account.get('header') : account.get('header_static')})` }}> <div> <a href={account.get('url')} diff --git a/app/javascript/flavours/glitch/features/account_gallery/index.js b/app/javascript/flavours/glitch/features/account_gallery/index.js index 53b906d16..3f61af0e8 100644 --- a/app/javascript/flavours/glitch/features/account_gallery/index.js +++ b/app/javascript/flavours/glitch/features/account_gallery/index.js @@ -35,7 +35,7 @@ class LoadMoreMedia extends ImmutablePureComponent { return ( <LoadMore disabled={this.props.disabled} - onLoadMore={this.handleLoadMore} + onClick={this.handleLoadMore} /> ); } @@ -67,7 +67,7 @@ export default class AccountGallery extends ImmutablePureComponent { handleScrollToBottom = () => { if (this.props.hasMore) { - this.handleLoadMore(this.props.medias.last().getIn(['status', 'id'])); + this.handleLoadMore(this.props.medias.size > 0 ? this.props.medias.last().getIn(['status', 'id']) : undefined); } } @@ -107,8 +107,8 @@ export default class AccountGallery extends ImmutablePureComponent { ); } - if (!isLoading && medias.size > 0 && hasMore) { - loadOlder = <LoadMore onClick={this.handleLoadOlder} />; + if (hasMore) { + loadOlder = <LoadMore visible={!isLoading} onClick={this.handleLoadOlder} />; } return ( @@ -116,14 +116,15 @@ export default class AccountGallery extends ImmutablePureComponent { <ColumnBackButton /> <ScrollContainer scrollKey='account_gallery' shouldUpdateScroll={this.shouldUpdateScroll}> - <div className='scrollable' onScroll={this.handleScroll}> + <div className='scrollable scrollable--flex' onScroll={this.handleScroll}> <HeaderContainer accountId={this.props.params.accountId} /> - <div className='account-gallery__container'> + <div role='feed' className='account-gallery__container'> {medias.map((media, index) => media === null ? ( <LoadMoreMedia key={'more:' + medias.getIn(index + 1, 'id')} maxId={index > 0 ? medias.getIn(index - 1, 'id') : null} + onLoadMore={this.handleLoadMore} /> ) : ( <MediaItem @@ -133,6 +134,12 @@ export default class AccountGallery extends ImmutablePureComponent { ))} {loadOlder} </div> + + {isLoading && medias.size === 0 && ( + <div className='scrollable__append'> + <LoadingIndicator /> + </div> + )} </div> </ScrollContainer> </Column> diff --git a/app/javascript/flavours/glitch/features/composer/index.js b/app/javascript/flavours/glitch/features/composer/index.js index 029b11a36..40eae1f53 100644 --- a/app/javascript/flavours/glitch/features/composer/index.js +++ b/app/javascript/flavours/glitch/features/composer/index.js @@ -159,15 +159,15 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ onSelectSuggestion(position, token, suggestion) { dispatch(selectComposeSuggestion(position, token, suggestion)); }, - onMediaDescriptionConfirm() { + onMediaDescriptionConfirm(routerHistory) { dispatch(openModal('CONFIRM', { message: intl.formatMessage(messages.missingDescriptionMessage), confirm: intl.formatMessage(messages.missingDescriptionConfirm), - onConfirm: () => dispatch(submitCompose()), + onConfirm: () => dispatch(submitCompose(routerHistory)), })); }, - onSubmit() { - dispatch(submitCompose()); + onSubmit(routerHistory) { + dispatch(submitCompose(routerHistory)); }, onUndoUpload(id) { dispatch(undoUploadCompose(id)); @@ -256,9 +256,9 @@ const handlers = { inputs[firstWithoutDescription].focus(); } } - onMediaDescriptionConfirm(); + onMediaDescriptionConfirm(this.context.router ? this.context.router.history : null); } else if (onSubmit) { - onSubmit(); + onSubmit(this.context.router ? this.context.router.history : null); } }, @@ -563,6 +563,10 @@ Composer.propTypes = { onMediaDescriptionConfirm: PropTypes.func, }; +Composer.contextTypes = { + router: PropTypes.object, +}; + // Connecting and export. export { Composer as WrappedComponent }; export default wrap(Composer, mapStateToProps, mapDispatchToProps, true); |