about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/ui/components/video_modal.js
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-12-07 04:29:37 +0100
committerClaire <claire.github-309c@sitedethib.com>2021-05-07 22:47:09 +0200
commitd973a90bcc30cc7b42bbb17e83fc1ccf4682a2ef (patch)
treebde21316f385b2a445a6b9c3c72200c93860e9e0 /app/javascript/flavours/glitch/features/ui/components/video_modal.js
parentf29f8caccb29c44a5e14ea3629add1a5dc9fdee9 (diff)
[Glitch] Fix not being able to open audio modal in web UI
Port a8c471fcc043b61aa10cf8f849dfb552db7381d3 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/features/ui/components/video_modal.js')
-rw-r--r--app/javascript/flavours/glitch/features/ui/components/video_modal.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/features/ui/components/video_modal.js b/app/javascript/flavours/glitch/features/ui/components/video_modal.js
index 62273f252..6b6e615a6 100644
--- a/app/javascript/flavours/glitch/features/ui/components/video_modal.js
+++ b/app/javascript/flavours/glitch/features/ui/components/video_modal.js
@@ -3,6 +3,8 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
 import PropTypes from 'prop-types';
 import Video from 'flavours/glitch/features/video';
 import ImmutablePureComponent from 'react-immutable-pure-component';
+import Footer from 'flavours/glitch/features/picture_in_picture/components/footer';
+import { getAverageFromBlurhash } from 'flavours/glitch/blurhash';
 
 export default class VideoModal extends ImmutablePureComponent {
 
@@ -19,10 +21,21 @@ export default class VideoModal extends ImmutablePureComponent {
       defaultVolume: PropTypes.number,
     }),
     onClose: PropTypes.func.isRequired,
+    onChangeBackgroundColor: PropTypes.func.isRequired,
   };
 
+  componentDidMount () {
+    const { media, onChangeBackgroundColor, onClose } = this.props;
+
+    const backgroundColor = getAverageFromBlurhash(media.get('blurhash'));
+
+    if (backgroundColor) {
+      onChangeBackgroundColor(backgroundColor);
+    }
+  }
+
   render () {
-    const { media, onClose } = this.props;
+    const { media, statusId, onClose } = this.props;
     const options = this.props.options || {};
 
     return (
@@ -41,6 +54,10 @@ export default class VideoModal extends ImmutablePureComponent {
             alt={media.get('description')}
           />
         </div>
+
+        <div className='media-modal__overlay'>
+          {statusId && <Footer statusId={statusId} withOpenButton onClose={onClose} />}
+        </div>
       </div>
     );
   }