diff options
Diffstat (limited to 'app/javascript/mastodon/features/direct_timeline/components')
-rw-r--r-- | app/javascript/mastodon/features/direct_timeline/components/conversation.jsx (renamed from app/javascript/mastodon/features/direct_timeline/components/conversation.js) | 25 | ||||
-rw-r--r-- | app/javascript/mastodon/features/direct_timeline/components/conversations_list.jsx (renamed from app/javascript/mastodon/features/direct_timeline/components/conversations_list.js) | 14 |
2 files changed, 20 insertions, 19 deletions
diff --git a/app/javascript/mastodon/features/direct_timeline/components/conversation.js b/app/javascript/mastodon/features/direct_timeline/components/conversation.jsx index 4a770970d..d0dbffe65 100644 --- a/app/javascript/mastodon/features/direct_timeline/components/conversation.js +++ b/app/javascript/mastodon/features/direct_timeline/components/conversation.jsx @@ -24,7 +24,6 @@ const messages = defineMessages({ unmuteConversation: { id: 'status.unmute_conversation', defaultMessage: 'Unmute conversation' }, }); -export default @injectIntl class Conversation extends ImmutablePureComponent { static contextTypes = { @@ -55,7 +54,7 @@ class Conversation extends ImmutablePureComponent { let emoji = emojis[i]; emoji.src = emoji.getAttribute('data-original'); } - } + }; handleMouseLeave = ({ currentTarget }) => { if (autoPlayGif) { @@ -68,7 +67,7 @@ class Conversation extends ImmutablePureComponent { let emoji = emojis[i]; emoji.src = emoji.getAttribute('data-static'); } - } + }; handleClick = () => { if (!this.context.router) { @@ -82,35 +81,35 @@ class Conversation extends ImmutablePureComponent { } this.context.router.history.push(`/@${lastStatus.getIn(['account', 'acct'])}/${lastStatus.get('id')}`); - } + }; handleMarkAsRead = () => { this.props.markRead(); - } + }; handleReply = () => { this.props.reply(this.props.lastStatus, this.context.router.history); - } + }; handleDelete = () => { this.props.delete(); - } + }; handleHotkeyMoveUp = () => { this.props.onMoveUp(this.props.conversationId); - } + }; handleHotkeyMoveDown = () => { this.props.onMoveDown(this.props.conversationId); - } + }; handleConversationMute = () => { this.props.onMute(this.props.lastStatus); - } + }; handleShowMore = () => { this.props.onToggleHidden(this.props.lastStatus); - } + }; render () { const { accounts, lastStatus, unread, scrollKey, intl } = this.props; @@ -145,7 +144,7 @@ class Conversation extends ImmutablePureComponent { return ( <HotKeys handlers={handlers}> - <div className={classNames('conversation focusable muted', { 'conversation--unread': unread })} tabIndex='0'> + <div className={classNames('conversation focusable muted', { 'conversation--unread': unread })} tabIndex={0}> <div className='conversation__avatar' onClick={this.handleClick} role='presentation'> <AvatarComposite accounts={accounts} size={48} /> </div> @@ -198,3 +197,5 @@ class Conversation extends ImmutablePureComponent { } } + +export default injectIntl(Conversation); diff --git a/app/javascript/mastodon/features/direct_timeline/components/conversations_list.js b/app/javascript/mastodon/features/direct_timeline/components/conversations_list.jsx index fd1df7256..04c404e1d 100644 --- a/app/javascript/mastodon/features/direct_timeline/components/conversations_list.js +++ b/app/javascript/mastodon/features/direct_timeline/components/conversations_list.jsx @@ -16,17 +16,17 @@ export default class ConversationsList extends ImmutablePureComponent { onLoadMore: PropTypes.func, }; - getCurrentIndex = id => this.props.conversations.findIndex(x => x.get('id') === id) + getCurrentIndex = id => this.props.conversations.findIndex(x => x.get('id') === id); handleMoveUp = id => { const elementIndex = this.getCurrentIndex(id) - 1; this._selectChild(elementIndex, true); - } + }; handleMoveDown = id => { const elementIndex = this.getCurrentIndex(id) + 1; this._selectChild(elementIndex, false); - } + }; _selectChild (index, align_top) { const container = this.node.node; @@ -44,7 +44,7 @@ export default class ConversationsList extends ImmutablePureComponent { setRef = c => { this.node = c; - } + }; handleLoadOlder = debounce(() => { const last = this.props.conversations.last(); @@ -52,13 +52,13 @@ export default class ConversationsList extends ImmutablePureComponent { if (last && last.get('last_status')) { this.props.onLoadMore(last.get('last_status')); } - }, 300, { leading: true }) + }, 300, { leading: true }); render () { - const { conversations, onLoadMore, ...other } = this.props; + const { conversations, isLoading, onLoadMore, ...other } = this.props; return ( - <ScrollableList {...other} onLoadMore={onLoadMore && this.handleLoadOlder} ref={this.setRef}> + <ScrollableList {...other} isLoading={isLoading} showLoading={isLoading && conversations.isEmpty()} onLoadMore={onLoadMore && this.handleLoadOlder} ref={this.setRef}> {conversations.map(item => ( <ConversationContainer key={item.get('id')} |