Archived
Recenti messi in ordine di data (funzione su videoplayer)
This commit is contained in:
@@ -108,6 +108,9 @@ class VideoPlayer extends React.Component {
|
||||
tmp[j].lastWatched= new Date();
|
||||
}
|
||||
|
||||
tmp.sort((a, b) => new Date(b.lastWatched).getTime() - new Date(a.lastWatched).getTime());
|
||||
|
||||
|
||||
|
||||
localStorage.setItem('lastWatched', JSON.stringify(tmp));
|
||||
//.finally(()=>{})
|
||||
|
||||
@@ -29,7 +29,17 @@ class Recent extends React.Component {
|
||||
// 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,
|
||||
@@ -95,7 +105,6 @@ class Recent extends React.Component {
|
||||
}*/
|
||||
|
||||
render() {
|
||||
const recentVideoList = JSON.parse(localStorage.getItem('lastWatched'))
|
||||
const { error, isLoaded, items } = this.state;
|
||||
if (error) {
|
||||
return (
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Col, Card } from 'react-bootstrap'; // eslint-disable-line no-unused-va
|
||||
import axios from 'axios'; // eslint-disable-line no-unused-vars
|
||||
import { Link } from 'react-router-dom'; // eslint-disable-line no-unused-vars
|
||||
/*eslint no-console: ["error", { allow: ["warn", "error", "info"] }] */
|
||||
import moment from "moment";
|
||||
|
||||
|
||||
class fvitali extends React.Component {
|
||||
state = {
|
||||
|
||||
Reference in New Issue
Block a user