diff options
author | pluralcafe-docker <git@plural.cafe> | 2018-12-27 21:35:47 +0000 |
---|---|---|
committer | pluralcafe-docker <git@plural.cafe> | 2018-12-27 21:35:47 +0000 |
commit | 797a8429a0deb511e6d6092edad39f856231534e (patch) | |
tree | 6e44d3c2a5a662dfc4e4087fdc391b8e7bb41dba /app/javascript/flavours/glitch/components | |
parent | 94894b8a6ad1247306497dc8c0c47d52a8a2f72c (diff) | |
parent | f349fe2159fb36e598263f2797f041417ef7c2da (diff) |
Merge branch 'glitch'
Diffstat (limited to 'app/javascript/flavours/glitch/components')
4 files changed, 26 insertions, 13 deletions
diff --git a/app/javascript/flavours/glitch/components/column_header.js b/app/javascript/flavours/glitch/components/column_header.js index 72207637d..87e848a59 100644 --- a/app/javascript/flavours/glitch/components/column_header.js +++ b/app/javascript/flavours/glitch/components/column_header.js @@ -47,6 +47,15 @@ export default class ColumnHeader extends React.PureComponent { animatingNCD: false, }; + historyBack = () => { + // if history is exhausted, or we would leave mastodon, just go to root. + if (window.history.state) { + this.context.router.history.goBack(); + } else { + this.context.router.history.push('/'); + } + } + handleToggleClick = (e) => { e.stopPropagation(); this.setState({ collapsed: !this.state.collapsed, animating: true }); @@ -65,12 +74,7 @@ export default class ColumnHeader extends React.PureComponent { } handleBackClick = () => { - // if history is exhausted, or we would leave mastodon, just go to root. - if (window.history.state) { - this.context.router.history.goBack(); - } else { - this.context.router.history.push('/'); - } + this.historyBack(); } handleTransitionEnd = () => { @@ -81,13 +85,20 @@ export default class ColumnHeader extends React.PureComponent { this.setState({ animatingNCD: false }); } + handlePin = () => { + if (!this.props.pinned) { + this.historyBack(); + } + this.props.onPin(); + } + onEnterCleaningMode = () => { this.setState({ animatingNCD: true }); this.props.onEnterCleaningMode(!this.props.notifCleaningActive); } render () { - const { intl, icon, active, children, pinned, onPin, multiColumn, extraButton, showBackButton, intl: { formatMessage }, notifCleaning, notifCleaningActive } = this.props; + const { intl, icon, active, children, pinned, multiColumn, extraButton, showBackButton, intl: { formatMessage }, notifCleaning, notifCleaningActive } = this.props; const { collapsed, animating, animatingNCD } = this.state; let title = this.props.title; @@ -132,7 +143,7 @@ export default class ColumnHeader extends React.PureComponent { } if (multiColumn && pinned) { - pinButton = <button key='pin-button' className='text-btn column-header__setting-btn' onClick={onPin}><i className='fa fa fa-times' /> <FormattedMessage id='column_header.unpin' defaultMessage='Unpin' /></button>; + pinButton = <button key='pin-button' className='text-btn column-header__setting-btn' onClick={this.handlePin}><i className='fa fa fa-times' /> <FormattedMessage id='column_header.unpin' defaultMessage='Unpin' /></button>; moveButtons = ( <div key='move-buttons' className='column-header__setting-arrows'> @@ -141,7 +152,7 @@ export default class ColumnHeader extends React.PureComponent { </div> ); } else if (multiColumn) { - pinButton = <button key='pin-button' className='text-btn column-header__setting-btn' onClick={onPin}><i className='fa fa fa-plus' /> <FormattedMessage id='column_header.pin' defaultMessage='Pin' /></button>; + pinButton = <button key='pin-button' className='text-btn column-header__setting-btn' onClick={this.handlePin}><i className='fa fa fa-plus' /> <FormattedMessage id='column_header.pin' defaultMessage='Pin' /></button>; } if (!pinned && (multiColumn || showBackButton)) { diff --git a/app/javascript/flavours/glitch/components/modal_root.js b/app/javascript/flavours/glitch/components/modal_root.js index cc26f6a11..7a90e6b8a 100644 --- a/app/javascript/flavours/glitch/components/modal_root.js +++ b/app/javascript/flavours/glitch/components/modal_root.js @@ -39,13 +39,15 @@ export default class ModalRoot extends React.PureComponent { } else if (!nextProps.children) { this.setState({ revealed: false }); } + if (!nextProps.children && !!this.props.children) { + this.activeElement.focus(); + this.activeElement = null; + } } componentDidUpdate (prevProps) { if (!this.props.children && !!prevProps.children) { this.getSiblings().forEach(sibling => sibling.removeAttribute('inert')); - this.activeElement.focus(); - this.activeElement = null; this.handleModalClose(); } if (this.props.children) { diff --git a/app/javascript/flavours/glitch/components/scrollable_list.js b/app/javascript/flavours/glitch/components/scrollable_list.js index bd922462e..21d717b81 100644 --- a/app/javascript/flavours/glitch/components/scrollable_list.js +++ b/app/javascript/flavours/glitch/components/scrollable_list.js @@ -47,7 +47,7 @@ export default class ScrollableList extends PureComponent { const { scrollTop, scrollHeight, clientHeight } = this.node; const offset = scrollHeight - scrollTop - clientHeight; - if (400 > offset && this.props.onLoadMore && !this.props.isLoading) { + if (400 > offset && this.props.onLoadMore && this.props.hasMore && !this.props.isLoading) { this.props.onLoadMore(); } diff --git a/app/javascript/flavours/glitch/components/status_list.js b/app/javascript/flavours/glitch/components/status_list.js index 5249af76d..a7629bd54 100644 --- a/app/javascript/flavours/glitch/components/status_list.js +++ b/app/javascript/flavours/glitch/components/status_list.js @@ -25,7 +25,7 @@ export default class StatusList extends ImmutablePureComponent { prepend: PropTypes.node, alwaysPrepend: PropTypes.bool, emptyMessage: PropTypes.node, - timelineId: PropTypes.string, + timelineId: PropTypes.string.isRequired, }; static defaultProps = { |