import React from 'react' import axios from 'axios' function MoviePosters(props) { // TODO handle the limit from the url const perPage = 30; let movies; // Let's limit the number for now if (props.movies.length > perPage) { movies = props.movies.slice(0, perPage); } else { movies = props.movies; } return (
{movies.map(function(movie, index) { const selected = (index === props.selectedMovieIndex) ? true : false; return ( props.onClick(index)} /> )} )}
); } function MoviePoster(props) { const selected = props.selected ? ' thumbnail-selected' : ''; const imgClass = 'thumbnail' + selected; return (
); } function MovieDetails(props) { return (

{props.movie.title}

{props.movie.title}

 {props.movie.runtime} min

 {props.movie.rating} ({props.movie.votes} counts)

{props.movie.plot}

); } class MovieButtons extends React.Component { constructor(props) { super(props); this.handleClick = this.handleClick.bind(this); } handleClick(e) { e.preventDefault(); if (this.props.fetching) { return } this.props.getMovieDetails(this.props.movie.imdb_id); } render() { const imdb_link = 'http://www.imdb.com/title/' + this.props.movie.imdb_id; return (
{this.props.fetching || Refresh } {this.props.fetching && Refreshing } {this.props.movie.polochon_url !== "" && Download } IMDB
); } } export default class MovieList extends React.Component { componentWillMount() { this.props.fetchMovies(this.props.moviesUrl); } render() { const movies = this.props.movieStore.movies; const index = this.props.movieStore.selectedMovie.index; const selectedMovie = movies[index]; return (
{selectedMovie && }
); } }