Lint all the things !

This commit is contained in:
Grégoire Delattre 2017-06-02 22:17:41 +02:00
parent 9ed1b2dccb
commit 643bd3aa9a
20 changed files with 233 additions and 238 deletions

View File

@ -1,8 +1,8 @@
import React from 'react' import React from "react"
import { MenuItem } from 'react-bootstrap' import { MenuItem } from "react-bootstrap"
export class WishlistButton extends React.Component { export class WishlistButton extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.handleClick = this.handleClick.bind(this); this.handleClick = this.handleClick.bind(this);
@ -36,7 +36,7 @@ export class WishlistButton extends React.Component {
} }
} }
export class DeleteButton extends React.Component { export class DeleteButton extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.handleClick = this.handleClick.bind(this); this.handleClick = this.handleClick.bind(this);
@ -56,7 +56,7 @@ export class DeleteButton extends React.Component {
} }
} }
export class RefreshButton extends React.Component { export class RefreshButton extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.handleClick = this.handleClick.bind(this); this.handleClick = this.handleClick.bind(this);

View File

@ -1,9 +1,8 @@
import React from 'react' import React from "react"
import { toJS } from 'immutable'
import { Button, Dropdown, MenuItem, Modal } from 'react-bootstrap' import { Button, Dropdown, MenuItem, Modal } from "react-bootstrap"
export default class DownloadButton extends React.Component { export default class DownloadButton extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.showModal = this.showModal.bind(this); this.showModal = this.showModal.bind(this);
@ -67,7 +66,7 @@ export default class DownloadButton extends React.Component {
} }
} }
class Player extends React.Component { class Player extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
} }
@ -81,9 +80,9 @@ class Player extends React.Component {
<track <track
key={index} key={index}
kind="subtitles" kind="subtitles"
label={el.get('language')} label={el.get("language")}
src={el.get('vvt_file')} src={el.get("vvt_file")}
srcLang={el.get('language')} srcLang={el.get("language")}
/> />
); );
})} })}

View File

