diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-04-13 17:01:52 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-04-13 17:01:52 +0200 |
commit | 6327f69cab101ce1409789d7446365c4afe11aa3 (patch) | |
tree | ba68ce1440f33189a1ac16ebb793e35f75c3d73d /app/assets/javascripts/components/features | |
parent | d7a4e8739a9297c8a4b593c076bdcd7abd881453 (diff) | |
parent | 5f8155482ab494e9b509f61baad7e3d5303176f1 (diff) |
Merge branch 'blackle-videolightbox'
Diffstat (limited to 'app/assets/javascripts/components/features')
5 files changed, 58 insertions, 4 deletions
diff --git a/app/assets/javascripts/components/features/status/components/detailed_status.jsx b/app/assets/javascripts/components/features/status/components/detailed_status.jsx index 2da57252e..ceafc1a32 100644 --- a/app/assets/javascripts/components/features/status/components/detailed_status.jsx +++ b/app/assets/javascripts/components/features/status/components/detailed_status.jsx @@ -17,7 +17,8 @@ const DetailedStatus = React.createClass({ propTypes: { status: ImmutablePropTypes.map.isRequired, - onOpenMedia: React.PropTypes.func.isRequired + onOpenMedia: React.PropTypes.func.isRequired, + onOpenVideo: React.PropTypes.func.isRequired, }, mixins: [PureRenderMixin], @@ -39,7 +40,7 @@ const DetailedStatus = React.createClass({ if (status.get('media_attachments').size > 0) { if (status.getIn(['media_attachments', 0, 'type']) === 'video') { - media = <VideoPlayer sensitive={status.get('sensitive')} media={status.getIn(['media_attachments', 0])} width={300} height={150} autoplay />; + media = <VideoPlayer sensitive={status.get('sensitive')} media={status.getIn(['media_attachments', 0])} width={300} height={150} onOpenVideo={this.props.onOpenVideo} autoplay />; } else { media = <MediaGallery sensitive={status.get('sensitive')} media={status.get('media_attachments')} height={300} onOpenMedia={this.props.onOpenMedia} />; } diff --git a/app/assets/javascripts/components/features/status/index.jsx b/app/assets/javascripts/components/features/status/index.jsx index 48fea658d..7ead68807 100644 --- a/app/assets/javascripts/components/features/status/index.jsx +++ b/app/assets/javascripts/components/features/status/index.jsx @@ -112,6 +112,10 @@ const Status = React.createClass({ this.props.dispatch(openModal('MEDIA', { media, index })); }, + handleOpenVideo (media, time) { + this.props.dispatch(openModal('VIDEO', { media, time })); + }, + handleReport (status) { this.props.dispatch(initReport(status.get('account'), status)); }, @@ -151,7 +155,7 @@ const Status = React.createClass({ <div className='scrollable'> {ancestors} - <DetailedStatus status={status} me={me} onOpenMedia={this.handleOpenMedia} /> + <DetailedStatus status={status} me={me} onOpenVideo={this.handleOpenVideo} onOpenMedia={this.handleOpenMedia} /> <ActionBar status={status} me={me} onReply={this.handleReplyClick} onFavourite={this.handleFavouriteClick} onReblog={this.handleReblogClick} onDelete={this.handleDeleteClick} onMention={this.handleMentionClick} onReport={this.handleReport} /> {descendants} diff --git a/app/assets/javascripts/components/features/ui/components/media_modal.jsx b/app/assets/javascripts/components/features/ui/components/media_modal.jsx index 35eb2cb0c..130f48b46 100644 --- a/app/assets/javascripts/components/features/ui/components/media_modal.jsx +++ b/app/assets/javascripts/components/features/ui/components/media_modal.jsx @@ -111,7 +111,7 @@ const MediaModal = React.createClass({ if (attachment.get('type') === 'image') { content = <ImageLoader src={url} imgProps={{ style: { display: 'block' } }} />; } else if (attachment.get('type') === 'gifv') { - content = <ExtendedVideoPlayer src={url} />; + content = <ExtendedVideoPlayer src={url} muted={true} controls={false} />; } return ( diff --git a/app/assets/javascripts/components/features/ui/components/modal_root.jsx b/app/assets/javascripts/components/features/ui/components/modal_root.jsx index e7ac02dde..74eb50039 100644 --- a/app/assets/javascripts/components/features/ui/components/modal_root.jsx +++ b/app/assets/javascripts/components/features/ui/components/modal_root.jsx @@ -1,10 +1,12 @@ import PureRenderMixin from 'react-addons-pure-render-mixin'; import MediaModal from './media_modal'; +import VideoModal from './video_modal'; import BoostModal from './boost_modal'; import { TransitionMotion, spring } from 'react-motion'; const MODAL_COMPONENTS = { 'MEDIA': MediaModal, + 'VIDEO': VideoModal, 'BOOST': BoostModal }; diff --git a/app/assets/javascripts/components/features/ui/components/video_modal.jsx b/app/assets/javascripts/components/features/ui/components/video_modal.jsx new file mode 100644 index 000000000..1c3519bd3 --- /dev/null +++ b/app/assets/javascripts/components/features/ui/components/video_modal.jsx @@ -0,0 +1,47 @@ +import LoadingIndicator from '../../../components/loading_indicator'; +import PureRenderMixin from 'react-addons-pure-render-mixin'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import ExtendedVideoPlayer from '../../../components/extended_video_player'; +import { defineMessages, injectIntl } from 'react-intl'; +import IconButton from '../../../components/icon_button'; + +const messages = defineMessages({ + close: { id: 'lightbox.close', defaultMessage: 'Close' } +}); + +const closeStyle = { + position: 'absolute', + zIndex: '100', + top: '4px', + right: '4px' +}; + +const VideoModal = React.createClass({ + + propTypes: { + media: ImmutablePropTypes.map.isRequired, + time: React.PropTypes.number, + onClose: React.PropTypes.func.isRequired, + intl: React.PropTypes.object.isRequired + }, + + mixins: [PureRenderMixin], + + render () { + const { media, intl, time, onClose } = this.props; + + const url = media.get('url'); + + return ( + <div className='modal-root__modal media-modal'> + <div> + <div style={closeStyle}><IconButton title={intl.formatMessage(messages.close)} icon='times' overlay onClick={onClose} /></div> + <ExtendedVideoPlayer src={url} muted={false} controls={true} time={time} /> + </div> + </div> + ); + } + +}); + +export default injectIntl(VideoModal); |