<commit_before>/**
 * Poster v0.1.0
 * A React webapp to list upcoming movies and maintain a watchlist, powered by TMDb
 *
 * Author: <NAME> <<EMAIL>> (https://doublslash.com)
 * Date: 13 June, 2016
 * License: MIT
 *
 * Section > Watchlist
 */

import React from "react";
import { connect } from "react-redux";

import { getWatchlist } from "../../../../actions/watchlist";

import LoadingAnimation from "../../../Widgets/LoadingAnimation";
import MovieCardList from "../Shared/MovieCardList";
import MovieCard from "../Shared/MovieCard";

class Watchlist extends React.Component {
    constructor() {
        super();
    }

    componentWillMount() {
        this.props.loadWatchlist();
    }

    render() {
        return (
            <div class="container watchlist-section">
                <LoadingAnimation
                    visible={!this.props.loadCompleted}
                    loadMessage="Loading your watchlist..."
                />
                <MovieCardList
                    movies={this.props.movies}
                    cardAction="REMOVE"
                    visible={this.props.loadCompleted}
                />
            </div>
        );
    }
}

const stateToProps = (state, ownProps) => {
    return {
        loadCompleted: state.watchlist.loadCompleted,
        movies: state.watchlist.movies
    };
}

const dispatchToProps = (dispatch, ownProps) => {
    return {
        loadWatchlist: () => {
            dispatch(getWatchlist());
            console.log("Watchlist is being loaded!", ownProps);
        }
    };
}

const WatchlistView = connect(
    stateToProps,
    dispatchToProps
)(Watchlist);

export default WatchlistView;<commit_msg>Use Watchlist end-points from Poster Server<commit_after>/**
 * Poster v0.1.0
 * A React webapp to list upcoming movies and maintain a watchlist, powered by TMDb
 *
 * Author: <NAME> <<EMAIL>> (https://doublslash.com)
 * Date: 13 June, 2016
 * License: MIT
 *
 * Section > Watchlist
 */

import React from "react";
import { connect } from "react-redux";

import { PosterAction, loadMovies } from "../../../../actions/poster";

import LoadingAnimation from "../../../Widgets/LoadingAnimation";
import MovieCardList from "../Shared/MovieCardList";
import MovieCard from "../Shared/MovieCard";

class Watchlist extends React.Component {
    constructor() {
        super();
    }

    componentWillMount() {
        if (!this.props.loadCompleted)
            this.request = this.props.loadWatchlist();
    }

    componentWillUnmount() {
        if (!this.props.loadCompleted)
            this.request.abort();
    }

    render() {
        return (
            <div class="container watchlist-section">
                <LoadingAnimation
                    visible={!this.props.loadCompleted}
                    loadMessage="Loading your watchlist..."
                />
                <MovieCardList
                    movies={this.props.movies}
                    cardAction="REMOVE"
                    visible={this.props.loadCompleted}
                />
            </div>
        );
    }
}

const stateToProps = (state, ownProps) => {
    return {
        loadCompleted: state.poster.loadWatchlistCompleted,
        movies: state.poster.watchlistMovies
    };
}

const dispatchToProps = (dispatch, ownProps) => {
    return {
        loadWatchlist: () => {
            return dispatch(loadMovies(PosterAction.GET_WATCHLIST));
        }
    };
}

const WatchlistView = connect(
    stateToProps,
    dispatchToProps
)(Watchlist);

export default WatchlistView;
{'fraction_non_alphanumeric': 0.12436691052335397, 'fraction_numerical': 0.005064715813168261, 'mean_word_length': 2.0859375, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 25, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2553897', 'n_tokens_mistral': 996, 'n_tokens_neox': 955, 'n_words': 220}