This commit is contained in:
matteo
2019-02-11 15:38:48 +01:00
3 changed files with 23 additions and 11 deletions
+7 -5
View File
@@ -1,6 +1,6 @@
import React from 'react';
import Wikipedia from './areainfo/Wikipedia';
import { Tabs, Tab, Table } from 'react-bootstrap';
import { Tabs, Tab } from 'react-bootstrap';
import {Link, withRouter} from 'react-router-dom';
import axios from 'axios';
import Linkify from "react-linkify";
@@ -12,7 +12,6 @@ import './css/VideoInfo.scss';
const ytclear = require('@c0b41/ytclear');
class VideoInfo extends React.Component {
state = {
@@ -25,7 +24,7 @@ class VideoInfo extends React.Component {
};
momentDuration(duration) {
return moment.duration(duration).format('hh:mm:ss');
return moment.duration(duration).format('hh:mm:ss')
}
ISO_8601parse(a) {
@@ -144,8 +143,8 @@ class VideoInfo extends React.Component {
render() {
const { error, isLoaded, VideoDetails, comments } = this.state;
const momentDuration = this.momentDuration; // bind momentDuration in render to the actual method
const ISO_8601parse = this.ISO_8601parse; // bind momentDuration in render to the actual method
const momentDuration = this.momentDuration;
const ISO_8601parse = this.ISO_8601parse;
if (error) {
return (
<span className="text-white">
@@ -203,6 +202,9 @@ class VideoInfo extends React.Component {
)
})}
</Tab>
<Tab className="text-white" eventKey="tweet" title="Tweet">
/* Insert code here */
</Tab>
<Tab className="text-white" eventKey="wikipedia" title="Wikipedia">
<Wikipedia
title={this.state.others.title}
+8 -3
View File
@@ -4,6 +4,7 @@ import axios from "axios";
import createpageToken from 'youtube-page-token';
import {Card} from "react-bootstrap";
import {Link} from "react-router-dom";
import moment from "moment";
class RecommenderRandom extends Component{
constructor(props){
@@ -13,6 +14,11 @@ class RecommenderRandom extends Component{
};
}
ISO_8601parse(a) {
return moment(a, moment.ISO_8601).format('ddd, DD/MM/YYYY hh:mm:ss');
}
componentDidMount(){
let pos = Math.floor(Math.random() * 500);
let pageToken = createpageToken(pos); /* createPageToken(pos) restituisce il pageToken relativo al numero
@@ -41,6 +47,7 @@ class RecommenderRandom extends Component{
}
render(){
const ISO_8601parse = this.ISO_8601parse;
return (
<div style={{width: '100rem',height:'100rem'}}>
{this.state.items.map(function (item,index) {
@@ -60,9 +67,7 @@ class RecommenderRandom extends Component{
<Card.ImgOverlay>
<Card.Title className="bg-dark d-inline text-white">
{item.snippet.title}<br/>
{item.snippet.channelTitle} - {item.snippet.publishedAt.replace(/(\d+)-(\d+)-(\d+)T(\d+):(\d+):(\d+).000Z/,function(match,p1,p2,p3,p4,p5,p6){
return(p3+'/'+p2+'/'+p1+' at '+p4+':'+p5+':'+p6); //Funzione che trasforma la data e ora di pubblicazione dal formato ISO nel normale formato da cristiani
})}
{item.snippet.channelTitle} - {ISO_8601parse(item.snippet.publishedAt)}
</Card.Title>
</Card.ImgOverlay>
</Link>
+8 -3
View File
@@ -2,6 +2,8 @@ import React, { Component } from 'react';
import axios from 'axios';
import {Link} from "react-router-dom";
import {Card} from "react-bootstrap";
import moment from "moment";
class Related extends Component {
constructor(props) {
@@ -12,6 +14,9 @@ class Related extends Component {
}
}
ISO_8601parse(a) {
return moment(a, moment.ISO_8601).format('ddd, DD/MM/YYYY hh:mm:ss');
}
componentWillMount() {
if(this.props.match.params.id){
if(this.props.match.params.id === this.state.videoId){}
@@ -51,6 +56,7 @@ class Related extends Component {
}
render() {
const ISO_8601parse = this.ISO_8601parse;
return (
<div style={{width: '100rem',height:'100rem'}}>
{this.state.items.map(function (item,index) {
@@ -70,9 +76,8 @@ class Related extends Component {
<Card.ImgOverlay>
<Card.Title className="bg-dark d-inline text-white">
{item.snippet.title}<br/>
{item.snippet.channelTitle} - {item.snippet.publishedAt.replace(/(\d+)-(\d+)-(\d+)T(\d+):(\d+):(\d+).000Z/,function(match,p1,p2,p3,p4,p5,p6){
return(p3+'/'+p2+'/'+p1+' at '+p4+':'+p5+':'+p6); //Funzione che trasforma la data e ora di pubblicazione dal formato ISO nel normale formato da cristiani
})}
{item.snippet.channelTitle} - {ISO_8601parse(item.snippet.publishedAt)}
</Card.Title>
</Card.ImgOverlay>
</Link>