Archived
non mi ricordo cosa ho fatto
This commit is contained in:
Generated
+4
-2
@@ -5854,7 +5854,8 @@
|
|||||||
},
|
},
|
||||||
"safe-buffer": {
|
"safe-buffer": {
|
||||||
"version": "5.1.1",
|
"version": "5.1.1",
|
||||||
"bundled": true
|
"bundled": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"safer-buffer": {
|
"safer-buffer": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
@@ -5946,7 +5947,8 @@
|
|||||||
},
|
},
|
||||||
"yallist": {
|
"yallist": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.2",
|
||||||
"bundled": true
|
"bundled": true,
|
||||||
|
"optional": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
+2
-2
@@ -44,7 +44,7 @@ class TopBar extends Component {
|
|||||||
<Nav className="mr-auto">
|
<Nav className="mr-auto">
|
||||||
<Link to="/" className="text-light nav-link">Home</Link>
|
<Link to="/" className="text-light nav-link">Home</Link>
|
||||||
<Link to="/link" className="text-light nav-link">link</Link>
|
<Link to="/link" className="text-light nav-link">link</Link>
|
||||||
<NavDropdown title="arnaldo" id="basic-nav-dropdown" >
|
{/* <NavDropdown title="arnaldo" id="basic-nav-dropdown" >
|
||||||
<NavDropdown.Item href="#action/3.1">Action</NavDropdown.Item>
|
<NavDropdown.Item href="#action/3.1">Action</NavDropdown.Item>
|
||||||
<NavDropdown.Item href="#action/3.2">
|
<NavDropdown.Item href="#action/3.2">
|
||||||
Another action
|
Another action
|
||||||
@@ -56,7 +56,7 @@ class TopBar extends Component {
|
|||||||
<NavDropdown.Item href="#action/3.4">
|
<NavDropdown.Item href="#action/3.4">
|
||||||
Separated link
|
Separated link
|
||||||
</NavDropdown.Item>
|
</NavDropdown.Item>
|
||||||
</NavDropdown>
|
</NavDropdown> */}
|
||||||
</Nav>
|
</Nav>
|
||||||
<form className="form-inline" onSubmit={this.handleSubmit}>
|
<form className="form-inline" onSubmit={this.handleSubmit}>
|
||||||
<FormControl
|
<FormControl
|
||||||
|
|||||||
+99
-99
@@ -1,115 +1,115 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
// import PropTypes from 'prop-types';
|
// import PropTypes from 'prop-types';
|
||||||
import Wikipedia from './areainfo/Wikipedia';
|
import Wikipedia from './areainfo/Wikipedia';
|
||||||
import { Col, Tabs, Tab } from 'react-bootstrap';
|
import { Col, Tabs, Tab } from 'react-bootstrap';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
class VideoInfo extends Component {
|
class VideoInfo extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state={
|
this.state={
|
||||||
error: null,
|
error: null,
|
||||||
isLoaded: false,
|
isLoaded: false,
|
||||||
VideoDetails: {},
|
VideoDetails: {},
|
||||||
videoId: '0J2QdDbelmY'
|
videoId: '0J2QdDbelmY'
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillMount() {
|
|
||||||
if(this.props.match.params.id){
|
|
||||||
if(this.props.match.params.id === this.state.videoId){}
|
|
||||||
else{
|
|
||||||
this.setState({videoId: this.props.match.params.id});
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
componentWillMount() {
|
||||||
axios.get('https://www.googleapis.com/youtube/v3/videos', {
|
if(this.props.match.params.id){
|
||||||
params: {
|
if(this.props.match.params.id === this.state.videoId){}
|
||||||
'part': 'snippet,contentDetails,statistics,topicDetails',
|
else{
|
||||||
'id': this.state.videoId,
|
this.setState({videoId: this.props.match.params.id});
|
||||||
'key': 'AIzaSyA21Odw9UdfiOJnxvA_eDfOW0OxuUfHKig'
|
|
||||||
}
|
}
|
||||||
}).then(response => {
|
}
|
||||||
this.setState({
|
}
|
||||||
VideoDetails: response.data.items[0],
|
|
||||||
isLoaded: true});
|
componentDidMount() {
|
||||||
}, error => {
|
axios.get('https://www.googleapis.com/youtube/v3/videos', {
|
||||||
console.error(error);
|
params: {
|
||||||
this.setState({
|
'part': 'snippet,contentDetails,statistics,topicDetails',
|
||||||
isLoaded: true,
|
'id': this.state.videoId,
|
||||||
error
|
'key': 'AIzaSyA21Odw9UdfiOJnxvA_eDfOW0OxuUfHKig'
|
||||||
|
}
|
||||||
|
}).then(response => {
|
||||||
|
this.setState({
|
||||||
|
VideoDetails: response.data.items[0],
|
||||||
|
isLoaded: true});
|
||||||
|
}, error => {
|
||||||
|
console.error(error);
|
||||||
|
this.setState({
|
||||||
|
isLoaded: true,
|
||||||
|
error
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// componentWillReceiveProps(nextProps) {
|
// componentWillReceiveProps(nextProps) {
|
||||||
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// shouldComponentUpdate(nextProps, nextState) {
|
// shouldComponentUpdate(nextProps, nextState) {
|
||||||
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
componentWillUpdate(nextProps, nextState) {
|
componentWillUpdate(nextProps, nextState) {
|
||||||
// console.info('nextProps',nextProps);
|
// console.info('nextProps',nextProps);
|
||||||
// console.info('nextState',nextState);
|
// console.info('nextState',nextState);
|
||||||
if(nextProps.match.params.id === this.state.videoId){}
|
if(nextProps.match.params.id === this.state.videoId){}
|
||||||
else{
|
else{
|
||||||
this.setState({videoId: nextProps.match.params.id});
|
this.setState({videoId: nextProps.match.params.id});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidUpdate(prevProps, prevState) {
|
||||||
|
console.info('prevProps',prevProps);
|
||||||
|
console.info('prevState',prevState);
|
||||||
|
}
|
||||||
|
|
||||||
|
// componentWillUnmount() {
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { error, isLoaded, VideoDetails } = this.state;
|
||||||
|
if (error) {
|
||||||
|
return (
|
||||||
|
<React.Fragment>
|
||||||
|
Error: {error.message} -- Cannot get {error.config.url}
|
||||||
|
</React.Fragment>
|
||||||
|
);
|
||||||
|
} else if (!isLoaded) {
|
||||||
|
return <React.Fragment>Loading...</React.Fragment>;
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
<React.Fragment>
|
||||||
|
<Col className='border border-dark' lg={{span:7}}>
|
||||||
|
{/* codice per tabs reccomenders */}
|
||||||
|
<Tabs defaultActiveKey="a" id="uncontrolled-tab-example">
|
||||||
|
<Tab eventKey="a" title="A">
|
||||||
|
<Wikipedia query={ this.props.location.state ? this.props.location.state.title : VideoDetails.snippet.title } />
|
||||||
|
</Tab>
|
||||||
|
<Tab eventKey="b" title="B">
|
||||||
|
<p>{}</p>
|
||||||
|
</Tab>
|
||||||
|
<Tab eventKey="c" title="C">
|
||||||
|
<p>C</p>
|
||||||
|
</Tab>
|
||||||
|
</Tabs>
|
||||||
|
</Col>
|
||||||
|
<Col className='border border-dark' lg={{span:4, offset:1}}>
|
||||||
|
<p>2</p>
|
||||||
|
</Col>
|
||||||
|
</React.Fragment>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps, prevState) {
|
VideoInfo.propTypes = {
|
||||||
console.info('prevProps',prevProps);
|
|
||||||
console.info('prevState',prevState);
|
|
||||||
}
|
|
||||||
|
|
||||||
// componentWillUnmount() {
|
};
|
||||||
|
|
||||||
// }
|
export default VideoInfo;
|
||||||
|
|
||||||
render() {
|
|
||||||
const { error, isLoaded, VideoDetails } = this.state;
|
|
||||||
if (error) {
|
|
||||||
return (
|
|
||||||
<React.Fragment>
|
|
||||||
Error: {error.message} -- Cannot get {error.config.url}
|
|
||||||
</React.Fragment>
|
|
||||||
);
|
|
||||||
} else if (!isLoaded) {
|
|
||||||
return <React.Fragment>Loading...</React.Fragment>;
|
|
||||||
} else {
|
|
||||||
return (
|
|
||||||
<React.Fragment>
|
|
||||||
<Col className='border border-dark' lg={{span:7}}>
|
|
||||||
{/* codice per tabs reccomenders */}
|
|
||||||
<Tabs defaultActiveKey="a" id="uncontrolled-tab-example">
|
|
||||||
<Tab eventKey="a" title="A">
|
|
||||||
<Wikipedia query={ VideoDetails.snippet.title } />
|
|
||||||
</Tab>
|
|
||||||
<Tab eventKey="b" title="B">
|
|
||||||
<p>B</p>
|
|
||||||
</Tab>
|
|
||||||
<Tab eventKey="c" title="C">
|
|
||||||
<p>C</p>
|
|
||||||
</Tab>
|
|
||||||
</Tabs>
|
|
||||||
</Col>
|
|
||||||
<Col className='border border-dark' lg={{span:4, offset:1}}>
|
|
||||||
<p>2</p>
|
|
||||||
</Col>
|
|
||||||
</React.Fragment>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
VideoInfo.propTypes = {
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
export default VideoInfo;
|
|
||||||
+9
-2
@@ -125,18 +125,25 @@ class VideoList extends React.Component {
|
|||||||
{items.map(item => (
|
{items.map(item => (
|
||||||
<Col key={item.videoID} lg={{ span: 3 }} md="6">
|
<Col key={item.videoID} lg={{ span: 3 }} md="6">
|
||||||
<Card className="my-1 carta">
|
<Card className="my-1 carta">
|
||||||
<Link to={{ pathname: '/video/' + item.videoID }}>
|
<Link to={{
|
||||||
|
pathname: '/video/' + item.videoID,
|
||||||
|
state: {
|
||||||
|
artist: item.artist,
|
||||||
|
title: item.title +' '+ item.artist
|
||||||
|
}
|
||||||
|
}}>
|
||||||
{/* {item.artist} - {item.title} {item.videoID} {item.category} */}
|
{/* {item.artist} - {item.title} {item.videoID} {item.category} */}
|
||||||
<Card.Img src={item.thumbnail} alt={'Thumbnail of '+item.title } />
|
<Card.Img src={item.thumbnail} alt={'Thumbnail of '+item.title } />
|
||||||
<Card.ImgOverlay>
|
<Card.ImgOverlay>
|
||||||
<Card.Title className="bg-dark d-inline text-white">
|
<Card.Title className="bg-dark d-inline text-white">
|
||||||
{item.artist} - {item.title}
|
{item.artist} - {item.title}
|
||||||
</Card.Title>
|
</Card.Title>
|
||||||
|
<p className='d-table d-lg-none card-text bg-dark text-white'>{item.category}</p>
|
||||||
</Card.ImgOverlay>
|
</Card.ImgOverlay>
|
||||||
</Link>
|
</Link>
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
))}
|
))}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -27,7 +27,7 @@ class VideoPlayer extends Component {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount(){
|
componentWillMount(){
|
||||||
if(this.props.match.params.id)
|
if(this.props.match.params.id)
|
||||||
this.setState((state, props) => { return { videoId: props.match.params.id }});
|
this.setState((state, props) => { return { videoId: props.match.params.id }});
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ class VideoPlayer extends Component {
|
|||||||
// console.warn(event.target.getDuration());
|
// console.warn(event.target.getDuration());
|
||||||
}
|
}
|
||||||
_onStateChange(event) {
|
_onStateChange(event) {
|
||||||
// console.info('statechange: ', event)
|
// console.info('statechange: ', event.data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,29 +12,36 @@ class Wikipedia extends Component {
|
|||||||
isLoaded: false
|
isLoaded: false
|
||||||
};
|
};
|
||||||
this.getWikiBox = this.getWikiBox.bind(this);
|
this.getWikiBox = this.getWikiBox.bind(this);
|
||||||
|
this.raffina = this.raffina.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
getWikiBox(name){
|
getWikiBox(name){
|
||||||
wikijs()
|
wikijs()
|
||||||
.page(name)
|
.page(name)
|
||||||
.then(page => page.fullInfo())
|
.then(page => page.fullInfo())
|
||||||
.then(infobox => console.log(infobox)
|
.then(infobox => console.log('infobox', infobox)
|
||||||
//this.setState({ infobox })
|
//this.setState({ infobox })
|
||||||
);
|
);
|
||||||
//console.log('infobox', this.state.infobox)
|
//console.log('infobox', this.state.infobox)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
raffina(results){
|
||||||
|
console.log('raffina',results);
|
||||||
|
return results[0];
|
||||||
|
}
|
||||||
|
|
||||||
// componentWillMount() {
|
// componentWillMount() {
|
||||||
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
componentDidMount() {
|
componentWillMount() {
|
||||||
wikijs().search(this.props.query).then(data => {
|
wikijs().find(this.props.query, this.raffina).then(data => {
|
||||||
this.setState({
|
this.setState({
|
||||||
data,
|
data,
|
||||||
isLoaded: true
|
isLoaded: true
|
||||||
});
|
});
|
||||||
console.log(data);
|
console.log(data.html());
|
||||||
|
//this.getWikiBox(data.results[0]);
|
||||||
}, error => {
|
}, error => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -77,7 +84,7 @@ this.getWikiBox = this.getWikiBox.bind(this);
|
|||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<p>risultato ricerca wikipedia: { data.results[0] }</p>
|
{/* <p>risultato ricerca wikipedia: { data.results[0] }</p> */}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user