From 6839ee390f302b44ac0c6895ed8df7bdf8c8c00b Mon Sep 17 00:00:00 2001 From: kibigo! Date: Thu, 29 Jun 2017 23:31:22 -0700 Subject: [PATCH] Many improvements to images in collapsed toots - Now works on detailed and static pages - Fixed bug with nested CW / Sensitive Media - Now apparent which toots contain media --- app/javascript/mastodon/components/status.js | 5 ++- .../mastodon/components/status_content.js | 32 ++++++++++++------- .../status/components/detailed_status.js | 11 +++---- app/javascript/styles/components.scss | 17 +++++++--- .../stream_entries/_content_spoiler.html.haml | 2 +- .../stream_entries/_detailed_status.html.haml | 29 +++++++++-------- app/views/stream_entries/_media.html.haml | 2 +- .../stream_entries/_simple_status.html.haml | 31 +++++++++--------- 8 files changed, 75 insertions(+), 54 deletions(-) diff --git a/app/javascript/mastodon/components/status.js b/app/javascript/mastodon/components/status.js index 2d898ac3c..0575ebd38 100644 --- a/app/javascript/mastodon/components/status.js +++ b/app/javascript/mastodon/components/status.js @@ -152,6 +152,7 @@ export default class Status extends ImmutablePureComponent { render () { let media = null; + let mediaIcon = null; let statusAvatar; // Exclude intersectionObserverWrapper from `other` variable @@ -198,8 +199,10 @@ export default class Status extends ImmutablePureComponent { } else if (status.getIn(['media_attachments', 0, 'type']) === 'video') { media = ; + mediaIcon = 'video-camera'; } else { media = ; + mediaIcon = 'picture-o'; } } @@ -223,7 +226,7 @@ export default class Status extends ImmutablePureComponent { - + {media} diff --git a/app/javascript/mastodon/components/status_content.js b/app/javascript/mastodon/components/status_content.js index 56e017936..9a2d79200 100644 --- a/app/javascript/mastodon/components/status_content.js +++ b/app/javascript/mastodon/components/status_content.js @@ -19,6 +19,7 @@ export default class StatusContent extends React.PureComponent { onExpandedToggle: PropTypes.func, onHeightUpdate: PropTypes.func, onClick: PropTypes.func, + mediaIcon: PropTypes.string, children: PropTypes.element, }; @@ -108,7 +109,7 @@ export default class StatusContent extends React.PureComponent { } render () { - const { status, children } = this.props; + const { status, children, mediaIcon } = this.props; const hidden = this.props.onExpandedToggle ? !this.props.expanded : this.state.hidden; @@ -129,15 +130,19 @@ export default class StatusContent extends React.PureComponent { )).reduce((aggregate, item) => [...aggregate, item, ' '], []); - const toggleText = hidden ? : ; + const toggleText = hidden ? [, mediaIcon ?