From 71302f6dec5bba30f9175052d56c4ec43cd7bdfb Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Thu, 18 Apr 2019 15:08:55 -0500 Subject: Handle up to 6 attachments per roar. --- app/javascript/flavours/glitch/actions/compose.js | 4 +- .../flavours/glitch/components/media_gallery.js | 52 +++------------------- .../compose/containers/options_container.js | 2 +- .../flavours/glitch/styles/components/media.scss | 1 - 4 files changed, 8 insertions(+), 51 deletions(-) (limited to 'app/javascript/flavours/glitch') diff --git a/app/javascript/flavours/glitch/actions/compose.js b/app/javascript/flavours/glitch/actions/compose.js index ab4277f54..e3f0f35b5 100644 --- a/app/javascript/flavours/glitch/actions/compose.js +++ b/app/javascript/flavours/glitch/actions/compose.js @@ -229,7 +229,7 @@ export function doodleSet(options) { export function uploadCompose(files) { return function (dispatch, getState) { - const uploadLimit = 4; + const uploadLimit = 6; const media = getState().getIn(['compose', 'media_attachments']); const progress = new Array(files.length).fill(0); let total = Array.from(files).reduce((a, v) => a + v.size, 0); @@ -247,7 +247,7 @@ export function uploadCompose(files) { dispatch(uploadComposeRequest()); for (const [i, f] of Array.from(files).entries()) { - if (media.size + i > 3) break; + if (media.size + i > 5) break; resizeImage(f).then(file => { const data = new FormData(); diff --git a/app/javascript/flavours/glitch/components/media_gallery.js b/app/javascript/flavours/glitch/components/media_gallery.js index 62ef1da5e..89f0af1f8 100644 --- a/app/javascript/flavours/glitch/components/media_gallery.js +++ b/app/javascript/flavours/glitch/components/media_gallery.js @@ -141,54 +141,12 @@ class Item extends React.PureComponent { const { attachment, index, size, standalone, letterbox, displayWidth, visible } = this.props; let width = 50; - let height = 100; - let top = 'auto'; - let left = 'auto'; - let bottom = 'auto'; - let right = 'auto'; + let height = 100 / Math.ceil(size/2); if (size === 1) { width = 100; } - if (size === 4 || (size === 3 && index > 0)) { - height = 50; - } - - if (size === 2) { - if (index === 0) { - right = '2px'; - } else { - left = '2px'; - } - } else if (size === 3) { - if (index === 0) { - right = '2px'; - } else if (index > 0) { - left = '2px'; - } - - if (index === 1) { - bottom = '2px'; - } else if (index > 1) { - top = '2px'; - } - } else if (size === 4) { - if (index === 0 || index === 2) { - right = '2px'; - } - - if (index === 1 || index === 3) { - left = '2px'; - } - - if (index < 2) { - bottom = '2px'; - } else { - top = '2px'; - } - } - let thumbnail = ''; if (attachment.get('type') === 'unknown') { @@ -289,7 +247,7 @@ class Item extends React.PureComponent { } return ( -
+
{visible && thumbnail}
@@ -366,7 +324,7 @@ export default class MediaGallery extends React.PureComponent { render () { const { media, intl, sensitive, letterbox, fullwidth, defaultWidth } = this.props; const { visible } = this.state; - const size = media.take(4).size; + const size = media.take(6).size; const width = this.state.width || defaultWidth; @@ -387,7 +345,7 @@ export default class MediaGallery extends React.PureComponent { if (this.isStandaloneEligible()) { children = ; } else { - children = media.take(4).map((attachment, i) => ); + children = media.take(6).map((attachment, i) => ); } if (visible) { @@ -401,7 +359,7 @@ export default class MediaGallery extends React.PureComponent { } let descriptions; - descriptions = media.take(4).map( + descriptions = media.take(6).map( (attachment, i) => { if (attachment.get('description')) return

Attachment {1+i}: {attachment.get('description')}

diff --git a/app/javascript/flavours/glitch/features/compose/containers/options_container.js b/app/javascript/flavours/glitch/features/compose/containers/options_container.js index c8c7ecd43..ee15ffd6e 100644 --- a/app/javascript/flavours/glitch/features/compose/containers/options_container.js +++ b/app/javascript/flavours/glitch/features/compose/containers/options_container.js @@ -16,7 +16,7 @@ function mapStateToProps (state) { acceptContentTypes: state.getIn(['media_attachments', 'accept_content_types']).toArray().join(','), resetFileKey: state.getIn(['compose', 'resetFileKey']), hasPoll: !!poll, - allowMedia: !poll && (media ? media.size < 4 && !media.some(item => item.get('type') === 'video') : true), + allowMedia: !poll && (media ? media.size < 6 && !media.some(item => item.get('type') === 'video') : true), hasMedia: media && !!media.size, allowPoll: !(media && !!media.size), showContentTypeChoice: state.getIn(['local_settings', 'show_content_type_choice']), diff --git a/app/javascript/flavours/glitch/styles/components/media.scss b/app/javascript/flavours/glitch/styles/components/media.scss index 346f5a271..235663fcd 100644 --- a/app/javascript/flavours/glitch/styles/components/media.scss +++ b/app/javascript/flavours/glitch/styles/components/media.scss @@ -93,7 +93,6 @@ box-sizing: border-box; display: block; float: left; - position: relative; border-radius: 4px; overflow: hidden; -- cgit