Add Back button to Watch page

This commit is contained in:
Alex Liebowitz 2017-02-03 05:25:05 -05:00
parent 056470b47c
commit b6982854d8
3 changed files with 69 additions and 2 deletions

View file

@ -1,4 +1,6 @@
import React from 'react';
import {Icon} from '../component/common.js';
import {Link} from '../component/link.js';
import lbry from '../lbry.js';
import LoadScreen from '../component/load_screen.js'
@ -22,6 +24,9 @@ var WatchPage = React.createClass({
lbry.getStream(this.props.name);
this.updateLoadStatus();
},
handleBackClicked: function() {
history.back();
},
updateLoadStatus: function() {
lbry.getFileStatus(this.props.name, (status) => {
if (!status || !['running', 'stopped'].includes(status.code) || status.written_bytes == 0) {
@ -56,8 +61,19 @@ var WatchPage = React.createClass({
return (
!this.state.readyToPlay
? <LoadScreen message={'Loading video...'} details={this.state.loadStatusMessage} />
: <main className="full-screen">
: <main className="video full-screen">
<video width="100%" height="100%" id="video" ref="video" src={'/view?name=' + this.props.name} />
<div className="video__overlay">
<div className="video__back">
<Link icon="icon-arrow-circle-o-left" className="video__back-link" onClick={this.handleBackClicked}/>
<div className="video__back-label">
<Icon icon="icon-caret-left" className="video__back-label-arrow" />
<div className="video__back-label-content">
Back to LBRY
</div>
</div>
</div>
</div>
</main>
);
}

View file

@ -10,4 +10,5 @@
@import "component/_menu.scss";
@import "component/_tooltip.scss";
@import "component/_load-screen.scss";
@import "page/_developer.scss";
@import "page/_developer.scss";
@import "page/_watch.scss";

50
scss/page/_watch.scss Normal file
View file

@ -0,0 +1,50 @@
.video {
background: #000;
}
.video__overlay {
position: absolute;
top: 0px;
bottom: 0px;
left: 0px;
right: 0px;
color: #fff;
z-index: 1;
}
.video__back {
margin-top: 30px;
margin-left: 50px;
display: flex;
flex-direction: row;
align-items: center;
}
.video__back-link {
font-size: 50px;
}
.video__back-label {
opacity: 0;
transition: opacity 100ms ease-in;
}
.video__back-link:hover + .video__back-label {
opacity: 1;
}
.video__back-label-arrow {
color: darken($color-primary, 5%);
font-size: 20px;
}
.video__back-label-content {
display: inline-block;
margin-left: -2px;
font-size: 20px;
padding: 10px;
border-radius: 3px;
background-color: darken($color-primary, 5%);
color: #fff;
pointer-events: none;
}