From bde35e7878c81a3f87b8f6876592c7d054bd2e5d Mon Sep 17 00:00:00 2001 From: Nima Boscarino Date: Fri, 25 Oct 2019 02:48:20 -0700 Subject: [PATCH] [Glitch] Add download button to audio and video players Port 9b36f62df63003419cb2ca08e77f2fa69fed91ad to glitch-soc Signed-off-by: Thibaut Girka --- app/javascript/flavours/glitch/features/audio/index.js | 9 +++++++++ app/javascript/flavours/glitch/features/video/index.js | 7 +++++++ .../flavours/glitch/styles/components/media.scss | 4 ++++ 3 files changed, 20 insertions(+) diff --git a/app/javascript/flavours/glitch/features/audio/index.js b/app/javascript/flavours/glitch/features/audio/index.js index 26621cebcf..033d92adf7 100644 --- a/app/javascript/flavours/glitch/features/audio/index.js +++ b/app/javascript/flavours/glitch/features/audio/index.js @@ -12,6 +12,7 @@ const messages = defineMessages({ pause: { id: 'video.pause', defaultMessage: 'Pause' }, mute: { id: 'video.mute', defaultMessage: 'Mute sound' }, unmute: { id: 'video.unmute', defaultMessage: 'Unmute sound' }, + download: { id: 'video.download', defaultMessage: 'Download file' }, }); export default @injectIntl @@ -218,6 +219,14 @@ class Audio extends React.PureComponent { {formatTime(this.state.duration || Math.floor(this.props.duration))} + +
+ +
diff --git a/app/javascript/flavours/glitch/features/video/index.js b/app/javascript/flavours/glitch/features/video/index.js index 07602838d1..39dab7ec75 100644 --- a/app/javascript/flavours/glitch/features/video/index.js +++ b/app/javascript/flavours/glitch/features/video/index.js @@ -19,6 +19,7 @@ const messages = defineMessages({ close: { id: 'video.close', defaultMessage: 'Close video' }, fullscreen: { id: 'video.fullscreen', defaultMessage: 'Full screen' }, exit_fullscreen: { id: 'video.exit_fullscreen', defaultMessage: 'Exit full screen' }, + download: { id: 'video.download', defaultMessage: 'Download file' }, }); export const formatTime = secondsNum => { @@ -514,7 +515,13 @@ class Video extends React.PureComponent { {(!onCloseVideo && !editable) && } {(!fullscreen && onOpenVideo) && } {onCloseVideo && } + + diff --git a/app/javascript/flavours/glitch/styles/components/media.scss b/app/javascript/flavours/glitch/styles/components/media.scss index 5a176efbda..a298b91ca7 100644 --- a/app/javascript/flavours/glitch/styles/components/media.scss +++ b/app/javascript/flavours/glitch/styles/components/media.scss @@ -504,6 +504,10 @@ display: flex; justify-content: space-between; padding-bottom: 10px; + + .video-player__download__icon { + color: inherit; + } } &__buttons {