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) {
super(props);
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) {
super(props);
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) {
super(props);
this.handleClick = this.handleClick.bind(this);

View File

@ -1,9 +1,8 @@
import React from 'react'
import { toJS } from 'immutable'
import React from "react"
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) {
super(props);
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) {
super(props);
}
@ -81,9 +80,9 @@ class Player extends React.Component {
<track
key={index}
kind="subtitles"
label={el.get('language')}
src={el.get('vvt_file')}
srcLang={el.get('language')}
label={el.get("language")}
src={el.get("vvt_file")}
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) {
super(props);
this.handleClick = this.handleClick.bind(this);
}
handleClick(e, url) {
handleClick(e) {
e.preventDefault();
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>
{entries.map(function(e, index) {
switch (e.type) {
case 'action':
case "action":
return (
<MenuItem key={index} onClick={(event) => this.handleClick(event, e.url)}>
{this.props.fetching ||
@ -48,11 +48,11 @@ export default class SubtitlesButton extends React.Component {
}
</MenuItem>
);
case 'divider':
case "divider":
return (
<MenuItem key={index} divider></MenuItem>
);
case 'entry':
case "entry":
return (
<MenuItem key={index} href={e.url}>
<i className="fa fa-download"></i> {e.lang}
@ -87,8 +87,8 @@ function buildMenuItems(subtitles) {
entries.push({
type: "entry",
// Take only the last part of fr_FR
lang: sub.get('language').split("_")[1],
url: sub.get('url'),
lang: sub.get("language").split("_")[1],
url: sub.get("url"),
});
}

View File

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

View File

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

View File

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

View File

@ -1,12 +1,12 @@
import React from 'react'
import React from "react"
export default class ListPoster extends React.PureComponent {
constructor(props) {
super(props);
}
render() {
const selected = this.props.selected ? ' thumbnail-selected' : '';
const imgClass = 'thumbnail' + selected;
const selected = this.props.selected ? " thumbnail-selected" : "";
const imgClass = "thumbnail" + selected;
const displayClearFixLg = (this.props.index % 6) === 0;
const displayClearFixMd = (this.props.index % 4) === 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">
<a className={imgClass}>
<img
src={this.props.data.get('poster_url')}
src={this.props.data.get("poster_url")}
onClick={this.props.onClick}
/>
</a>

View File

@ -1,19 +1,17 @@
import React from 'react'
import { Map, List, fromJS } from 'immutable'
import React from "react"
import fuzzy from 'fuzzy';
import InfiniteScroll from 'react-infinite-scroller';
import fuzzy from "fuzzy";
import InfiniteScroll from "react-infinite-scroller";
import ListFilter from './filter'
import ExplorerOptions from './explorerOptions'
import ListPoster from './poster'
import ListFilter from "./filter"
import ExplorerOptions from "./explorerOptions"
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;
export default class ListPosters extends React.Component {
export default class ListPosters extends React.PureComponent {
constructor(props) {
super(props);
this.loadMore = this.loadMore.bind(this);
@ -62,7 +60,7 @@ export default class ListPosters extends React.Component {
// Filter the list of elements
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 {
elmts = elmts.slice(0, this.state.items);
}
@ -131,7 +129,7 @@ class Posters extends React.PureComponent {
className="row"
>
{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;
return (
<ListPoster

View File

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

View File

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

View File

@ -1,26 +1,26 @@
import React from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { addTorrent } from '../../actions/torrents'
import { refreshSubtitles } from '../../actions/subtitles'
import React from "react"
import { connect } from "react-redux"
import { bindActionCreators } from "redux"
import { addTorrent } from "../../actions/torrents"
import { refreshSubtitles } from "../../actions/subtitles"
import { addMovieToWishlist, deleteMovie, deleteMovieFromWishlist,
getMovieDetails, selectMovie, updateFilter } from '../../actions/movies'
getMovieDetails, selectMovie, updateFilter } from "../../actions/movies"
import DownloadButton from '../buttons/download'
import SubtitlesButton from '../buttons/subtitles'
import TorrentsButton from './torrents'
import ActionsButton from './actions'
import ListPosters from '../list/posters'
import ListDetails from '../list/details'
import DownloadButton from "../buttons/download"
import SubtitlesButton from "../buttons/subtitles"
import TorrentsButton from "./torrents"
import ActionsButton from "./actions"
import ListPosters from "../list/posters"
import ListDetails from "../list/details"
function mapStateToProps(state) {
return {
loading : state.movieStore.get('loading'),
movies : state.movieStore.get('movies'),
filter : state.movieStore.get('filter'),
selectedImdbId : state.movieStore.get('selectedImdbId'),
lastFetchUrl : state.movieStore.get('lastFetchUrl'),
exploreOptions : state.movieStore.get('exploreOptions'),
loading : state.movieStore.get("loading"),
movies : state.movieStore.get("movies"),
filter : state.movieStore.get("filter"),
selectedImdbId : state.movieStore.get("selectedImdbId"),
lastFetchUrl : state.movieStore.get("lastFetchUrl"),
exploreOptions : state.movieStore.get("exploreOptions"),
};
}
const mapDispatchToProps = (dipatch) =>
@ -29,51 +29,51 @@ const mapDispatchToProps = (dipatch) =>
refreshSubtitles, updateFilter }, dipatch)
function MovieButtons(props) {
const imdb_link = `http://www.imdb.com/title/${props.movie.get('imdb_id')}`;
const hasMovie = (props.movie.get('polochon_url') !== "");
const imdbLink = `http://www.imdb.com/title/${props.movie.get("imdb_id")}`;
const hasMovie = (props.movie.get("polochon_url") !== "");
return (
<div className="list-details-buttons btn-toolbar">
<ActionsButton
fetching={props.movie.get('fetchingDetails')}
movieId={props.movie.get('imdb_id')}
fetching={props.movie.get("fetchingDetails")}
movieId={props.movie.get("imdb_id")}
getDetails={props.getMovieDetails}
deleteMovie={props.deleteMovie}
hasMovie={hasMovie}
wishlisted={props.movie.get('wishlisted')}
wishlisted={props.movie.get("wishlisted")}
addToWishlist={props.addToWishlist}
deleteFromWishlist={props.deleteFromWishlist}
lastFetchUrl={props.lastFetchUrl}
/>
{props.movie.get('torrents') !== null &&
{props.movie.get("torrents") !== null &&
<TorrentsButton
torrents={props.movie.get('torrents')}
torrents={props.movie.get("torrents")}
addTorrent={props.addTorrent}
/>
}
<DownloadButton
url={props.movie.get('polochon_url')}
subtitles={props.movie.get('subtitles')}
url={props.movie.get("polochon_url")}
subtitles={props.movie.get("subtitles")}
/>
<SubtitlesButton
fetching={props.movie.get('fetchingSubtitles')}
url={props.movie.get('polochon_url')}
subtitles={props.movie.get('subtitles')}
fetching={props.movie.get("fetchingSubtitles")}
url={props.movie.get("polochon_url")}
subtitles={props.movie.get("subtitles")}
refreshSubtitles={props.refreshSubtitles}
resourceID={props.movie.get('imdb_id')}
resourceID={props.movie.get("imdb_id")}
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
</a>
</div>
);
}
class MovieList extends React.Component {
class MovieList extends React.PureComponent {
constructor(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) {
super(props);
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>
{entries.map(function(e, index) {
switch (e.type) {
case 'header':
case "header":
return (
<MenuItem key={index} className="text-warning" header>
{e.value}
</MenuItem>
);
case 'divider':
case "divider":
return (
<MenuItem key={index} divider></MenuItem>
);
case 'entry':
case "entry":
return (
<MenuItem key={index} href={e.url} onClick={(event) => this.handleClick(event, e.url)}>
{e.quality}
@ -41,7 +41,7 @@ export default class TorrentsButton extends React.Component {
}
function buildMenuItems(torrents) {
const t = torrents.groupBy((el) => el.get('source'));
const t = torrents.groupBy((el) => el.get("source"));
// Build the array of entries
let entries = [];
@ -57,8 +57,8 @@ function buildMenuItems(torrents) {
for (let torrent of torrentList) {
entries.push({
type: "entry",
quality: torrent.get('quality'),
url: torrent.get('url'),
quality: torrent.get("quality"),
url: torrent.get("url"),
});
}

View File

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

View File

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

View File

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

View File

@ -1,12 +1,12 @@
import React from 'react'
import React from "react"
import { Link } from 'react-router'
import { DropdownButton } from 'react-bootstrap'
import { Link } from "react-router"
import { DropdownButton } from "react-bootstrap"
import { WishlistButton, RefreshButton } from '../buttons/actions'
import { WishlistButton, RefreshButton } from "../buttons/actions"
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 (
<div className="list-details-buttons btn-toolbar">
<ActionsButton
@ -18,7 +18,7 @@ export default function ShowButtons(props) {
<a type="button" className="btn btn-warning btn-sm" href={imdbLink}>
<i className="fa fa-external-link"></i> IMDB
</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
</Link>
</div>
@ -26,16 +26,16 @@ export default function ShowButtons(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 (
<DropdownButton className="btn btn-default btn-sm" title="Actions" id="actions-button" dropup>
<RefreshButton
fetching={props.show.get('fetchingDetails')}
resourceId={props.show.get('imdb_id')}
fetching={props.show.get("fetchingDetails")}
resourceId={props.show.get("imdb_id")}
getDetails={props.getDetails}
/>
<WishlistButton
resourceId={props.show.get('imdb_id')}
resourceId={props.show.get("imdb_id")}
wishlisted={wishlisted}
addToWishlist={props.addToWishlist}
deleteFromWishlist={props.deleteFromWishlist}

View File

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

View File

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

View File

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

View File

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