2018-11-08 18:08:07 +01:00
|
|
|
import React from 'react';
|
|
|
|
|
import { Route, Switch, Link } from 'react-router-dom'; // eslint-disable-line no-unused-vars
|
|
|
|
|
import 'bootstrap/dist/css/bootstrap.css'; // eslint-disable-line no-unused-vars
|
2018-12-13 02:18:03 +01:00
|
|
|
import { Row, Col, Button, Collapse } from 'react-bootstrap'; // eslint-disable-line no-unused-vars
|
2018-11-08 18:08:07 +01:00
|
|
|
import VideoList from './VideoList'; // eslint-disable-line no-unused-vars
|
|
|
|
|
import TopBar from './TopBar'; // eslint-disable-line no-unused-vars
|
|
|
|
|
import VideoPlayer from './VideoPlayer'; // eslint-disable-line no-unused-vars
|
2018-11-15 18:33:17 +01:00
|
|
|
import VideoInfo from './VideoInfo';
|
2018-12-14 17:53:15 +01:00
|
|
|
import {ReactHeight} from 'react-height';
|
2018-11-24 01:41:45 +01:00
|
|
|
import './css/App.css';
|
2018-11-08 17:54:37 +01:00
|
|
|
|
2018-11-08 18:08:07 +01:00
|
|
|
class App extends React.Component {
|
2018-12-13 02:18:03 +01:00
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
|
|
|
|
this.state = {
|
2018-12-14 17:53:15 +01:00
|
|
|
isInfoToggled: false,
|
|
|
|
|
maxHeight: null,
|
|
|
|
|
navHeight: null
|
2018-12-13 02:18:03 +01:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-08 18:08:07 +01:00
|
|
|
render() {
|
|
|
|
|
return (
|
|
|
|
|
<React.Fragment>
|
2018-12-14 17:53:15 +01:00
|
|
|
<ReactHeight className="row" onHeightReady={height => this.setState({navHeight:height})}>
|
|
|
|
|
<TopBar />
|
|
|
|
|
</ReactHeight>
|
|
|
|
|
<ReactHeight className="upperSection px-2 row" onHeightReady={height => this.setState({maxHeight:height})}>
|
|
|
|
|
<Col xs="12" lg={this.state.isInfoToggled ? { span: 6, offset: 1, order: 2 } : { span: 7, offset: 1, order: 2 }} className="align-content-center pt-2 p-1 pr-2">
|
2018-12-13 02:18:03 +01:00
|
|
|
<Route path={["/video/:id", "/*"]} component={VideoPlayer} />
|
2018-11-08 18:08:07 +01:00
|
|
|
</Col>
|
2018-12-14 17:53:15 +01:00
|
|
|
<Col xs="12" lg={this.state.isInfoToggled ? { span: 5, order: 1 } : { span: 3, order: 1 }} style={{ 'overflow': "auto", 'max-height': this.state.maxHeight }} className="w-75 h-100 py-2 p-0 p-sm-0">
|
2018-12-13 02:18:03 +01:00
|
|
|
<div className='d-flex justify-content-center pt-2'>
|
|
|
|
|
<Button variant="outline-light"
|
|
|
|
|
onClick={() => this.setState({ isInfoToggled: !this.state.isInfoToggled })}
|
|
|
|
|
className="w-75 align-content-center"
|
|
|
|
|
aria-controls="infovideo-collapse"
|
|
|
|
|
aria-expanded={this.state.isInfoToggled}>
|
|
|
|
|
{this.state.isInfoToggled ? "Nascondi informazioni" : "Mostra informazioni"}
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
<Collapse in={this.state.isInfoToggled}>
|
|
|
|
|
<div className="pt-2" id="infovideo-collapse">
|
|
|
|
|
<Route path={["/video/:id", "/search/:query"]} component={VideoInfo} />
|
|
|
|
|
</div>
|
|
|
|
|
</Collapse>
|
2018-12-12 20:14:39 +01:00
|
|
|
</Col>
|
2018-12-14 17:53:15 +01:00
|
|
|
</ReactHeight>
|
|
|
|
|
<Row style={{"max-height": 'calc(99vh - '+this.state.maxHeight+'px - '+this.state.navHeight+'px)'}} className='downSection'>
|
2018-12-13 02:18:03 +01:00
|
|
|
<Switch>
|
|
|
|
|
<Route exact path='/' component={VideoList} />
|
|
|
|
|
<Route render={() => <div>URL not found</div>} />
|
2018-11-14 15:08:21 +01:00
|
|
|
</Switch>
|
2018-11-08 18:08:07 +01:00
|
|
|
</Row>
|
|
|
|
|
</React.Fragment>
|
|
|
|
|
);
|
|
|
|
|
}
|
2018-11-08 17:54:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default App;
|