@ -1,13 +1,13 @@
import React from 'react' import React from "react"
import { DropdownButton, MenuItem } from 'react-bootstrap' import { DropdownButton, MenuItem } from "react-bootstrap"
export default class SubtitlesButton extends React.Component { export default class SubtitlesButton extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.handleClick = this.handleClick.bind(this); this.handleClick = this.handleClick.bind(this);
} }
handleClick(e, url) { handleClick(e) {
e.preventDefault(); e.preventDefault();
if (this.props.fetching) { return } if (this.props.fetching) { return }
@ -31,7 +31,7 @@ export default class SubtitlesButton extends React.Component {
<DropdownButton bsStyle="success" bsSize={btnSize} title="Subtitles" id="download-subtitles-button" dropup> <DropdownButton bsStyle="success" bsSize={btnSize} title="Subtitles" id="download-subtitles-button" dropup>
{entries.map(function(e, index) { {entries.map(function(e, index) {
switch (e.type) { switch (e.type) {
case 'action': case "action":
return ( return (
<MenuItem key={index} onClick={(event) => this.handleClick(event, e.url)}> <MenuItem key={index} onClick={(event) => this.handleClick(event, e.url)}>
{this.props.fetching || {this.props.fetching ||
@ -48,11 +48,11 @@ export default class SubtitlesButton extends React.Component {
} }
</MenuItem> </MenuItem>
); );
case 'divider': case "divider":
return ( return (
<MenuItem key={index} divider></MenuItem> <MenuItem key={index} divider></MenuItem>
); );
case 'entry': case "entry":
return ( return (
<MenuItem key={index} href={e.url}> <MenuItem key={index} href={e.url}>
<i className="fa fa-download"></i> {e.lang} <i className="fa fa-download"></i> {e.lang}
@ -87,8 +87,8 @@ function buildMenuItems(subtitles) {
entries.push({ entries.push({
type: "entry", type: "entry",
// Take only the last part of fr_FR // Take only the last part of fr_FR
lang: sub.get('language').split("_")[1], lang: sub.get("language").split("_")[1],
url: sub.get('url'), url: sub.get("url"),
}); });
} }

View File

@ -1,21 +1,21 @@
import React from 'react' import React from "react"
export default function ListDetails(props) { export default function ListDetails(props) {
let genres = props.data.get('genres'); let genres = props.data.get("genres");
if (genres !== undefined) { if (genres !== undefined) {
// Uppercase first genres // Uppercase first genres
genres = genres.toJS().map( genres = genres.toJS().map(
(word) => word[0].toUpperCase() + word.substr(1) (word) => word[0].toUpperCase() + word.substr(1)
).join(', '); ).join(", ");
} }
let wishlistStr = ""; let wishlistStr = "";
if (props.data.get('wishlisted') === true) { if (props.data.get("wishlisted") === true) {
wishlistStr = "Wishlisted"; wishlistStr = "Wishlisted";
} }
const trackedSeason = props.data.get('tracked_season'); const trackedSeason = props.data.get("tracked_season");
const trackedEpisode = props.data.get('tracked_episode'); const trackedEpisode = props.data.get("tracked_episode");
if (trackedEpisode !== null && trackedSeason !== null if (trackedEpisode !== null && trackedSeason !== null
&& trackedEpisode !== undefined && trackedSeason !== undefined) { && trackedEpisode !== undefined && trackedSeason !== undefined) {
if ((trackedSeason === 0) && (trackedEpisode === 0)) { if ((trackedSeason === 0) && (trackedEpisode === 0)) {
@ -28,18 +28,18 @@ export default function ListDetails(props) {
return ( return (
<div className="col-xs-7 col-md-4"> <div className="col-xs-7 col-md-4">
<div className="affix"> <div className="affix">
<h1 className="hidden-xs">{props.data.get('title')}</h1> <h1 className="hidden-xs">{props.data.get("title")}</h1>
<h3 className="visible-xs">{props.data.get('title')}</h3> <h3 className="visible-xs">{props.data.get("title")}</h3>
{wishlistStr !== "" && {wishlistStr !== "" &&
<span className="label label-default"> <span className="label label-default">
<i className="fa fa-bookmark"></i> {wishlistStr} <i className="fa fa-bookmark"></i> {wishlistStr}
</span> </span>
} }
<h4>{props.data.get('year')}</h4> <h4>{props.data.get("year")}</h4>
{props.data.get('runtime') !== undefined && {props.data.get("runtime") !== undefined &&
<p> <p>
<i className="fa fa-clock-o"></i> <i className="fa fa-clock-o"></i>
&nbsp;{props.data.get('runtime')} min &nbsp;{props.data.get("runtime")} min
</p> </p>
} }
{genres !== undefined && {genres !== undefined &&
@ -50,12 +50,12 @@ export default function ListDetails(props) {
} }
<p> <p>
<i className="fa fa-star-o"></i> <i className="fa fa-star-o"></i>
&nbsp;{Number(props.data.get('rating')).toFixed(1)}&nbsp; &nbsp;{Number(props.data.get("rating")).toFixed(1)}&nbsp;
{props.data.get('votes') !== undefined && {props.data.get("votes") !== undefined &&
<small>({props.data.get('votes')} counts)</small> <small>({props.data.get("votes")} counts)</small>
} }
</p> </p>
<p className="plot">{props.data.get('plot')}</p> <p className="plot">{props.data.get("plot")}</p>
</div> </div>
{props.children} {props.children}
</div> </div>

View File

@ -1,7 +1,7 @@
import React from 'react' import React from "react"
import { Form, FormGroup, FormControl, ControlLabel } from 'react-bootstrap' import { Form, FormGroup, FormControl, ControlLabel } from "react-bootstrap"
export default class ExplorerOptions extends React.Component { export default class ExplorerOptions extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.handleSourceChange = this.handleSourceChange.bind(this); this.handleSourceChange = this.handleSourceChange.bind(this);
@ -67,7 +67,7 @@ export default class ExplorerOptions extends React.Component {
onChange={this.handleSourceChange} onChange={this.handleSourceChange}
value={source} value={source}
> >
{this.props.options.entrySeq().map(function([source, categories]) { {this.props.options.keySeq().map(function(source) {
return ( return (
<option key={source} value={source}>{this.prettyName(source)}</option>) <option key={source} value={source}>{this.prettyName(source)}</option>)
}, this)} }, this)}

View File

@ -1,9 +1,9 @@
import React from 'react' import React from "react"
export default class ListFilter extends React.PureComponent { export default class ListFilter extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { filter: '' }; this.state = { filter: "" };
this.handleChange = this.handleChange.bind(this); this.handleChange = this.handleChange.bind(this);
} }
handleChange(ev) { handleChange(ev) {
@ -16,7 +16,7 @@ export default class ListFilter extends React.PureComponent {
if (value.length >= 3) { if (value.length >= 3) {
this.props.updateFilter(value); this.props.updateFilter(value);
} else { } else {
this.props.updateFilter(''); this.props.updateFilter("");
} }
} }
render() { render() {

View File

@ -1,12 +1,12 @@
import React from 'react' import React from "react"
export default class ListPoster extends React.PureComponent { export default class ListPoster extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
} }
render() { render() {
const selected = this.props.selected ? ' thumbnail-selected' : ''; const selected = this.props.selected ? " thumbnail-selected" : "";
const imgClass = 'thumbnail' + selected; const imgClass = "thumbnail" + selected;
const displayClearFixLg = (this.props.index % 6) === 0; const displayClearFixLg = (this.props.index % 6) === 0;
const displayClearFixMd = (this.props.index % 4) === 0; const displayClearFixMd = (this.props.index % 4) === 0;
const displayClearFixSm = (this.props.index % 2) === 0; const displayClearFixSm = (this.props.index % 2) === 0;
@ -24,7 +24,7 @@ export default class ListPoster extends React.PureComponent {
<div className="col-xs-12 col-sm-6 col-md-3 col-lg-2"> <div className="col-xs-12 col-sm-6 col-md-3 col-lg-2">
<a className={imgClass}> <a className={imgClass}>
<img <img
src={this.props.data.get('poster_url')} src={this.props.data.get("poster_url")}
onClick={this.props.onClick} onClick={this.props.onClick}
/> />
</a> </a>

View File

@ -1,19 +1,17 @@
import React from 'react' import React from "react"
import { Map, List, fromJS } from 'immutable'
import fuzzy from 'fuzzy'; import fuzzy from "fuzzy";
import InfiniteScroll from 'react-infinite-scroller'; import InfiniteScroll from "react-infinite-scroller";
import ListFilter from './filter' import ListFilter from "./filter"
import ExplorerOptions from './explorerOptions' import ExplorerOptions from "./explorerOptions"
import ListPoster from './poster' import ListPoster from "./poster"
import Loader from '../loader/loader' import Loader from "../loader/loader"
const DEFAULT_LIST_SIZE = 30;
const DEFAULT_ADD_EXTRA_ITEMS = 30; const DEFAULT_ADD_EXTRA_ITEMS = 30;
export default class ListPosters extends React.Component { export default class ListPosters extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.loadMore = this.loadMore.bind(this); this.loadMore = this.loadMore.bind(this);
@ -62,7 +60,7 @@ export default class ListPosters extends React.Component {
// Filter the list of elements // Filter the list of elements
if (this.props.filter !== "") { if (this.props.filter !== "") {
elmts = elmts.filter((v) => fuzzy.test(this.props.filter, v.get('title')), this); elmts = elmts.filter((v) => fuzzy.test(this.props.filter, v.get("title")), this);
} else { } else {
elmts = elmts.slice(0, this.state.items); elmts = elmts.slice(0, this.state.items);
} }
@ -131,7 +129,7 @@ class Posters extends React.PureComponent {
className="row" className="row"
> >
{this.props.elmts.toIndexedSeq().map(function(movie, index) { {this.props.elmts.toIndexedSeq().map(function(movie, index) {
const imdbId = movie.get('imdb_id'); const imdbId = movie.get("imdb_id");
const selected = (imdbId === this.props.selectedImdbId) ? true : false; const selected = (imdbId === this.props.selectedImdbId) ? true : false;
return ( return (
<ListPoster <ListPoster

View File

@ -1,5 +1,5 @@
import React from 'react' import React from "react"
import Loading from 'react-loading' import Loading from "react-loading"
export default function Loader() { export default function Loader() {
return ( return (

View File

@ -1,7 +1,7 @@
import React from 'react' import React from "react"
import { WishlistButton, DeleteButton, RefreshButton } from '../buttons/actions' import { WishlistButton, DeleteButton, RefreshButton } from "../buttons/actions"
import { DropdownButton } from 'react-bootstrap' import { DropdownButton } from "react-bootstrap"
export default function ActionsButton(props) { export default function ActionsButton(props) {
return ( return (

View File

@ -1,26 +1,26 @@
import React from 'react' import React from "react"
import { connect } from 'react-redux' import { connect } from "react-redux"
import { bindActionCreators } from 'redux' import { bindActionCreators } from "redux"
import { addTorrent } from '../../actions/torrents' import { addTorrent } from "../../actions/torrents"
import { refreshSubtitles } from '../../actions/subtitles' import { refreshSubtitles } from "../../actions/subtitles"
import { addMovieToWishlist, deleteMovie, deleteMovieFromWishlist, import { addMovieToWishlist, deleteMovie, deleteMovieFromWishlist,
getMovieDetails, selectMovie, updateFilter } from '../../actions/movies' getMovieDetails, selectMovie, updateFilter } from "../../actions/movies"
import DownloadButton from '../buttons/download' import DownloadButton from "../buttons/download"
import SubtitlesButton from '../buttons/subtitles' import SubtitlesButton from "../buttons/subtitles"
import TorrentsButton from './torrents' import TorrentsButton from "./torrents"
import ActionsButton from './actions' import ActionsButton from "./actions"
import ListPosters from '../list/posters' import ListPosters from "../list/posters"
import ListDetails from '../list/details' import ListDetails from "../list/details"
function mapStateToProps(state) { function mapStateToProps(state) {
return { return {
loading : state.movieStore.get('loading'), loading : state.movieStore.get("loading"),
movies : state.movieStore.get('movies'), movies : state.movieStore.get("movies"),
filter : state.movieStore.get('filter'), filter : state.movieStore.get("filter"),
selectedImdbId : state.movieStore.get('selectedImdbId'), selectedImdbId : state.movieStore.get("selectedImdbId"),
lastFetchUrl : state.movieStore.get('lastFetchUrl'), lastFetchUrl : state.movieStore.get("lastFetchUrl"),
exploreOptions : state.movieStore.get('exploreOptions'), exploreOptions : state.movieStore.get("exploreOptions"),
}; };
} }
const mapDispatchToProps = (dipatch) => const mapDispatchToProps = (dipatch) =>
@ -29,51 +29,51 @@ const mapDispatchToProps = (dipatch) =>
refreshSubtitles, updateFilter }, dipatch) refreshSubtitles, updateFilter }, dipatch)
function MovieButtons(props) { function MovieButtons(props) {
const imdb_link = `http://www.imdb.com/title/${props.movie.get('imdb_id')}`; const imdbLink = `http://www.imdb.com/title/${props.movie.get("imdb_id")}`;
const hasMovie = (props.movie.get('polochon_url') !== ""); const hasMovie = (props.movie.get("polochon_url") !== "");
return ( return (
<div className="list-details-buttons btn-toolbar"> <div className="list-details-buttons btn-toolbar">
<ActionsButton <ActionsButton
fetching={props.movie.get('fetchingDetails')} fetching={props.movie.get("fetchingDetails")}
movieId={props.movie.get('imdb_id')} movieId={props.movie.get("imdb_id")}
getDetails={props.getMovieDetails} getDetails={props.getMovieDetails}
deleteMovie={props.deleteMovie} deleteMovie={props.deleteMovie}
hasMovie={hasMovie} hasMovie={hasMovie}
wishlisted={props.movie.get('wishlisted')} wishlisted={props.movie.get("wishlisted")}
addToWishlist={props.addToWishlist} addToWishlist={props.addToWishlist}
deleteFromWishlist={props.deleteFromWishlist} deleteFromWishlist={props.deleteFromWishlist}
lastFetchUrl={props.lastFetchUrl} lastFetchUrl={props.lastFetchUrl}
/> />
{props.movie.get('torrents') !== null && {props.movie.get("torrents") !== null &&
<TorrentsButton <TorrentsButton
torrents={props.movie.get('torrents')} torrents={props.movie.get("torrents")}
addTorrent={props.addTorrent} addTorrent={props.addTorrent}
/> />
} }
<DownloadButton <DownloadButton
url={props.movie.get('polochon_url')} url={props.movie.get("polochon_url")}
subtitles={props.movie.get('subtitles')} subtitles={props.movie.get("subtitles")}
/> />
<SubtitlesButton <SubtitlesButton
fetching={props.movie.get('fetchingSubtitles')} fetching={props.movie.get("fetchingSubtitles")}
url={props.movie.get('polochon_url')} url={props.movie.get("polochon_url")}
subtitles={props.movie.get('subtitles')} subtitles={props.movie.get("subtitles")}
refreshSubtitles={props.refreshSubtitles} refreshSubtitles={props.refreshSubtitles}
resourceID={props.movie.get('imdb_id')} resourceID={props.movie.get("imdb_id")}
type="movie" type="movie"
/> />
<a type="button" className="btn btn-warning btn-sm" href={imdb_link}> <a type="button" className="btn btn-warning btn-sm" href={imdbLink}>
<i className="fa fa-external-link"></i> IMDB <i className="fa fa-external-link"></i> IMDB
</a> </a>
</div> </div>
); );
} }
class MovieList extends React.Component { class MovieList extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
} }

View File

@ -1,8 +1,8 @@
import React from 'react' import React from "react"
import { DropdownButton, MenuItem } from 'react-bootstrap' import { DropdownButton, MenuItem } from "react-bootstrap"
export default class TorrentsButton extends React.Component { export default class TorrentsButton extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.handleClick = this.handleClick.bind(this); this.handleClick = this.handleClick.bind(this);
@ -17,17 +17,17 @@ export default class TorrentsButton extends React.Component {
<DropdownButton className="btn btn-default btn-sm" title="Torrents" id="download-torrents-button" dropup> <DropdownButton className="btn btn-default btn-sm" title="Torrents" id="download-torrents-button" dropup>
{entries.map(function(e, index) { {entries.map(function(e, index) {
switch (e.type) { switch (e.type) {
case 'header': case "header":
return ( return (
<MenuItem key={index} className="text-warning" header> <MenuItem key={index} className="text-warning" header>
{e.value} {e.value}
</MenuItem> </MenuItem>
); );
case 'divider': case "divider":
return ( return (
<MenuItem key={index} divider></MenuItem> <MenuItem key={index} divider></MenuItem>
); );
case 'entry': case "entry":
return ( return (
<MenuItem key={index} href={e.url} onClick={(event) => this.handleClick(event, e.url)}> <MenuItem key={index} href={e.url} onClick={(event) => this.handleClick(event, e.url)}>
{e.quality} {e.quality}
@ -41,7 +41,7 @@ export default class TorrentsButton extends React.Component {
} }
function buildMenuItems(torrents) { function buildMenuItems(torrents) {
const t = torrents.groupBy((el) => el.get('source')); const t = torrents.groupBy((el) => el.get("source"));
// Build the array of entries // Build the array of entries
let entries = []; let entries = [];
@ -57,8 +57,8 @@ function buildMenuItems(torrents) {
for (let torrent of torrentList) { for (let torrent of torrentList) {
entries.push({ entries.push({
type: "entry", type: "entry",
quality: torrent.get('quality'), quality: torrent.get("quality"),
url: torrent.get('url'), url: torrent.get("url"),
}); });
} }

View File

@ -1,6 +1,6 @@
import React from 'react' import React from "react"
import { Nav, Navbar, NavItem, NavDropdown, MenuItem } from 'react-bootstrap' import { Nav, Navbar, NavItem, NavDropdown, MenuItem } from "react-bootstrap"
import { LinkContainer } from 'react-router-bootstrap' import { LinkContainer } from "react-router-bootstrap"
export default class NavBar extends React.PureComponent { export default class NavBar extends React.PureComponent {
constructor(props) { constructor(props) {
@ -25,10 +25,10 @@ export default class NavBar extends React.PureComponent {
} }
} }
shouldDisplayMoviesSearch(router) { shouldDisplayMoviesSearch(router) {
return this.matchPath(router, 'movies'); return this.matchPath(router, "movies");
} }
shouldDisplayShowsSearch(router) { shouldDisplayShowsSearch(router) {
return this.matchPath(router, 'shows'); return this.matchPath(router, "shows");
} }
matchPath(router, keyword) { matchPath(router, keyword) {
const location = router.getCurrentLocation().pathname; const location = router.getCurrentLocation().pathname;
@ -103,7 +103,7 @@ class Search extends React.Component {
} }
} }
function MoviesDropdown(props) { function MoviesDropdown() {
return( return(
<Nav> <Nav>
<NavDropdown title="Movies" id="navbar-movies-dropdown"> <NavDropdown title="Movies" id="navbar-movies-dropdown">
@ -118,7 +118,7 @@ function MoviesDropdown(props) {
); );
} }
function ShowsDropdown(props) { function ShowsDropdown() {
return( return(
<Nav> <Nav>
<NavDropdown title="Shows" id="navbar-shows-dropdown"> <NavDropdown title="Shows" id="navbar-shows-dropdown">
@ -161,7 +161,7 @@ function UserDropdown(props) {
} }
} }
function WishlistDropdown(props) { function WishlistDropdown() {
return( return(
<Nav> <Nav>
<NavDropdown title="Wishlist" id="navbar-wishlit-dropdown"> <NavDropdown title="Wishlist" id="navbar-wishlit-dropdown">

View File

@ -1,22 +1,21 @@
import React from 'react' import React from "react"
import { connect } from 'react-redux' import { connect } from "react-redux"
import { bindActionCreators } from 'redux' import { bindActionCreators } from "redux"
import { List } from 'immutable' import { addTorrent } from "../../actions/torrents"
import { addTorrent } from '../../actions/torrents' import { refreshSubtitles } from "../../actions/subtitles"
import { refreshSubtitles } from '../../actions/subtitles' import { addShowToWishlist, deleteShowFromWishlist, getEpisodeDetails, updateShowDetails } from "../../actions/shows"
import { addShowToWishlist, deleteShowFromWishlist, getEpisodeDetails, updateShowDetails } from '../../actions/shows'
import Loader from '../loader/loader' import Loader from "../loader/loader"
import DownloadButton from '../buttons/download' import DownloadButton from "../buttons/download"
import SubtitlesButton from '../buttons/subtitles' import SubtitlesButton from "../buttons/subtitles"
import { OverlayTrigger, Tooltip } from 'react-bootstrap' import { OverlayTrigger, Tooltip } from "react-bootstrap"
function mapStateToProps(state) { function mapStateToProps(state) {
return { return {
loading: state.showStore.loading, loading: state.showStore.loading,
show: state.showStore.get('show'), show: state.showStore.get("show"),
}; };
} }
const mapDispatchToProps = (dispatch) => const mapDispatchToProps = (dispatch) =>
@ -70,21 +69,21 @@ function Header(props){
function HeaderThumbnail(props){ function HeaderThumbnail(props){
return ( return (
<div className="col-xs-12 col-sm-2 text-center"> <div className="col-xs-12 col-sm-2 text-center">
<img src={props.data.get('poster_url')} <img src={props.data.get("poster_url")}
className="show-thumbnail thumbnail-selected img-thumbnail img-responsive"/> className="show-thumbnail thumbnail-selected img-thumbnail img-responsive"/>
</div> </div>
); );
} }
function HeaderDetails(props){ function HeaderDetails(props){
const imdbLink = `http://www.imdb.com/title/${props.data.get('imdb_id')}`; const imdbLink = `http://www.imdb.com/title/${props.data.get("imdb_id")}`;
return ( return (
<div className="col-xs-12 col-sm-10"> <div className="col-xs-12 col-sm-10">
<dl className="dl-horizontal"> <dl className="dl-horizontal">
<dt>Title</dt> <dt>Title</dt>
<dd>{props.data.get('title')}</dd> <dd>{props.data.get("title")}</dd>
<dt>Plot</dt> <dt>Plot</dt>
<dd className="plot">{props.data.get('plot')}</dd> <dd className="plot">{props.data.get("plot")}</dd>
<dt>IMDB</dt> <dt>IMDB</dt>
<dd> <dd>
<a type="button" className="btn btn-warning btn-xs" href={imdbLink}> <a type="button" className="btn btn-warning btn-xs" href={imdbLink}>
@ -92,9 +91,9 @@ function HeaderDetails(props){
</a> </a>
</dd> </dd>
<dt>Year</dt> <dt>Year</dt>
<dd>{props.data.get('year')}</dd> <dd>{props.data.get("year")}</dd>
<dt>Rating</dt> <dt>Rating</dt>
<dd>{props.data.get('rating')}</dd> <dd>{props.data.get("rating")}</dd>
</dl> </dl>
<TrackHeader <TrackHeader
data={props.data} data={props.data}
@ -108,7 +107,7 @@ function HeaderDetails(props){
function SeasonsList(props){ function SeasonsList(props){
return ( return (
<div> <div>
{props.data.get('seasons').entrySeq().map(function([season, data]) { {props.data.get("seasons").entrySeq().map(function([season, data]) {
return ( return (
<div className="col-xs-12 col-sm-10 col-sm-offset-1 col-md-10 col-md-offset-1" key={season.toString()}> <div className="col-xs-12 col-sm-10 col-sm-offset-1 col-md-10 col-md-offset-1" key={season.toString()}>
@ -156,7 +155,7 @@ class Season extends React.Component {
<table className="table table-striped table-hover"> <table className="table table-striped table-hover">
<tbody> <tbody>
{this.props.data.toList().map(function(episode) { {this.props.data.toList().map(function(episode) {
let key = `${episode.get('season')}-${episode.get('episode')}`; let key = `${episode.get("season")}-${episode.get("episode")}`;
return ( return (
<Episode <Episode
key={key} key={key}
@ -184,24 +183,24 @@ function Episode(props) {
data={props.data} data={props.data}
addToWishlist={props.addToWishlist} addToWishlist={props.addToWishlist}
/> />
{props.data.get('episode')} {props.data.get("episode")}
</th> </th>
<td className="col-xs-12"> <td className="col-xs-12">
{props.data.get('title')} {props.data.get("title")}
<span className="pull-right episode-buttons"> <span className="pull-right episode-buttons">
<SubtitlesButton <SubtitlesButton
url={props.data.get('polochon_url')} url={props.data.get("polochon_url")}
subtitles={props.data.get('subtitles')} subtitles={props.data.get("subtitles")}
refreshSubtitles={props.refreshSubtitles} refreshSubtitles={props.refreshSubtitles}
resourceID={props.data.get('show_imdb_id')} resourceID={props.data.get("show_imdb_id")}
season={props.data.get('season')} season={props.data.get("season")}
episode={props.data.get('episode')} episode={props.data.get("episode")}
type="episode" type="episode"
xs xs
/> />
{props.data.get('torrents') && props.data.get('torrents').toList().map(function(torrent) { {props.data.get("torrents") && props.data.get("torrents").toList().map(function(torrent) {
let key = `${props.data.get('season')}-${props.data.get('episode')}-${torrent.get('source')}-${torrent.get('quality')}`; let key = `${props.data.get("season")}-${props.data.get("episode")}-${torrent.get("source")}-${torrent.get("quality")}`;
return ( return (
<Torrent <Torrent
data={torrent} data={torrent}
@ -211,8 +210,8 @@ function Episode(props) {
) )
})} })}
<DownloadButton <DownloadButton
url={props.data.get('polochon_url')} url={props.data.get("polochon_url")}
subtitles={props.data.get('subtitles')} subtitles={props.data.get("subtitles")}
xs xs
/> />
<GetDetailsButton <GetDetailsButton
@ -225,7 +224,7 @@ function Episode(props) {
) )
} }
class Torrent extends React.Component { class Torrent extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.handleClick = this.handleClick.bind(this); this.handleClick = this.handleClick.bind(this);
@ -239,25 +238,25 @@ class Torrent extends React.Component {
<span> <span>
<a type="button" <a type="button"
className="btn btn-primary btn-xs" className="btn btn-primary btn-xs"
onClick={(e) => this.handleClick(e, this.props.data.get('url'))} onClick={(e) => this.handleClick(e, this.props.data.get("url"))}
href={this.props.data.url} > href={this.props.data.url} >
<i className="fa fa-download"></i> {this.props.data.get('quality')} <i className="fa fa-download"></i> {this.props.data.get("quality")}
</a> </a>
</span> </span>
) )
} }
} }
class TrackHeader extends React.Component { class TrackHeader extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.handleClick = this.handleClick.bind(this); this.handleClick = this.handleClick.bind(this);
} }
handleClick(e, url) { handleClick(e) {
e.preventDefault(); e.preventDefault();
const trackedSeason = this.props.data.get('tracked_season'); const trackedSeason = this.props.data.get("tracked_season");
const trackedEpisode = this.props.data.get('tracked_episode'); const trackedEpisode = this.props.data.get("tracked_episode");
const imdbId = this.props.data.get('imdb_id'); const imdbId = this.props.data.get("imdb_id");
const wishlisted = (trackedSeason !== null && trackedEpisode !== null); const wishlisted = (trackedSeason !== null && trackedEpisode !== null);
if (wishlisted) { if (wishlisted) {
this.props.deleteFromWishlist(imdbId); this.props.deleteFromWishlist(imdbId);
@ -266,9 +265,8 @@ class TrackHeader extends React.Component {
} }
} }
render() { render() {
const trackedSeason = this.props.data.get('tracked_season'); const trackedSeason = this.props.data.get("tracked_season");
const trackedEpisode = this.props.data.get('tracked_episode'); const trackedEpisode = this.props.data.get("tracked_episode");
const imdbId = this.props.data.get('imdb_id');
const wishlisted = (trackedSeason !== null && trackedEpisode !== null); const wishlisted = (trackedSeason !== null && trackedEpisode !== null);
let msg; let msg;
if (wishlisted) { if (wishlisted) {
@ -308,16 +306,16 @@ class TrackHeader extends React.Component {
} }
} }
class TrackButton extends React.Component { class TrackButton extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.handleClick = this.handleClick.bind(this); this.handleClick = this.handleClick.bind(this);
} }
handleClick(e, url) { handleClick(e) {
e.preventDefault(); e.preventDefault();
const imdbId = this.props.data.get('show_imdb_id'); const imdbId = this.props.data.get("show_imdb_id");
const season = this.props.data.get('season'); const season = this.props.data.get("season");
const episode = this.props.data.get('episode'); const episode = this.props.data.get("episode");
this.props.addToWishlist(imdbId, season, episode); this.props.addToWishlist(imdbId, season, episode);
} }
render() { render() {
@ -335,30 +333,30 @@ class TrackButton extends React.Component {
} }
} }
class GetDetailsButton extends React.Component { class GetDetailsButton extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.handleClick = this.handleClick.bind(this); this.handleClick = this.handleClick.bind(this);
} }
handleClick(e, url) { handleClick(e) {
e.preventDefault(); e.preventDefault();
if (this.props.data.get('fetching')) { if (this.props.data.get("fetching")) {
return return
} }
const imdbId = this.props.data.get('show_imdb_id'); const imdbId = this.props.data.get("show_imdb_id");
const season = this.props.data.get('season'); const season = this.props.data.get("season");
const episode = this.props.data.get('episode'); const episode = this.props.data.get("episode");
this.props.getEpisodeDetails(imdbId, season, episode); this.props.getEpisodeDetails(imdbId, season, episode);
} }
render() { render() {
return ( return (
<a type="button" className="btn btn-xs btn-info" onClick={(e) => this.handleClick(e)}> <a type="button" className="btn btn-xs btn-info" onClick={(e) => this.handleClick(e)}>
{this.props.data.get('fetching') || {this.props.data.get("fetching") ||
<span> <span>
<i className="fa fa-refresh"></i> Refresh <i className="fa fa-refresh"></i> Refresh
</span> </span>
} }
{this.props.data.get('fetching') && {this.props.data.get("fetching") &&
<span> <span>
<i className="fa fa-spin fa-refresh"></i> Refreshing <i className="fa fa-spin fa-refresh"></i> Refreshing
</span> </span>

View File

@ -1,28 +1,28 @@
import React from 'react' import React from "react"
import { connect } from 'react-redux' import { connect } from "react-redux"
import { bindActionCreators } from 'redux' import { bindActionCreators } from "redux"
import { selectShow, addShowToWishlist, import { selectShow, addShowToWishlist,
deleteShowFromWishlist, getShowDetails, updateFilter } from '../../actions/shows' deleteShowFromWishlist, getShowDetails, updateFilter } from "../../actions/shows"
import ListDetails from '../list/details' import ListDetails from "../list/details"
import ListPosters from '../list/posters' import ListPosters from "../list/posters"
import ShowButtons from './listButtons' import ShowButtons from "./listButtons"
function mapStateToProps(state) { function mapStateToProps(state) {
return { return {
loading : state.showsStore.get('loading'), loading : state.showsStore.get("loading"),
shows : state.showsStore.get('shows'), shows : state.showsStore.get("shows"),
filter : state.showsStore.get('filter'), filter : state.showsStore.get("filter"),
selectedImdbId : state.showsStore.get('selectedImdbId'), selectedImdbId : state.showsStore.get("selectedImdbId"),
lastFetchUrl : state.showsStore.get('lastFetchUrl'), lastFetchUrl : state.showsStore.get("lastFetchUrl"),
exploreOptions : state.showsStore.get('exploreOptions'), exploreOptions : state.showsStore.get("exploreOptions"),
}; };
} }
const mapDispatchToProps = (dispatch) => const mapDispatchToProps = (dispatch) =>
bindActionCreators({ selectShow, addShowToWishlist, bindActionCreators({ selectShow, addShowToWishlist,
deleteShowFromWishlist, getShowDetails, updateFilter }, dispatch) deleteShowFromWishlist, getShowDetails, updateFilter }, dispatch)
class ShowList extends React.Component { class ShowList extends React.PureComponent {
render() { render() {
let selectedShow; let selectedShow;
if (this.props.selectedImdbId !== "") { if (this.props.selectedImdbId !== "") {

View File

@ -1,12 +1,12 @@
import React from 'react' import React from "react"
import { Link } from 'react-router' import { Link } from "react-router"
import { DropdownButton } from 'react-bootstrap' import { DropdownButton } from "react-bootstrap"
import { WishlistButton, RefreshButton } from '../buttons/actions' import { WishlistButton, RefreshButton } from "../buttons/actions"
export default function ShowButtons(props) { export default function ShowButtons(props) {
const imdbLink = `http://www.imdb.com/title/${props.show.get('imdb_id')}`; const imdbLink = `http://www.imdb.com/title/${props.show.get("imdb_id")}`;
return ( return (
<div className="list-details-buttons btn-toolbar"> <div className="list-details-buttons btn-toolbar">
<ActionsButton <ActionsButton
@ -18,7 +18,7 @@ export default function ShowButtons(props) {
<a type="button" className="btn btn-warning btn-sm" href={imdbLink}> <a type="button" className="btn btn-warning btn-sm" href={imdbLink}>
<i className="fa fa-external-link"></i> IMDB <i className="fa fa-external-link"></i> IMDB
</a> </a>
<Link type="button" className="btn btn-primary btn-sm" to={"/shows/details/" + props.show.get('imdb_id')}> <Link type="button" className="btn btn-primary btn-sm" to={"/shows/details/" + props.show.get("imdb_id")}>
<i className="fa fa-external-link"></i> Details <i className="fa fa-external-link"></i> Details
</Link> </Link>
</div> </div>
@ -26,16 +26,16 @@ export default function ShowButtons(props) {
} }
function ActionsButton(props) { function ActionsButton(props) {
let wishlisted = (props.show.get('tracked_season') !== null && props.show.get('tracked_episode') !== null); let wishlisted = (props.show.get("tracked_season") !== null && props.show.get("tracked_episode") !== null);
return ( return (
<DropdownButton className="btn btn-default btn-sm" title="Actions" id="actions-button" dropup> <DropdownButton className="btn btn-default btn-sm" title="Actions" id="actions-button" dropup>
<RefreshButton <RefreshButton
fetching={props.show.get('fetchingDetails')} fetching={props.show.get("fetchingDetails")}
resourceId={props.show.get('imdb_id')} resourceId={props.show.get("imdb_id")}
getDetails={props.getDetails} getDetails={props.getDetails}
/> />
<WishlistButton <WishlistButton
resourceId={props.show.get('imdb_id')} resourceId={props.show.get("imdb_id")}
wishlisted={wishlisted} wishlisted={wishlisted}
addToWishlist={props.addToWishlist} addToWishlist={props.addToWishlist}
deleteFromWishlist={props.deleteFromWishlist} deleteFromWishlist={props.deleteFromWishlist}

View File

@ -1,10 +1,10 @@
import React from 'react' import React from "react"
import { connect } from 'react-redux' import { connect } from "react-redux"
import { bindActionCreators } from 'redux' import { bindActionCreators } from "redux"
import { addTorrent } from '../../actions/torrents' import { addTorrent } from "../../actions/torrents"
function mapStateToProps(state) { function mapStateToProps(state) {
return { torrents: state.torrentStore.get('torrents') }; return { torrents: state.torrentStore.get("torrents") };
} }
const mapDispatchToProps = (dispatch) => const mapDispatchToProps = (dispatch) =>
bindActionCreators({ addTorrent }, dispatch) bindActionCreators({ addTorrent }, dispatch)
@ -24,7 +24,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(TorrentList);
class AddTorrent extends React.PureComponent { class AddTorrent extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { url: '' }; this.state = { url: "" };
this.handleSubmit = this.handleSubmit.bind(this); this.handleSubmit = this.handleSubmit.bind(this);
this.handleChange = this.handleChange.bind(this); this.handleChange = this.handleChange.bind(this);
} }
@ -35,7 +35,7 @@ class AddTorrent extends React.PureComponent {
if (this.state.url === "") { if (this.state.url === "") {
return; return;
} }
this.setState({ url: '' }); this.setState({ url: "" });
this.props.func(this.state.url); this.props.func(this.state.url);
} }
render() { render() {
@ -96,23 +96,23 @@ class List extends React.PureComponent {
class Torrent extends React.PureComponent { class Torrent extends React.PureComponent {
render() { render() {
const done = this.props.data.get('is_finished'); const done = this.props.data.get("is_finished");
var progressStyle = 'progress-bar progress-bar-warning'; var progressStyle = "progress-bar progress-bar-warning";
if (done) { if (done) {
progressStyle = 'progress-bar progress-bar-success'; progressStyle = "progress-bar progress-bar-success";
} }
var percentDone = this.props.data.get('percent_done'); var percentDone = this.props.data.get("percent_done");
const started = (percentDone !== 0); const started = (percentDone !== 0);
if (started) { if (started) {
percentDone = Number(percentDone).toFixed(1) + '%'; percentDone = Number(percentDone).toFixed(1) + "%";
} }
var downloadedSize = prettySize(this.props.data.get('downloaded_size')); var downloadedSize = prettySize(this.props.data.get("downloaded_size"));
var totalSize = prettySize(this.props.data.get('total_size')); var totalSize = prettySize(this.props.data.get("total_size"));
var downloadRate = prettySize(this.props.data.get('download_rate')) + "/s"; var downloadRate = prettySize(this.props.data.get("download_rate")) + "/s";
return ( return (
<div className="panel panel-default"> <div className="panel panel-default">
<div className="panel-heading">{this.props.data.get('name')}</div> <div className="panel-heading">{this.props.data.get("name")}</div>
<div className="panel-body"> <div className="panel-body">
{started && {started &&
<div className="progress progress-striped"> <div className="progress progress-striped">
@ -138,7 +138,7 @@ class Torrent extends React.PureComponent {
function prettySize(fileSizeInBytes) { function prettySize(fileSizeInBytes) {
var i = -1; var i = -1;
var byteUnits = [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB']; var byteUnits = [" kB", " MB", " GB", " TB", "PB", "EB", "ZB", "YB"];
do { do {
fileSizeInBytes = fileSizeInBytes / 1024; fileSizeInBytes = fileSizeInBytes / 1024;
i++; i++;

View File

@ -1,19 +1,19 @@
import React from 'react' import React from "react"
import { connect } from 'react-redux' import { connect } from "react-redux"
import { bindActionCreators } from 'redux' import { bindActionCreators } from "redux"
import { updateUser } from '../../actions/users' import { updateUser } from "../../actions/users"
function mapStateToProps(state) { function mapStateToProps(state) {
return { return {
polochonToken: state.userStore.get('polochonToken'), polochonToken: state.userStore.get("polochonToken"),
polochonUrl: state.userStore.get('polochonUrl'), polochonUrl: state.userStore.get("polochonUrl"),
}; };
} }
const mapDispatchToProps = (dispatch) => const mapDispatchToProps = (dispatch) =>
bindActionCreators({ updateUser }, dispatch) bindActionCreators({ updateUser }, dispatch)
class UserEdit extends React.Component { class UserEdit extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
@ -27,10 +27,10 @@ class UserEdit extends React.Component {
handleSubmit(ev) { handleSubmit(ev) {
ev.preventDefault(); ev.preventDefault();
this.props.updateUser({ this.props.updateUser({
'polochon_url': this.refs.polochonUrl.value, "polochon_url": this.refs.polochonUrl.value,
'polochon_token': this.refs.polochonToken.value, "polochon_token": this.refs.polochonToken.value,
'password': this.refs.newPassword.value, "password": this.refs.newPassword.value,
'password_confirm': this.refs.newPasswordConfirm.value, "password_confirm": this.refs.newPasswordConfirm.value,
}); });
} }
handleTokenInput() { handleTokenInput() {

View File

@ -1,19 +1,19 @@
import React from 'react' import React from "react"
import { connect } from 'react-redux' import { connect } from "react-redux"
import { bindActionCreators } from 'redux' import { bindActionCreators } from "redux"
import { loginUser } from '../../actions/users' import { loginUser } from "../../actions/users"
function mapStateToProps(state) { function mapStateToProps(state) {
return { return {
isLogged: state.userStore.get('isLogged'), isLogged: state.userStore.get("isLogged"),
loading: state.userStore.get('loading'), loading: state.userStore.get("loading"),
}; };
} }
const mapDispatchToProps = (dispatch) => const mapDispatchToProps = (dispatch) =>
bindActionCreators({ loginUser }, dispatch) bindActionCreators({ loginUser }, dispatch)
class UserLoginForm extends React.Component { class UserLoginForm extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.handleSubmit = this.handleSubmit.bind(this); this.handleSubmit = this.handleSubmit.bind(this);
@ -24,7 +24,7 @@ class UserLoginForm extends React.Component {
} }
if (!nextProps.location.query.redirect) { if (!nextProps.location.query.redirect) {
// Redirect home // Redirect home
nextProps.router.push('/'); nextProps.router.push("/");
} else { } else {
// Redirect to the previous page // Redirect to the previous page
nextProps.router.push(nextProps.location.query.redirect); nextProps.router.push(nextProps.location.query.redirect);

View File

@ -1,13 +1,13 @@
import React from 'react' import React from "react"
import { connect } from 'react-redux' import { connect } from "react-redux"
import { bindActionCreators } from 'redux' import { bindActionCreators } from "redux"
import { userSignUp } from '../../actions/users' import { userSignUp } from "../../actions/users"
const mapDispatchToProps = (dispatch) => const mapDispatchToProps = (dispatch) =>
bindActionCreators({ userSignUp }, dispatch) bindActionCreators({ userSignUp }, dispatch)
class UserSignUp extends React.Component { class UserSignUp extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.handleSubmit = this.handleSubmit.bind(this); this.handleSubmit = this.handleSubmit.bind(this);
@ -15,9 +15,9 @@ class UserSignUp extends React.Component {
handleSubmit(e) { handleSubmit(e) {
e.preventDefault(); e.preventDefault();
this.props.userSignUp({ this.props.userSignUp({
'username': this.refs.username.value, "username": this.refs.username.value,
'password': this.refs.password.value, "password": this.refs.password.value,
'password_confirm': this.refs.passwordConfirm.value, "password_confirm": this.refs.passwordConfirm.value,
}); });
} }
render() { render() {