View index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const session = require('express-session'); | |
const redis = require('redis'); | |
const connectRedis = require('connect-redis'); | |
const app = express(); | |
// if you run behind a proxy (e.g. nginx) | |
// app.set('trust proxy', 1); |
View Comments.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import {CommentsHeader} from "./CommentsHeader/CommentsHeader"; | |
import {AddComment} from "./AddComment/AddComment"; | |
import {Comment} from "./Comment/Comment"; | |
export class Comments extends React.Component { | |
render() { | |
return ( | |
<div> | |
<CommentsHeader amountComments={this.props.amountComments}/> |
View App.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from 'react'; | |
import HeaderNav from './containers/HeaderNav/HeaderNav'; | |
import {SideBar} from './containers/SideBar/SideBar'; | |
class App extends Component { | |
render() { | |
return ( | |
<React.Fragment> | |
<HeaderNav/> | |
<SideBar/> |
View Watch.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ... */ | |
import {bindActionCreators} from 'redux'; | |
import * as watchActions from '../../store/actions/watch'; | |
import {withRouter} from 'react-router-dom'; | |
import {connect} from 'react-redux'; | |
import {getYoutubeLibraryLoaded} from '../../store/reducers/api'; | |
function mapStateToProps(state) { | |
return { | |
youtubeLibraryLoaded: getYoutubeLibraryLoaded(state), |
View HomeContent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*....*/ | |
import {getVideoCategoryIds} from '../../store/reducers/videos'; | |
class Home extends React.Component { | |
render() { | |
const trendingVideos = this.getTrendingVideos(); | |
const categoryGrids = this.getVideoGridsForCategories(); | |
return ( | |
<div className='home-content'> |
View HomeContent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*...*/ | |
import {getMostPopularVideos, getVideosByCategory} from '../../../store/reducers/videos'; | |
/* ... */ | |
function mapStateToProps(state) { | |
return { | |
videosByCategory: getVideosByCategory(state), | |
mostPopularVideos: getMostPopularVideos(state), | |
}; |
View HomeContent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*...*/ | |
import {getMostPopularVideos, getVideosByCategory} from '../../../store/reducers/videos'; | |
class HomeContent extends React.Component { | |
/* ... */ | |
getVideoGridsForCategories() { | |
const categoryTitles = Object.keys(this.props.videosByCategory || {}); | |
return categoryTitles.map((categoryTitle,index) => { | |
const videos = this.props.videosByCategory[categoryTitle]; |
View Home.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*....*/ | |
import {getVideoCategoryIds} from '../../store/reducers/videos'; | |
/* ... */ | |
function mapStateToProps(state) { | |
return { | |
youtubeLibraryLoaded: getYoutubeLibraryLoaded(state), | |
videoCategories: getVideoCategoryIds(state), | |
}; |
View index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {all, call, put} from 'redux-saga/effects'; | |
/* | |
... rest unchange for now | |
*/ | |
/* | |
* entity must have a success, request and failure method | |
* request is a function that returns a promise when called | |
* */ |
View Rating.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import './Rating.scss'; | |
import {Icon, Progress} from "semantic-ui-react"; | |
export function Rating() { | |
let progress = null; | |
if (props.likeCount && props.dislikeCount) { | |
const percent = 100 * (props.likeCount / (props.likeCount + props.dislikeCount)); | |
progress = <Progress className='progress' percent={percent} size='tiny'/>; | |
} |
NewerOlder