Archived
ripulito recent
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
//http://site1825.tw.cs.unibo.it/TW/globpop fvitali
|
||||
//http://site1825.tw.cs.unibo.it/video.json originale videolist
|
||||
|
||||
import React from 'react';
|
||||
import { Col, ListGroup, Card, CardDeck } from 'react-bootstrap'; // eslint-disable-line no-unused-vars
|
||||
import axios from 'axios'; // eslint-disable-line no-unused-vars
|
||||
@@ -21,43 +18,7 @@ class Recent extends React.Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
// axios.get('http://site1825.tw.cs.unibo.it/TW/globpop', {
|
||||
// 'params':{
|
||||
// 'id':this.props.id
|
||||
// }
|
||||
// }).then(
|
||||
// response => {
|
||||
// //this.shuffleArray(response.data);
|
||||
// console.info ('a',response.data);
|
||||
// let lastWatchedList = JSON.parse(localStorage.getItem('lastWatched')).map(x =>x.lastWatched)
|
||||
// lastWatchedList.sort((a,b)=> new Date(b.lastWatched).getTime() - new Date(a.lastWatched).getTime());
|
||||
|
||||
this.getThumbnailsNames(JSON.parse(localStorage.getItem('lastWatched')));
|
||||
|
||||
|
||||
// let now = moment(new Date()); // riferimento unico temporale
|
||||
// let timePast = lastWatchedList.map(item => now.diff(item)) // differenza in secondi tra adesso e lastWatched
|
||||
//console.info(lastWatchedList, timePast.sort((a, b) => a - b))
|
||||
|
||||
|
||||
// console.info(response.data.recommended);
|
||||
// // this.setState({
|
||||
// // isLoaded: true,
|
||||
// // items:response.data.recommended,
|
||||
// // });
|
||||
|
||||
// },
|
||||
// // Note: it's important to handle errors here
|
||||
// // instead of a catch() block so that we don't swallow
|
||||
// // exceptions from actual bugs in components.
|
||||
// error => {
|
||||
// console.error(error);
|
||||
// this.setState({
|
||||
// isLoaded: true,
|
||||
// error
|
||||
// });
|
||||
// }
|
||||
// );
|
||||
}
|
||||
|
||||
// METODI
|
||||
@@ -95,15 +56,6 @@ class Recent extends React.Component {
|
||||
|
||||
|
||||
|
||||
/*shuffleArray(videoarray) {
|
||||
for (let i = videoarray.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
[videoarray[i], videoarray[j]] = [videoarray[j], videoarray[i]]; // eslint-disable-line no-param-reassign
|
||||
}
|
||||
// Durstenfeld shuffle.
|
||||
// https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm
|
||||
}*/
|
||||
|
||||
render() {
|
||||
const { error, isLoaded, items } = this.state;
|
||||
if (error) {
|
||||
|
||||
Reference in New Issue
Block a user