Compare commits
No commits in common. "ae7c752e43ae672797835d62cae5db6a507fce8e" and "d94843be9f7820b51e6c66a2786dcde71cad6da4" have entirely different histories.
ae7c752e43
...
d94843be9f
@ -1,15 +1,15 @@
|
||||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import { upperCaseFirst } from "../../utils";
|
||||
|
||||
export const Genres = ({ genres = [] }) => {
|
||||
if (!genres || genres.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Uppercase first genres
|
||||
const prettyGenres = genres.map((w) => upperCaseFirst(w)).join(", ");
|
||||
const prettyGenres = genres
|
||||
.map((word) => word[0].toUpperCase() + word.substr(1))
|
||||
.join(", ");
|
||||
|
||||
return (
|
||||
<span>
|
||||
|
@ -3,11 +3,22 @@ import PropTypes from "prop-types";
|
||||
import moment from "moment";
|
||||
|
||||
const prettyDate = (input) => {
|
||||
if (typeof input !== "string" || input === "") {
|
||||
return input;
|
||||
switch (typeof input) {
|
||||
case "string":
|
||||
if (input === "") {
|
||||
return "";
|
||||
}
|
||||
break;
|
||||
case "number":
|
||||
if (input === 0) {
|
||||
return "";
|
||||
}
|
||||
return input;
|
||||
default:
|
||||
return input;
|
||||
}
|
||||
|
||||
const date = moment(input, "YYYY-MM-DD HH:mm:ss Z");
|
||||
const date = moment(input);
|
||||
if (!date.isValid()) {
|
||||
return "";
|
||||
}
|
||||
|
@ -3,8 +3,6 @@ import PropTypes from "prop-types";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import { Form, FormGroup, FormControl, FormLabel } from "react-bootstrap";
|
||||
|
||||
import { upperCaseFirst } from "../../utils";
|
||||
|
||||
const ExplorerOptions = ({
|
||||
display,
|
||||
params,
|
||||
@ -47,7 +45,7 @@ const ExplorerOptions = ({
|
||||
return name
|
||||
.replace("_", " ")
|
||||
.split(" ")
|
||||
.map((w) => upperCaseFirst(w))
|
||||
.map((w) => w[0].toUpperCase() + w.substr(1))
|
||||
.join(" ");
|
||||
};
|
||||
|
||||
|
@ -2,8 +2,6 @@ import React from "react";
|
||||
import Loader from "../loader/loader";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import { upperCaseFirst } from "../../utils";
|
||||
|
||||
// TODO: udpate this
|
||||
import { OverlayTrigger, Tooltip } from "react-bootstrap";
|
||||
|
||||
@ -26,11 +24,13 @@ Modules.propTypes = {
|
||||
};
|
||||
export default Modules;
|
||||
|
||||
const capitalize = (string) => string.charAt(0).toUpperCase() + string.slice(1);
|
||||
|
||||
const ModulesByVideoType = ({ type, modules }) => (
|
||||
<div className="col-12 col-md-6">
|
||||
<div className="card mb-3">
|
||||
<div className="card-header">
|
||||
<h3>{`${upperCaseFirst(type)} modules`}</h3>
|
||||
<h3>{`${capitalize(type)} modules`}</h3>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
{Object.keys(modules).map((moduleType, i) => (
|
||||
@ -47,7 +47,7 @@ ModulesByVideoType.propTypes = {
|
||||
|
||||
const ModuleByType = ({ type, modules }) => (
|
||||
<div>
|
||||
<h4>{upperCaseFirst(type)}</h4>
|
||||
<h4>{capitalize(type)}</h4>
|
||||
<table className="table">
|
||||
<tbody>
|
||||
{modules.map((module, type) => {
|
||||
|
@ -1,16 +1,13 @@
|
||||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import { prettySize, upperCaseFirst } from "../../../utils";
|
||||
import { prettySize } from "../../../utils";
|
||||
|
||||
export const Progress = ({ torrent }) => {
|
||||
const downloading = torrent.status.state === "downloading";
|
||||
let progressBarClass = torrent.status.is_finished
|
||||
? "progress-bar bg-success"
|
||||
: "progress-bar bg-info";
|
||||
if (torrent.status.state === "downloading") {
|
||||
progressBarClass += " progress-bar-striped progress-bar-animated";
|
||||
}
|
||||
var progressStyle = torrent.status.is_finished
|
||||
? "success"
|
||||
: "info progress-bar-striped progress-bar-animated";
|
||||
const progressBarClass = "progress-bar bg-" + progressStyle;
|
||||
|
||||
var percentDone = torrent.status.percent_done;
|
||||
const started = percentDone !== 0;
|
||||
@ -34,14 +31,14 @@ export const Progress = ({ torrent }) => {
|
||||
aria-valuemax="100"
|
||||
></div>
|
||||
</div>
|
||||
{downloading && (
|
||||
{started && (
|
||||
<p>
|
||||
{downloadedSize} / {totalSize} - {percentDone} - {downloadRate}
|
||||
</p>
|
||||
)}
|
||||
{!downloading && (
|
||||
<p className="text-muted">
|
||||
<small>{upperCaseFirst(torrent.status.state)}</small>
|
||||
{!started && (
|
||||
<p>
|
||||
<small>Not yet started</small>
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
@ -49,9 +49,7 @@ export default (state = defaultState, action) =>
|
||||
case "TORRENTS_FETCH_FULFILLED":
|
||||
draft.fetching = false;
|
||||
draft.torrents = formatTorrents(action.payload.response.data);
|
||||
draft.count = action.payload.response.data
|
||||
? action.payload.response.data.length
|
||||
: 0;
|
||||
draft.count = action.payload.response.data.length;
|
||||
break;
|
||||
|
||||
case "TORRENTS_SEARCH_PENDING":
|
||||
|
@ -28,9 +28,9 @@ export const prettySize = (fileSizeInBytes) => {
|
||||
var i = -1;
|
||||
var byteUnits = [" kB", " MB", " GB", " TB", "PB", "EB", "ZB", "YB"];
|
||||
do {
|
||||
fileSizeInBytes = fileSizeInBytes / 1000;
|
||||
fileSizeInBytes = fileSizeInBytes / 1024;
|
||||
i++;
|
||||
} while (fileSizeInBytes > 1000);
|
||||
} while (fileSizeInBytes > 1024);
|
||||
|
||||
return Math.max(fileSizeInBytes, 0.1).toFixed(1) + byteUnits[i];
|
||||
};
|
||||
@ -55,6 +55,3 @@ export const formatTorrents = (input) => {
|
||||
|
||||
return torrentMap;
|
||||
};
|
||||
|
||||
export const upperCaseFirst = (string) =>
|
||||
string.charAt(0).toUpperCase() + string.slice(1);
|
||||
|
4
go.mod
4
go.mod
@ -15,8 +15,8 @@ require (
|
||||
github.com/mattn/go-sqlite3 v1.10.0 // indirect
|
||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
|
||||
github.com/odwrtw/errors v0.0.0-20170604160533-c747b9d17833
|
||||
github.com/odwrtw/papi v0.0.0-20200416090004-26e95d2feb66
|
||||
github.com/odwrtw/polochon v0.0.0-20200416085801-6331a40936bf
|
||||
github.com/odwrtw/papi v0.0.0-20200413153625-62744e1c1b73
|
||||
github.com/odwrtw/polochon v0.0.0-20200413153516-6d6ff1d17684
|
||||
github.com/phyber/negroni-gzip v0.0.0-20180113114010-ef6356a5d029
|
||||
github.com/pioz/tvdb v0.0.0-20190503215423-f45c687faba9 // indirect
|
||||
github.com/robfig/cron v1.1.0
|
||||
|
10
go.sum
10
go.sum
@ -134,10 +134,12 @@ github.com/odwrtw/guessit v0.0.0-20200131084001-f88613483547/go.mod h1:W22g7wtc0
|
||||
github.com/odwrtw/imdb-watchlist v0.0.0-20190417175016-b7a9f7503d69 h1:ow6b/4Jj7J5iYwU678/rbijvaNUJrYkg13j9Nivkung=
|
||||
github.com/odwrtw/imdb-watchlist v0.0.0-20190417175016-b7a9f7503d69/go.mod h1:o2tLH95CtNdqhDb0aS2NbU+1I4PmaNsODpr33Ry0JC0=
|
||||
github.com/odwrtw/papi v0.0.0-20190413103029-bd5bfea85ae6/go.mod h1:CXotdtODLpW0/yuFV5XH8Rmrj0eAfPLvdMKykPM2WCk=
|
||||
github.com/odwrtw/papi v0.0.0-20200416090004-26e95d2feb66 h1:E+UrY1WG5xp65UXs2rbtVVD4FdSffMR9E0lbd7xdf80=
|
||||
github.com/odwrtw/papi v0.0.0-20200416090004-26e95d2feb66/go.mod h1:eY0skvVHJBwbSJ18uq2c1T4SvhdEV8R0XFSb0zKh5Yo=
|
||||
github.com/odwrtw/polochon v0.0.0-20200416085801-6331a40936bf h1:zzsX9o1Gxe1esokjdcOMa5hMC2aqubWXQoAEqMCMyyY=
|
||||
github.com/odwrtw/polochon v0.0.0-20200416085801-6331a40936bf/go.mod h1:rBjekia21ToZoTxJqR/5Ued8EYwKTtamq+bo/XINOjA=
|
||||
github.com/odwrtw/papi v0.0.0-20200410143325-49e6f827259d/go.mod h1:eY0skvVHJBwbSJ18uq2c1T4SvhdEV8R0XFSb0zKh5Yo=
|
||||
github.com/odwrtw/papi v0.0.0-20200413153625-62744e1c1b73 h1:19mh4fw/WGFtYg/7oHg1Y5rU9ZRxD3LqrtwY2NI6l6w=
|
||||
github.com/odwrtw/papi v0.0.0-20200413153625-62744e1c1b73/go.mod h1:eY0skvVHJBwbSJ18uq2c1T4SvhdEV8R0XFSb0zKh5Yo=
|
||||
github.com/odwrtw/polochon v0.0.0-20200410143337-006e3fb9fb55/go.mod h1:sAYf/A5tDmins2GHZn2mEFarmYltAZv+bcmSKSxDUaI=
|
||||
github.com/odwrtw/polochon v0.0.0-20200413153516-6d6ff1d17684 h1:b9JDu8423NGXOYN0gtoiVrLKbZ/CfAyc2ouCRuE+mI8=
|
||||
github.com/odwrtw/polochon v0.0.0-20200413153516-6d6ff1d17684/go.mod h1:rBjekia21ToZoTxJqR/5Ued8EYwKTtamq+bo/XINOjA=
|
||||
github.com/odwrtw/tpb v0.0.0-20200130133144-c846aa382c6f h1:fwEIGT+o3e8+XkBqrwsE3/+9ketTQXflPhCkv3/w990=
|
||||
github.com/odwrtw/tpb v0.0.0-20200130133144-c846aa382c6f/go.mod h1:updLvMbQo2xHoz94MX9+GqmSoKhf6E8fs/J+wLvvu6A=
|
||||
github.com/odwrtw/trakttv v0.0.0-20200404161731-0d594827e4f9 h1:PuQLHO75MXUsJpf9BcTVxvR/FCkdn1MZnZt6h3o6cJI=
|
||||
|
Loading…
x
Reference in New Issue
Block a user