diff options
Diffstat (limited to 'app/javascript/mastodon/features/account_gallery')
-rw-r--r-- | app/javascript/mastodon/features/account_gallery/components/media_item.jsx (renamed from app/javascript/mastodon/features/account_gallery/components/media_item.js) | 15 | ||||
-rw-r--r-- | app/javascript/mastodon/features/account_gallery/index.jsx (renamed from app/javascript/mastodon/features/account_gallery/index.js) | 15 |
2 files changed, 17 insertions, 13 deletions
diff --git a/app/javascript/mastodon/features/account_gallery/components/media_item.js b/app/javascript/mastodon/features/account_gallery/components/media_item.jsx index 13fd7fe03..00526016d 100644 --- a/app/javascript/mastodon/features/account_gallery/components/media_item.js +++ b/app/javascript/mastodon/features/account_gallery/components/media_item.jsx @@ -22,20 +22,20 @@ export default class MediaItem extends ImmutablePureComponent { handleImageLoad = () => { this.setState({ loaded: true }); - } + }; handleMouseEnter = e => { if (this.hoverToPlay()) { e.target.play(); } - } + }; handleMouseLeave = e => { if (this.hoverToPlay()) { e.target.pause(); e.target.currentTime = 0; } - } + }; hoverToPlay () { return !autoPlayGif && ['gifv', 'video'].indexOf(this.props.attachment.get('type')) !== -1; @@ -51,7 +51,7 @@ export default class MediaItem extends ImmutablePureComponent { this.setState({ visible: true }); } } - } + }; render () { const { attachment, displayWidth } = this.props; @@ -74,8 +74,9 @@ export default class MediaItem extends ImmutablePureComponent { if (['audio', 'video'].includes(attachment.get('type'))) { content = ( <img - src={attachment.get('preview_url') || attachment.getIn(['account', 'avatar_static'])} + src={attachment.get('preview_url') || status.getIn(['account', 'avatar_static'])} alt={attachment.get('description')} + lang={status.get('language')} onLoad={this.handleImageLoad} /> ); @@ -95,6 +96,7 @@ export default class MediaItem extends ImmutablePureComponent { <img src={attachment.get('preview_url')} alt={attachment.get('description')} + lang={status.get('language')} style={{ objectPosition: `${x}% ${y}%` }} onLoad={this.handleImageLoad} /> @@ -105,6 +107,7 @@ export default class MediaItem extends ImmutablePureComponent { className='media-gallery__item-gifv-thumbnail' aria-label={attachment.get('description')} title={attachment.get('description')} + lang={status.get('language')} role='application' src={attachment.get('url')} onMouseEnter={this.handleMouseEnter} @@ -130,7 +133,7 @@ export default class MediaItem extends ImmutablePureComponent { return ( <div className='account-gallery__item' style={{ width, height }}> - <a className='media-gallery__item-thumbnail' href={`/@${status.getIn(['account', 'acct'])}\/${status.get('id')}`} onClick={this.handleClick} title={title} target='_blank' rel='noopener noreferrer'> + <a className='media-gallery__item-thumbnail' href={`/@${status.getIn(['account', 'acct'])}/${status.get('id')}`} onClick={this.handleClick} title={title} target='_blank' rel='noopener noreferrer'> <Blurhash hash={attachment.get('blurhash')} className={classNames('media-gallery__preview', { 'media-gallery__preview--hidden': visible && loaded })} diff --git a/app/javascript/mastodon/features/account_gallery/index.js b/app/javascript/mastodon/features/account_gallery/index.jsx index dc7556a9a..db76507db 100644 --- a/app/javascript/mastodon/features/account_gallery/index.js +++ b/app/javascript/mastodon/features/account_gallery/index.jsx @@ -47,7 +47,7 @@ class LoadMoreMedia extends ImmutablePureComponent { handleLoadMore = () => { this.props.onLoadMore(this.props.maxId); - } + }; render () { return ( @@ -60,7 +60,6 @@ class LoadMoreMedia extends ImmutablePureComponent { } -export default @connect(mapStateToProps) class AccountGallery extends ImmutablePureComponent { static propTypes = { @@ -114,7 +113,7 @@ class AccountGallery extends ImmutablePureComponent { if (this.props.hasMore) { this.handleLoadMore(this.props.attachments.size > 0 ? this.props.attachments.last().getIn(['status', 'id']) : undefined); } - } + }; handleScroll = e => { const { scrollTop, scrollHeight, clientHeight } = e.target; @@ -123,7 +122,7 @@ class AccountGallery extends ImmutablePureComponent { if (150 > offset && !this.props.isLoading) { this.handleScrollToBottom(); } - } + }; handleLoadMore = maxId => { this.props.dispatch(expandAccountMediaTimeline(this.props.accountId, { maxId })); @@ -132,7 +131,7 @@ class AccountGallery extends ImmutablePureComponent { handleLoadOlder = e => { e.preventDefault(); this.handleScrollToBottom(); - } + }; handleOpenMedia = attachment => { const { dispatch } = this.props; @@ -148,13 +147,13 @@ class AccountGallery extends ImmutablePureComponent { dispatch(openModal('MEDIA', { media, index, statusId })); } - } + }; handleRef = c => { if (c) { this.setState({ width: c.offsetWidth }); } - } + }; render () { const { attachments, isLoading, hasMore, isAccount, multiColumn, blockedBy, suspended } = this.props; @@ -226,3 +225,5 @@ class AccountGallery extends ImmutablePureComponent { } } + +export default connect(mapStateToProps)(AccountGallery); |