Add videos to be played across all pages. #1523
6 changed files with 68 additions and 22 deletions
|
@ -1,9 +1,14 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { selectPlayingUri } from 'redux/selectors/content';
|
||||
import { doSetPlayingUri } from 'redux/actions/content';
|
||||
import VideoOverlay from './view';
|
||||
|
||||
const select = state => ({
|
||||
playingUri: selectPlayingUri(state),
|
||||
});
|
||||
|
||||
export default connect(select, null)(VideoOverlay);
|
||||
const perform = dispatch => ({
|
||||
cancelPlay: () => dispatch(doSetPlayingUri(null)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(VideoOverlay);
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
// @flow
|
||||
import React from 'react';
|
||||
import Video from 'component/video';
|
||||
import FileActions from 'component/fileActions';
|
||||
import Overlay from 'component/overlay';
|
||||
import VideoOverlayHeader from '../videoOverlayHeader';
|
||||
|
||||
type Props = {
|
||||
cancelPlay: () => void,
|
||||
playingUri: ?string,
|
||||
};
|
||||
|
||||
class VideoOverlay extends React.Component<Props> {
|
||||
render() {
|
||||
const { playingUri } = this.props;
|
||||
const { playingUri, cancelPlay } = this.props;
|
||||
if (!playingUri) return '';
|
||||
return (
|
||||
<Overlay>
|
||||
<div className="card-media__internal-links">
|
||||
<FileActions uri={playingUri} vertical />
|
||||
</div>
|
||||
{playingUri ? <Video className="content__embedded" uri={playingUri} overlayed /> : ''}
|
||||
<VideoOverlayHeader uri={playingUri} onClose={cancelPlay} />
|
||||
<Video className="content__embedded" uri={playingUri} overlayed />
|
||||
</Overlay>
|
||||
);
|
||||
}
|
||||
|
|
10
src/renderer/component/videoOverlayHeader/index.js
Normal file
10
src/renderer/component/videoOverlayHeader/index.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { makeSelectTitleForUri } from 'lbry-redux';
|
||||
import VideoOverlayHeader from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
title: makeSelectTitleForUri(props.uri)(state),
|
||||
onClose: props.onClose,
|
||||
});
|
||||
|
||||
export default connect(select, null)(VideoOverlayHeader);
|
31
src/renderer/component/videoOverlayHeader/view.jsx
Normal file
31
src/renderer/component/videoOverlayHeader/view.jsx
Normal file
|
@ -0,0 +1,31 @@
|
|||
// @flow
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import * as icons from 'constants/icons';
|
||||
import TruncatedText from 'component/common/truncated-text';
|
||||
|
||||
type Props = {
|
||||
onClose: () => void,
|
||||
title: string,
|
||||
};
|
||||
|
||||
class VideoOverlayHeader extends React.Component<Props> {
|
||||
render() {
|
||||
const { onClose, title } = this.props;
|
||||
return (
|
||||
<header className="video_overlay__header">
|
||||
<h4 className="overlay__title--small">
|
||||
<TruncatedText lines={2}>{title}</TruncatedText>
|
||||
</h4>
|
||||
<Button
|
||||
icon={icons.CLOSE}
|
||||
onClick={() => {
|
||||
onClose();
|
||||
}}
|
||||
/>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default VideoOverlayHeader;
|
|
@ -8,21 +8,21 @@
|
|||
right: 1%;
|
||||
z-index: 3;
|
||||
box-shadow: var(--box-shadow-layer);
|
||||
}
|
||||
|
||||
&:hover .button-close {
|
||||
display: inline-block;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
position: absolute;
|
||||
height: 22px;
|
||||
width: 22px;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
color: #000;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
z-index: 4;
|
||||
.video_overlay__header {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-wrap: nowrap;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 2rem;
|
||||
background-color: var(--header-primary-color);
|
||||
padding: 20px 10px;
|
||||
|
||||
.overlay__title--small {
|
||||
font-size: 15px;
|
||||
line-height: 15px;
|
||||
}
|
||||
}
|
||||
.overlay .button-close {
|
||||
display: none;
|
||||
}
|
||||
|
|
0
src/renderer/scss/component/_video_overlay.scss
Normal file
0
src/renderer/scss/component/_video_overlay.scss
Normal file
Loading…
Reference in a new issue