Compare commits
No commits in common. "e5be15c9540f27f7612ab0303d4be6c17e37bf99" and "15f95c0d74dfa29b4498b3553a79e2ff4f3afea7" have entirely different histories.
e5be15c954
...
15f95c0d74
@ -2,8 +2,8 @@ export function addAlertError(message) {
|
|||||||
return {
|
return {
|
||||||
type: "ADD_ALERT_ERROR",
|
type: "ADD_ALERT_ERROR",
|
||||||
payload: {
|
payload: {
|
||||||
message,
|
message
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11,13 +11,13 @@ export function addAlertOk(message) {
|
|||||||
return {
|
return {
|
||||||
type: "ADD_ALERT_OK",
|
type: "ADD_ALERT_OK",
|
||||||
payload: {
|
payload: {
|
||||||
message,
|
message
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function dismissAlert() {
|
export function dismissAlert() {
|
||||||
return {
|
return {
|
||||||
type: "DISMISS_ALERT",
|
type: "DISMISS_ALERT"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@ export function updateLastMovieFetchUrl(url) {
|
|||||||
return {
|
return {
|
||||||
type: "UPDATE_LAST_MOVIE_FETCH_URL",
|
type: "UPDATE_LAST_MOVIE_FETCH_URL",
|
||||||
payload: {
|
payload: {
|
||||||
url: url,
|
url: url
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,8 +16,8 @@ export function selectMovie(imdbId) {
|
|||||||
return {
|
return {
|
||||||
type: "SELECT_MOVIE",
|
type: "SELECT_MOVIE",
|
||||||
payload: {
|
payload: {
|
||||||
imdbId,
|
imdbId
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,8 +25,8 @@ export function updateFilter(filter) {
|
|||||||
return {
|
return {
|
||||||
type: "MOVIE_UPDATE_FILTER",
|
type: "MOVIE_UPDATE_FILTER",
|
||||||
payload: {
|
payload: {
|
||||||
filter,
|
filter
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ export function getMovieDetails(imdbId) {
|
|||||||
configureAxios().post(`/movies/${imdbId}/refresh`),
|
configureAxios().post(`/movies/${imdbId}/refresh`),
|
||||||
null,
|
null,
|
||||||
{
|
{
|
||||||
imdbId,
|
imdbId
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -51,7 +51,7 @@ export function getMovieDetails(imdbId) {
|
|||||||
export function deleteMovie(imdbId, lastFetchUrl) {
|
export function deleteMovie(imdbId, lastFetchUrl) {
|
||||||
return request("MOVIE_DELETE", configureAxios().delete(`/movies/${imdbId}`), [
|
return request("MOVIE_DELETE", configureAxios().delete(`/movies/${imdbId}`), [
|
||||||
fetchMovies(lastFetchUrl),
|
fetchMovies(lastFetchUrl),
|
||||||
addAlertOk("Movie deleted"),
|
addAlertOk("Movie deleted")
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,26 +84,26 @@ export function updateMovieWishlistStore(imdbId, wishlisted) {
|
|||||||
type: "MOVIE_UPDATE_STORE_WISHLIST",
|
type: "MOVIE_UPDATE_STORE_WISHLIST",
|
||||||
payload: {
|
payload: {
|
||||||
imdbId,
|
imdbId,
|
||||||
wishlisted,
|
wishlisted
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fetchMovies(url) {
|
export function fetchMovies(url) {
|
||||||
return request("MOVIE_LIST_FETCH", configureAxios().get(url), [
|
return request("MOVIE_LIST_FETCH", configureAxios().get(url), [
|
||||||
updateLastMovieFetchUrl(url),
|
updateLastMovieFetchUrl(url)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
export const newMovieEvent = (data) => {
|
export const newMovieEvent = data => {
|
||||||
return (dispatch) => {
|
return dispatch => {
|
||||||
dispatch(
|
dispatch(
|
||||||
sendNotification({
|
sendNotification({
|
||||||
icon: "film",
|
icon: "film",
|
||||||
autohide: true,
|
autohide: true,
|
||||||
delay: 10000,
|
delay: 10000,
|
||||||
title: `${data.title} added to the library`,
|
title: `${data.title} added to the library`,
|
||||||
imageUrl: data.thumb,
|
imageUrl: data.thumb
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
export const sendNotification = (data) => ({
|
export const sendNotification = data => ({
|
||||||
type: "ADD_NOTIFICATION",
|
type: "ADD_NOTIFICATION",
|
||||||
payload: data,
|
payload: data
|
||||||
});
|
});
|
||||||
|
|
||||||
export const removeNotification = (id) => ({
|
export const removeNotification = id => ({
|
||||||
type: "REMOVE_NOTIFICATION",
|
type: "REMOVE_NOTIFICATION",
|
||||||
payload: { id },
|
payload: { id }
|
||||||
});
|
});
|
||||||
|
@ -11,10 +11,10 @@ export const getManagedPolochons = () =>
|
|||||||
configureAxios().get("/users/polochons")
|
configureAxios().get("/users/polochons")
|
||||||
);
|
);
|
||||||
|
|
||||||
export const addPolochon = (params) =>
|
export const addPolochon = params =>
|
||||||
request("ADD_POLOCHON", configureAxios().post("/polochons", params), [
|
request("ADD_POLOCHON", configureAxios().post("/polochons", params), [
|
||||||
() => getPolochons(),
|
() => getPolochons(),
|
||||||
() => getManagedPolochons(),
|
() => getManagedPolochons()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export const updatePolochon = ({ id, ...params }) =>
|
export const updatePolochon = ({ id, ...params }) =>
|
||||||
@ -24,10 +24,10 @@ export const updatePolochon = ({ id, ...params }) =>
|
|||||||
[() => getPolochons(), () => getManagedPolochons()]
|
[() => getPolochons(), () => getManagedPolochons()]
|
||||||
);
|
);
|
||||||
|
|
||||||
export const deletePolochon = (id) =>
|
export const deletePolochon = id =>
|
||||||
request("DELETE_POLOCHON", configureAxios().delete(`/polochons/${id}`), [
|
request("DELETE_POLOCHON", configureAxios().delete(`/polochons/${id}`), [
|
||||||
() => getPolochons(),
|
() => getPolochons(),
|
||||||
() => getManagedPolochons(),
|
() => getManagedPolochons()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export const editPolochonUser = ({ polochonId, id, ...params }) =>
|
export const editPolochonUser = ({ polochonId, id, ...params }) =>
|
||||||
|
@ -5,7 +5,7 @@ import { sendNotification } from "./notifications";
|
|||||||
|
|
||||||
export function fetchShows(url) {
|
export function fetchShows(url) {
|
||||||
return request("SHOW_LIST_FETCH", configureAxios().get(url), [
|
return request("SHOW_LIST_FETCH", configureAxios().get(url), [
|
||||||
updateLastShowsFetchUrl(url),
|
updateLastShowsFetchUrl(url)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ export function getEpisodeDetails(imdbId, season, episode) {
|
|||||||
{
|
{
|
||||||
imdbId,
|
imdbId,
|
||||||
season,
|
season,
|
||||||
episode,
|
episode
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ export function addShowToWishlist(imdbId, season = null, episode = null) {
|
|||||||
"SHOW_ADD_TO_WISHLIST",
|
"SHOW_ADD_TO_WISHLIST",
|
||||||
configureAxios().post(`/wishlist/shows/${imdbId}`, {
|
configureAxios().post(`/wishlist/shows/${imdbId}`, {
|
||||||
season: season,
|
season: season,
|
||||||
episode: episode,
|
episode: episode
|
||||||
}),
|
}),
|
||||||
[updateShowWishlistStore(imdbId, true, season, episode)]
|
[updateShowWishlistStore(imdbId, true, season, episode)]
|
||||||
);
|
);
|
||||||
@ -85,8 +85,8 @@ export function updateShowWishlistStore(
|
|||||||
payload: {
|
payload: {
|
||||||
imdbId,
|
imdbId,
|
||||||
season,
|
season,
|
||||||
episode,
|
episode
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,8 +101,8 @@ export function selectShow(imdbId) {
|
|||||||
return {
|
return {
|
||||||
type: "SELECT_SHOW",
|
type: "SELECT_SHOW",
|
||||||
payload: {
|
payload: {
|
||||||
imdbId,
|
imdbId
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,8 +110,8 @@ export function updateFilter(filter) {
|
|||||||
return {
|
return {
|
||||||
type: "SHOWS_UPDATE_FILTER",
|
type: "SHOWS_UPDATE_FILTER",
|
||||||
payload: {
|
payload: {
|
||||||
filter,
|
filter
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,13 +119,13 @@ export function updateLastShowsFetchUrl(url) {
|
|||||||
return {
|
return {
|
||||||
type: "UPDATE_LAST_SHOWS_FETCH_URL",
|
type: "UPDATE_LAST_SHOWS_FETCH_URL",
|
||||||
payload: {
|
payload: {
|
||||||
url: url,
|
url: url
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const newEpisodeEvent = (data) => {
|
export const newEpisodeEvent = data => {
|
||||||
return (dispatch) => {
|
return dispatch => {
|
||||||
dispatch(
|
dispatch(
|
||||||
sendNotification({
|
sendNotification({
|
||||||
icon: "video-camera",
|
icon: "video-camera",
|
||||||
@ -136,7 +136,7 @@ export const newEpisodeEvent = (data) => {
|
|||||||
data.season,
|
data.season,
|
||||||
data.episode
|
data.episode
|
||||||
)} added to the library`,
|
)} added to the library`,
|
||||||
imageUrl: `img/shows/${data.show_imdb_id}-poster.jpg`,
|
imageUrl: `img/shows/${data.show_imdb_id}-poster.jpg`
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { configureAxios, request } from "../requests";
|
import { configureAxios, request } from "../requests";
|
||||||
|
|
||||||
export const searchMovieSubtitles = (imdbId) => {
|
export const searchMovieSubtitles = imdbId => {
|
||||||
return request(
|
return request(
|
||||||
"MOVIE_SUBTITLES_UPDATE",
|
"MOVIE_SUBTITLES_UPDATE",
|
||||||
configureAxios().post(`/movies/${imdbId}/subtitles/refresh`),
|
configureAxios().post(`/movies/${imdbId}/subtitles/refresh`),
|
||||||
@ -18,7 +18,7 @@ export const searchEpisodeSubtitles = (imdbId, season, episode) => {
|
|||||||
{
|
{
|
||||||
imdbId: imdbId,
|
imdbId: imdbId,
|
||||||
season: season,
|
season: season,
|
||||||
episode: episode,
|
episode: episode
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -6,7 +6,7 @@ export function addTorrent(url) {
|
|||||||
return request(
|
return request(
|
||||||
"ADD_TORRENT",
|
"ADD_TORRENT",
|
||||||
configureAxios().post("/torrents", {
|
configureAxios().post("/torrents", {
|
||||||
url: url,
|
url: url
|
||||||
}),
|
}),
|
||||||
[addAlertOk("Torrent added")]
|
[addAlertOk("Torrent added")]
|
||||||
);
|
);
|
||||||
@ -14,7 +14,7 @@ export function addTorrent(url) {
|
|||||||
|
|
||||||
export function removeTorrent(id) {
|
export function removeTorrent(id) {
|
||||||
return request("REMOVE_TORRENT", configureAxios().delete(`/torrents/${id}`), [
|
return request("REMOVE_TORRENT", configureAxios().delete(`/torrents/${id}`), [
|
||||||
() => fetchTorrents(),
|
() => fetchTorrents()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,8 +31,8 @@ export function setFetchedTorrents(torrents) {
|
|||||||
type: "TORRENTS_FETCH_FULFILLED",
|
type: "TORRENTS_FETCH_FULFILLED",
|
||||||
payload: {
|
payload: {
|
||||||
response: {
|
response: {
|
||||||
data: torrents,
|
data: torrents
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import { getManagedPolochons } from "./polochon";
|
|||||||
|
|
||||||
export function userLogout() {
|
export function userLogout() {
|
||||||
return {
|
return {
|
||||||
type: "USER_LOGOUT",
|
type: "USER_LOGOUT"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ export function loginUser(username, password) {
|
|||||||
"USER_LOGIN",
|
"USER_LOGIN",
|
||||||
configureAxios().post("/users/login", {
|
configureAxios().post("/users/login", {
|
||||||
username: username.trim(),
|
username: username.trim(),
|
||||||
password: password,
|
password: password
|
||||||
}),
|
}),
|
||||||
[() => dismissAlert()]
|
[() => dismissAlert()]
|
||||||
);
|
);
|
||||||
@ -24,7 +24,7 @@ export function loginUser(username, password) {
|
|||||||
export function updateUser(config) {
|
export function updateUser(config) {
|
||||||
return request("USER_UPDATE", configureAxios().post("/users/edit", config), [
|
return request("USER_UPDATE", configureAxios().post("/users/edit", config), [
|
||||||
addAlertOk("User updated"),
|
addAlertOk("User updated"),
|
||||||
() => getManagedPolochons(),
|
() => getManagedPolochons()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,8 +48,8 @@ export function setUserToken(token) {
|
|||||||
return {
|
return {
|
||||||
type: "USER_SET_TOKEN",
|
type: "USER_SET_TOKEN",
|
||||||
payload: {
|
payload: {
|
||||||
token: token,
|
token: token
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ const protectedRoute = ({
|
|||||||
return (
|
return (
|
||||||
<Route
|
<Route
|
||||||
{...otherProps}
|
{...otherProps}
|
||||||
render={(props) => {
|
render={props => {
|
||||||
if (isAuthenticated()) {
|
if (isAuthenticated()) {
|
||||||
if (isActivated) {
|
if (isActivated) {
|
||||||
return <Component {...props} />;
|
return <Component {...props} />;
|
||||||
@ -50,14 +50,14 @@ protectedRoute.propTypes = {
|
|||||||
isLogged: PropTypes.bool.isRequired,
|
isLogged: PropTypes.bool.isRequired,
|
||||||
isActivated: PropTypes.bool.isRequired,
|
isActivated: PropTypes.bool.isRequired,
|
||||||
isTokenSet: PropTypes.bool.isRequired,
|
isTokenSet: PropTypes.bool.isRequired,
|
||||||
setUserToken: PropTypes.func.isRequired,
|
setUserToken: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
export const ProtectedRoute = connect(
|
export const ProtectedRoute = connect(
|
||||||
(state) => ({
|
state => ({
|
||||||
isLogged: state.userStore.get("isLogged"),
|
isLogged: state.userStore.get("isLogged"),
|
||||||
isAdmin: state.userStore.get("isLogged"),
|
isAdmin: state.userStore.get("isLogged"),
|
||||||
isActivated: state.userStore.get("isActivated"),
|
isActivated: state.userStore.get("isActivated"),
|
||||||
isTokenSet: state.userStore.get("isTokenSet"),
|
isTokenSet: state.userStore.get("isTokenSet")
|
||||||
}),
|
}),
|
||||||
{ setUserToken }
|
{ setUserToken }
|
||||||
)(protectedRoute);
|
)(protectedRoute);
|
||||||
@ -66,7 +66,7 @@ const adminRoute = ({ component: Component, isAdmin, ...otherProps }) => {
|
|||||||
return (
|
return (
|
||||||
<Route
|
<Route
|
||||||
{...otherProps}
|
{...otherProps}
|
||||||
render={(props) => {
|
render={props => {
|
||||||
if (isAdmin) {
|
if (isAdmin) {
|
||||||
return <Component {...props} />;
|
return <Component {...props} />;
|
||||||
} else {
|
} else {
|
||||||
@ -78,8 +78,8 @@ const adminRoute = ({ component: Component, isAdmin, ...otherProps }) => {
|
|||||||
};
|
};
|
||||||
adminRoute.propTypes = {
|
adminRoute.propTypes = {
|
||||||
component: PropTypes.func,
|
component: PropTypes.func,
|
||||||
isAdmin: PropTypes.bool.isRequired,
|
isAdmin: PropTypes.bool.isRequired
|
||||||
};
|
};
|
||||||
export const AdminRoute = connect((state) => ({
|
export const AdminRoute = connect(state => ({
|
||||||
isAdmin: state.userStore.get("isLogged"),
|
isAdmin: state.userStore.get("isLogged")
|
||||||
}))(adminRoute);
|
}))(adminRoute);
|
||||||
|
@ -15,12 +15,12 @@ const AdminModulesConnected = ({ modules, loading, getAdminModules }) => {
|
|||||||
AdminModulesConnected.propTypes = {
|
AdminModulesConnected.propTypes = {
|
||||||
modules: PropTypes.object,
|
modules: PropTypes.object,
|
||||||
loading: PropTypes.bool,
|
loading: PropTypes.bool,
|
||||||
getAdminModules: PropTypes.func.isRequired,
|
getAdminModules: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = state => ({
|
||||||
loading: state.adminStore.get("fetchingModules"),
|
loading: state.adminStore.get("fetchingModules"),
|
||||||
modules: state.adminStore.get("modules"),
|
modules: state.adminStore.get("modules")
|
||||||
});
|
});
|
||||||
|
|
||||||
export const AdminModules = connect(mapStateToProps, { getAdminModules })(
|
export const AdminModules = connect(mapStateToProps, { getAdminModules })(
|
||||||
|
@ -28,5 +28,5 @@ Stat.propTypes = {
|
|||||||
name: PropTypes.string,
|
name: PropTypes.string,
|
||||||
count: PropTypes.number,
|
count: PropTypes.number,
|
||||||
torrentCount: PropTypes.number,
|
torrentCount: PropTypes.number,
|
||||||
torrentCountById: PropTypes.number,
|
torrentCountById: PropTypes.number
|
||||||
};
|
};
|
||||||
|
@ -36,11 +36,11 @@ const StatsConnected = ({ stats, getStats }) => {
|
|||||||
};
|
};
|
||||||
StatsConnected.propTypes = {
|
StatsConnected.propTypes = {
|
||||||
stats: PropTypes.object,
|
stats: PropTypes.object,
|
||||||
getStats: PropTypes.func,
|
getStats: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = state => ({
|
||||||
stats: state.adminStore.get("stats"),
|
stats: state.adminStore.get("stats")
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Stats = connect(mapStateToProps, { getStats })(StatsConnected);
|
export const Stats = connect(mapStateToProps, { getStats })(StatsConnected);
|
||||||
|
@ -17,5 +17,5 @@ export const TorrentsStat = ({ count, torrentCount, torrentCountById }) => {
|
|||||||
TorrentsStat.propTypes = {
|
TorrentsStat.propTypes = {
|
||||||
count: PropTypes.number,
|
count: PropTypes.number,
|
||||||
torrentCount: PropTypes.number,
|
torrentCount: PropTypes.number,
|
||||||
torrentCountById: PropTypes.number,
|
torrentCountById: PropTypes.number
|
||||||
};
|
};
|
||||||
|
@ -12,7 +12,7 @@ export const User = ({
|
|||||||
polochonUrl,
|
polochonUrl,
|
||||||
polochonName,
|
polochonName,
|
||||||
polochonId,
|
polochonId,
|
||||||
token,
|
token
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<tr>
|
<tr>
|
||||||
@ -61,5 +61,5 @@ User.propTypes = {
|
|||||||
token: PropTypes.string,
|
token: PropTypes.string,
|
||||||
admin: PropTypes.bool,
|
admin: PropTypes.bool,
|
||||||
activated: PropTypes.bool,
|
activated: PropTypes.bool,
|
||||||
polochonActivated: PropTypes.bool,
|
polochonActivated: PropTypes.bool
|
||||||
};
|
};
|
||||||
|
@ -21,7 +21,7 @@ const UserEditConnect = ({
|
|||||||
polochonActivated: initPolochonActivated,
|
polochonActivated: initPolochonActivated,
|
||||||
updateUser,
|
updateUser,
|
||||||
deleteUser,
|
deleteUser,
|
||||||
publicPolochons,
|
publicPolochons
|
||||||
}) => {
|
}) => {
|
||||||
const [modal, setModal] = useState(false);
|
const [modal, setModal] = useState(false);
|
||||||
const [admin, setAdmin] = useState(initAdmin);
|
const [admin, setAdmin] = useState(initAdmin);
|
||||||
@ -34,7 +34,7 @@ const UserEditConnect = ({
|
|||||||
const [password, setPassword] = useState("");
|
const [password, setPassword] = useState("");
|
||||||
const [confirmDelete, setConfirmDelete] = useState(false);
|
const [confirmDelete, setConfirmDelete] = useState(false);
|
||||||
|
|
||||||
const handleSubmit = (e) => {
|
const handleSubmit = e => {
|
||||||
if (e) {
|
if (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
@ -45,12 +45,12 @@ const UserEditConnect = ({
|
|||||||
activated,
|
activated,
|
||||||
polochonId,
|
polochonId,
|
||||||
polochonActivated,
|
polochonActivated,
|
||||||
password,
|
password
|
||||||
});
|
});
|
||||||
setModal(false);
|
setModal(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDeleteUser = (e) => {
|
const handleDeleteUser = e => {
|
||||||
if (e) {
|
if (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
@ -147,11 +147,11 @@ UserEditConnect.propTypes = {
|
|||||||
polochonToken: PropTypes.string,
|
polochonToken: PropTypes.string,
|
||||||
polochonId: PropTypes.string,
|
polochonId: PropTypes.string,
|
||||||
polochonActivated: PropTypes.bool,
|
polochonActivated: PropTypes.bool,
|
||||||
publicPolochons: PropTypes.instanceOf(List),
|
publicPolochons: PropTypes.instanceOf(List)
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = state => ({
|
||||||
publicPolochons: state.polochon.get("public"),
|
publicPolochons: state.polochon.get("public")
|
||||||
});
|
});
|
||||||
|
|
||||||
export const UserEdit = connect(mapStateToProps, { updateUser, deleteUser })(
|
export const UserEdit = connect(mapStateToProps, { updateUser, deleteUser })(
|
||||||
|
@ -8,8 +8,8 @@ import { User } from "./user";
|
|||||||
import { getUsers } from "../../actions/admins";
|
import { getUsers } from "../../actions/admins";
|
||||||
import { getPolochons } from "../../actions/polochon";
|
import { getPolochons } from "../../actions/polochon";
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = state => ({
|
||||||
users: state.adminStore.get("users"),
|
users: state.adminStore.get("users")
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = { getUsers, getPolochons };
|
const mapDispatchToProps = { getUsers, getPolochons };
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ const UserListConnect = ({ users, getUsers, getPolochons }) => {
|
|||||||
UserListConnect.propTypes = {
|
UserListConnect.propTypes = {
|
||||||
getUsers: PropTypes.func,
|
getUsers: PropTypes.func,
|
||||||
getPolochons: PropTypes.func,
|
getPolochons: PropTypes.func,
|
||||||
users: PropTypes.PropTypes.instanceOf(List),
|
users: PropTypes.PropTypes.instanceOf(List)
|
||||||
};
|
};
|
||||||
|
|
||||||
export const UserList = connect(
|
export const UserList = connect(
|
||||||
|
@ -5,7 +5,7 @@ import { List } from "immutable";
|
|||||||
import { Button, Modal } from "react-bootstrap";
|
import { Button, Modal } from "react-bootstrap";
|
||||||
import Toggle from "react-bootstrap-toggle";
|
import Toggle from "react-bootstrap-toggle";
|
||||||
|
|
||||||
export const UserList = (props) => (
|
export const UserList = props => (
|
||||||
<div className="table-responsive my-2">
|
<div className="table-responsive my-2">
|
||||||
<table className="table table-striped">
|
<table className="table table-striped">
|
||||||
<thead className="table-secondary">
|
<thead className="table-secondary">
|
||||||
@ -29,7 +29,7 @@ export const UserList = (props) => (
|
|||||||
);
|
);
|
||||||
UserList.propTypes = {
|
UserList.propTypes = {
|
||||||
users: PropTypes.PropTypes.instanceOf(List),
|
users: PropTypes.PropTypes.instanceOf(List),
|
||||||
updateUser: PropTypes.func,
|
updateUser: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
const User = function(props) {
|
const User = function(props) {
|
||||||
@ -61,15 +61,15 @@ const User = function (props) {
|
|||||||
};
|
};
|
||||||
User.propTypes = {
|
User.propTypes = {
|
||||||
data: PropTypes.object,
|
data: PropTypes.object,
|
||||||
updateUser: PropTypes.func,
|
updateUser: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
const UserAdminStatus = (props) => (
|
const UserAdminStatus = props => (
|
||||||
<span className={props.admin ? "fa fa-check" : "fa fa-times"}></span>
|
<span className={props.admin ? "fa fa-check" : "fa fa-times"}></span>
|
||||||
);
|
);
|
||||||
UserAdminStatus.propTypes = { admin: PropTypes.bool.isRequired };
|
UserAdminStatus.propTypes = { admin: PropTypes.bool.isRequired };
|
||||||
|
|
||||||
const UserActivationStatus = (props) => (
|
const UserActivationStatus = props => (
|
||||||
<span
|
<span
|
||||||
className={props.activated ? "fa fa-check" : "fa fa-times text-danger"}
|
className={props.activated ? "fa fa-check" : "fa fa-times text-danger"}
|
||||||
></span>
|
></span>
|
||||||
@ -92,7 +92,7 @@ function UserEdit(props) {
|
|||||||
admin: admin,
|
admin: admin,
|
||||||
activated: activated,
|
activated: activated,
|
||||||
polochonUrl: url,
|
polochonUrl: url,
|
||||||
polochonToken: token,
|
polochonToken: token
|
||||||
});
|
});
|
||||||
setModal(false);
|
setModal(false);
|
||||||
};
|
};
|
||||||
@ -111,7 +111,7 @@ function UserEdit(props) {
|
|||||||
</Modal.Title>
|
</Modal.Title>
|
||||||
</Modal.Header>
|
</Modal.Header>
|
||||||
<Modal.Body bsPrefix="modal-body admin-edit-user-modal">
|
<Modal.Body bsPrefix="modal-body admin-edit-user-modal">
|
||||||
<form className="form-horizontal" onSubmit={(ev) => handleSubmit(ev)}>
|
<form className="form-horizontal" onSubmit={ev => handleSubmit(ev)}>
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label>Account status</label>
|
<label>Account status</label>
|
||||||
<Toggle
|
<Toggle
|
||||||
@ -141,7 +141,7 @@ function UserEdit(props) {
|
|||||||
<input
|
<input
|
||||||
className="form-control"
|
className="form-control"
|
||||||
value={url}
|
value={url}
|
||||||
onChange={(e) => setUrl(e.target.value)}
|
onChange={e => setUrl(e.target.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
@ -149,7 +149,7 @@ function UserEdit(props) {
|
|||||||
<input
|
<input
|
||||||
className="form-control"
|
className="form-control"
|
||||||
value={token}
|
value={token}
|
||||||
onChange={(e) => setToken(e.target.value)}
|
onChange={e => setToken(e.target.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@ -168,5 +168,5 @@ UserEdit.propTypes = {
|
|||||||
data: PropTypes.object,
|
data: PropTypes.object,
|
||||||
updateUser: PropTypes.func,
|
updateUser: PropTypes.func,
|
||||||
polochonUrl: PropTypes.string,
|
polochonUrl: PropTypes.string,
|
||||||
polochonToken: PropTypes.string,
|
polochonToken: PropTypes.string
|
||||||
};
|
};
|
||||||
|
@ -5,14 +5,14 @@ import { connect } from "react-redux";
|
|||||||
|
|
||||||
import { dismissAlert } from "../../actions/alerts";
|
import { dismissAlert } from "../../actions/alerts";
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = state => ({
|
||||||
show: state.alerts.get("show"),
|
show: state.alerts.get("show"),
|
||||||
title: state.alerts.get("message"),
|
title: state.alerts.get("message"),
|
||||||
type: state.alerts.get("type"),
|
type: state.alerts.get("type")
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = { dismissAlert };
|
const mapDispatchToProps = { dismissAlert };
|
||||||
|
|
||||||
const Alert = (props) => {
|
const Alert = props => {
|
||||||
if (!props.show) {
|
if (!props.show) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -29,7 +29,7 @@ Alert.propTypes = {
|
|||||||
show: PropTypes.bool.isRequired,
|
show: PropTypes.bool.isRequired,
|
||||||
title: PropTypes.string.isRequired,
|
title: PropTypes.string.isRequired,
|
||||||
dismissAlert: PropTypes.func.isRequired,
|
dismissAlert: PropTypes.func.isRequired,
|
||||||
type: PropTypes.string,
|
type: PropTypes.string
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(Alert);
|
export default connect(mapStateToProps, mapDispatchToProps)(Alert);
|
||||||
|
@ -19,7 +19,7 @@ export const DownloadAndStream = ({ url, name, subtitles }) => {
|
|||||||
DownloadAndStream.propTypes = {
|
DownloadAndStream.propTypes = {
|
||||||
url: PropTypes.string,
|
url: PropTypes.string,
|
||||||
name: PropTypes.string,
|
name: PropTypes.string,
|
||||||
subtitles: PropTypes.instanceOf(List),
|
subtitles: PropTypes.instanceOf(List)
|
||||||
};
|
};
|
||||||
|
|
||||||
const DownloadButton = ({ url }) => (
|
const DownloadButton = ({ url }) => (
|
||||||
@ -41,7 +41,7 @@ const StreamButton = ({ name, url, subtitles }) => {
|
|||||||
<a
|
<a
|
||||||
href="#"
|
href="#"
|
||||||
className="btn btn-sm btn-primary m-1 clickable"
|
className="btn btn-sm btn-primary m-1 clickable"
|
||||||
onClick={(e) => {
|
onClick={e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setShowModal(true);
|
setShowModal(true);
|
||||||
}}
|
}}
|
||||||
@ -68,7 +68,7 @@ const StreamButton = ({ name, url, subtitles }) => {
|
|||||||
StreamButton.propTypes = {
|
StreamButton.propTypes = {
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
url: PropTypes.string.isRequired,
|
url: PropTypes.string.isRequired,
|
||||||
subtitles: PropTypes.instanceOf(List),
|
subtitles: PropTypes.instanceOf(List)
|
||||||
};
|
};
|
||||||
|
|
||||||
const Player = ({ url, subtitles }) => {
|
const Player = ({ url, subtitles }) => {
|
||||||
@ -95,8 +95,8 @@ const Player = ({ url, subtitles }) => {
|
|||||||
};
|
};
|
||||||
Player.propTypes = {
|
Player.propTypes = {
|
||||||
subtitles: PropTypes.instanceOf(List),
|
subtitles: PropTypes.instanceOf(List),
|
||||||
url: PropTypes.string.isRequired,
|
url: PropTypes.string.isRequired
|
||||||
};
|
};
|
||||||
Player.defaultProps = {
|
Player.defaultProps = {
|
||||||
subtitles: List(),
|
subtitles: List()
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,7 @@ export const ImdbBadge = ({ imdbId }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span className="d-inline">
|
<h5 className="d-inline">
|
||||||
<a
|
<a
|
||||||
className="btn btn-sm btn-warning m-1"
|
className="btn btn-sm btn-warning m-1"
|
||||||
href={`https://www.imdb.com/title/${imdbId}`}
|
href={`https://www.imdb.com/title/${imdbId}`}
|
||||||
@ -15,7 +15,7 @@ export const ImdbBadge = ({ imdbId }) => {
|
|||||||
IMDb
|
IMDb
|
||||||
<i className="ml-1 fa fa-external-link"></i>
|
<i className="ml-1 fa fa-external-link"></i>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</h5>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
ImdbBadge.propTypes = { imdbId: PropTypes.string };
|
ImdbBadge.propTypes = { imdbId: PropTypes.string };
|
||||||
|
@ -27,9 +27,9 @@ export const ShowMore = ({ children, id, inLibrary }) => {
|
|||||||
ShowMore.propTypes = {
|
ShowMore.propTypes = {
|
||||||
id: PropTypes.string,
|
id: PropTypes.string,
|
||||||
inLibrary: PropTypes.bool.isRequired,
|
inLibrary: PropTypes.bool.isRequired,
|
||||||
children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
children: PropTypes.oneOfType([PropTypes.object, PropTypes.array])
|
||||||
};
|
};
|
||||||
ShowMore.defaultProps = {
|
ShowMore.defaultProps = {
|
||||||
id: "",
|
id: "",
|
||||||
inLibrary: false,
|
inLibrary: false
|
||||||
};
|
};
|
||||||
|
@ -8,7 +8,7 @@ export const SubtitlesButton = ({
|
|||||||
subtitles,
|
subtitles,
|
||||||
inLibrary,
|
inLibrary,
|
||||||
searching,
|
searching,
|
||||||
search,
|
search
|
||||||
}) => {
|
}) => {
|
||||||
if (inLibrary === false) {
|
if (inLibrary === false) {
|
||||||
return null;
|
return null;
|
||||||
@ -17,7 +17,7 @@ export const SubtitlesButton = ({
|
|||||||
const [show, setShow] = useState(false);
|
const [show, setShow] = useState(false);
|
||||||
/* eslint-enable */
|
/* eslint-enable */
|
||||||
|
|
||||||
const onSelect = (eventKey) => {
|
const onSelect = eventKey => {
|
||||||
if (eventKey === null || eventKey != 1) {
|
if (eventKey === null || eventKey != 1) {
|
||||||
setShow(false);
|
setShow(false);
|
||||||
}
|
}
|
||||||
@ -68,5 +68,5 @@ SubtitlesButton.propTypes = {
|
|||||||
subtitles: PropTypes.instanceOf(List),
|
subtitles: PropTypes.instanceOf(List),
|
||||||
inLibrary: PropTypes.bool.isRequired,
|
inLibrary: PropTypes.bool.isRequired,
|
||||||
searching: PropTypes.bool.isRequired,
|
searching: PropTypes.bool.isRequired,
|
||||||
search: PropTypes.func.isRequired,
|
search: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
@ -13,7 +13,7 @@ function buildMenuItems(torrents) {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
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 = [];
|
||||||
@ -22,7 +22,7 @@ function buildMenuItems(torrents) {
|
|||||||
// Push the title
|
// Push the title
|
||||||
entries.push({
|
entries.push({
|
||||||
type: "header",
|
type: "header",
|
||||||
value: source,
|
value: source
|
||||||
});
|
});
|
||||||
|
|
||||||
// Push the torrents
|
// Push the torrents
|
||||||
@ -31,7 +31,7 @@ function buildMenuItems(torrents) {
|
|||||||
type: "entry",
|
type: "entry",
|
||||||
quality: torrent.get("quality"),
|
quality: torrent.get("quality"),
|
||||||
url: torrent.get("url"),
|
url: torrent.get("url"),
|
||||||
size: torrent.get("size"),
|
size: torrent.get("size")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ const torrentsButton = ({ torrents, search, searching, addTorrent, url }) => {
|
|||||||
const entries = buildMenuItems(torrents);
|
const entries = buildMenuItems(torrents);
|
||||||
const count = torrents && torrents.size !== 0 ? torrents.size : 0;
|
const count = torrents && torrents.size !== 0 ? torrents.size : 0;
|
||||||
|
|
||||||
const onSelect = (eventKey) => {
|
const onSelect = eventKey => {
|
||||||
// Close the dropdown if the eventkey is not specified
|
// Close the dropdown if the eventkey is not specified
|
||||||
if (eventKey === null) {
|
if (eventKey === null) {
|
||||||
setShow(false);
|
setShow(false);
|
||||||
@ -116,10 +116,10 @@ torrentsButton.propTypes = {
|
|||||||
searching: PropTypes.bool,
|
searching: PropTypes.bool,
|
||||||
search: PropTypes.func.isRequired,
|
search: PropTypes.func.isRequired,
|
||||||
addTorrent: PropTypes.func.isRequired,
|
addTorrent: PropTypes.func.isRequired,
|
||||||
url: PropTypes.string,
|
url: PropTypes.string
|
||||||
};
|
};
|
||||||
torrentsButton.defaultProps = {
|
torrentsButton.defaultProps = {
|
||||||
torrents: List(),
|
torrents: List()
|
||||||
};
|
};
|
||||||
|
|
||||||
export const TorrentsButton = connect(null, { addTorrent })(torrentsButton);
|
export const TorrentsButton = connect(null, { addTorrent })(torrentsButton);
|
||||||
|
@ -13,5 +13,5 @@ export const WishlistButton = ({ wishlisted, wishlist }) => {
|
|||||||
};
|
};
|
||||||
WishlistButton.propTypes = {
|
WishlistButton.propTypes = {
|
||||||
wishlisted: PropTypes.bool.isRequired,
|
wishlisted: PropTypes.bool.isRequired,
|
||||||
wishlist: PropTypes.func.isRequired,
|
wishlist: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
@ -10,7 +10,7 @@ export const Genres = ({ genres }) => {
|
|||||||
// Uppercase first genres
|
// Uppercase first genres
|
||||||
const prettyGenres = genres
|
const prettyGenres = genres
|
||||||
.toJS()
|
.toJS()
|
||||||
.map((word) => word[0].toUpperCase() + word.substr(1))
|
.map(word => word[0].toUpperCase() + word.substr(1))
|
||||||
.join(", ");
|
.join(", ");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -6,14 +6,14 @@ export const PolochonMetadata = ({
|
|||||||
container,
|
container,
|
||||||
videoCodec,
|
videoCodec,
|
||||||
audioCodec,
|
audioCodec,
|
||||||
releaseGroup,
|
releaseGroup
|
||||||
}) => {
|
}) => {
|
||||||
if (!quality || quality === "") {
|
if (!quality || quality === "") {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const metadata = [quality, container, videoCodec, audioCodec, releaseGroup]
|
const metadata = [quality, container, videoCodec, audioCodec, releaseGroup]
|
||||||
.filter((m) => m && m !== "")
|
.filter(m => m && m !== "")
|
||||||
.join(", ");
|
.join(", ");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -28,5 +28,5 @@ PolochonMetadata.propTypes = {
|
|||||||
container: PropTypes.string,
|
container: PropTypes.string,
|
||||||
videoCodec: PropTypes.string,
|
videoCodec: PropTypes.string,
|
||||||
audioCodec: PropTypes.string,
|
audioCodec: PropTypes.string,
|
||||||
releaseGroup: PropTypes.string,
|
releaseGroup: PropTypes.string
|
||||||
};
|
};
|
||||||
|
@ -16,9 +16,9 @@ export const Rating = ({ rating, votes }) => {
|
|||||||
};
|
};
|
||||||
Rating.propTypes = {
|
Rating.propTypes = {
|
||||||
rating: PropTypes.number,
|
rating: PropTypes.number,
|
||||||
votes: PropTypes.number,
|
votes: PropTypes.number
|
||||||
};
|
};
|
||||||
Rating.defaultProps = {
|
Rating.defaultProps = {
|
||||||
rating: 0,
|
rating: 0,
|
||||||
votes: 0,
|
votes: 0
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,7 @@ import React from "react";
|
|||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
|
|
||||||
const prettyDate = (input) => {
|
const prettyDate = input => {
|
||||||
switch (typeof input) {
|
switch (typeof input) {
|
||||||
case "string":
|
case "string":
|
||||||
if (input === "") {
|
if (input === "") {
|
||||||
@ -46,6 +46,6 @@ export const ReleaseDate = ({ date }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
ReleaseDate.propTypes = {
|
ReleaseDate.propTypes = {
|
||||||
date: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
date: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
||||||
};
|
};
|
||||||
ReleaseDate.defaultProps = { date: "" };
|
ReleaseDate.defaultProps = { date: "" };
|
||||||
|
@ -18,8 +18,8 @@ export const Title = ({ title, wishlist, wishlisted }) => {
|
|||||||
Title.propTypes = {
|
Title.propTypes = {
|
||||||
title: PropTypes.string,
|
title: PropTypes.string,
|
||||||
wishlist: PropTypes.func,
|
wishlist: PropTypes.func,
|
||||||
wishlisted: PropTypes.bool,
|
wishlisted: PropTypes.bool
|
||||||
};
|
};
|
||||||
Title.defaultProps = {
|
Title.defaultProps = {
|
||||||
title: "",
|
title: ""
|
||||||
};
|
};
|
||||||
|
@ -5,7 +5,7 @@ export const TrackingLabel = ({
|
|||||||
wishlisted,
|
wishlisted,
|
||||||
inLibrary,
|
inLibrary,
|
||||||
trackedSeason,
|
trackedSeason,
|
||||||
trackedEpisode,
|
trackedEpisode
|
||||||
}) => {
|
}) => {
|
||||||
if (wishlisted === false) {
|
if (wishlisted === false) {
|
||||||
return null;
|
return null;
|
||||||
@ -42,5 +42,5 @@ TrackingLabel.propTypes = {
|
|||||||
wishlisted: PropTypes.bool,
|
wishlisted: PropTypes.bool,
|
||||||
inLibrary: PropTypes.bool,
|
inLibrary: PropTypes.bool,
|
||||||
trackedSeason: PropTypes.number,
|
trackedSeason: PropTypes.number,
|
||||||
trackedEpisode: PropTypes.number,
|
trackedEpisode: PropTypes.number
|
||||||
};
|
};
|
||||||
|
@ -8,7 +8,7 @@ export const FormInput = ({ label, value, updateValue }) => {
|
|||||||
<input
|
<input
|
||||||
className="form-control"
|
className="form-control"
|
||||||
value={value}
|
value={value}
|
||||||
onChange={(e) => updateValue(e.target.value)}
|
onChange={e => updateValue(e.target.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@ -16,5 +16,5 @@ export const FormInput = ({ label, value, updateValue }) => {
|
|||||||
FormInput.propTypes = {
|
FormInput.propTypes = {
|
||||||
label: PropTypes.string,
|
label: PropTypes.string,
|
||||||
value: PropTypes.string,
|
value: PropTypes.string,
|
||||||
updateValue: PropTypes.func,
|
updateValue: PropTypes.func
|
||||||
};
|
};
|
||||||
|
@ -9,7 +9,7 @@ export const FormModal = ({
|
|||||||
title,
|
title,
|
||||||
icon,
|
icon,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
children,
|
children
|
||||||
}) => {
|
}) => {
|
||||||
const submit = function(e) {
|
const submit = function(e) {
|
||||||
if (e) {
|
if (e) {
|
||||||
@ -27,7 +27,7 @@ export const FormModal = ({
|
|||||||
</Modal.Title>
|
</Modal.Title>
|
||||||
</Modal.Header>
|
</Modal.Header>
|
||||||
<Modal.Body bsPrefix="modal-body">
|
<Modal.Body bsPrefix="modal-body">
|
||||||
<form className="form-horizontal" onSubmit={(ev) => submit(ev)}>
|
<form className="form-horizontal" onSubmit={ev => submit(ev)}>
|
||||||
{children}
|
{children}
|
||||||
</form>
|
</form>
|
||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
@ -48,5 +48,5 @@ FormModal.propTypes = {
|
|||||||
icon: PropTypes.string,
|
icon: PropTypes.string,
|
||||||
title: PropTypes.string,
|
title: PropTypes.string,
|
||||||
handleSubmit: PropTypes.func,
|
handleSubmit: PropTypes.func,
|
||||||
children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
children: PropTypes.oneOfType([PropTypes.object, PropTypes.array])
|
||||||
};
|
};
|
||||||
|
@ -16,7 +16,7 @@ import { ReleaseDate } from "../details/releaseDate";
|
|||||||
import { Runtime } from "../details/runtime";
|
import { Runtime } from "../details/runtime";
|
||||||
import { Title } from "../details/title";
|
import { Title } from "../details/title";
|
||||||
|
|
||||||
const ListDetails = (props) => {
|
const ListDetails = props => {
|
||||||
if (props.data === undefined) {
|
if (props.data === undefined) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -68,6 +68,6 @@ ListDetails.propTypes = {
|
|||||||
data: PropTypes.instanceOf(Map),
|
data: PropTypes.instanceOf(Map),
|
||||||
wishlist: PropTypes.func,
|
wishlist: PropTypes.func,
|
||||||
loading: PropTypes.bool,
|
loading: PropTypes.bool,
|
||||||
children: PropTypes.object,
|
children: PropTypes.object
|
||||||
};
|
};
|
||||||
export default ListDetails;
|
export default ListDetails;
|
||||||
|
@ -19,23 +19,23 @@ const ExplorerOptions = ({ display, params, options, type, history }) => {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSourceChange = (event) => {
|
const handleSourceChange = event => {
|
||||||
let source = event.target.value;
|
let source = event.target.value;
|
||||||
let category = options.get(event.target.value).first();
|
let category = options.get(event.target.value).first();
|
||||||
history.push(`/${type}/explore/${source}/${category}`);
|
history.push(`/${type}/explore/${source}/${category}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCategoryChange = (event) => {
|
const handleCategoryChange = event => {
|
||||||
let source = params.source;
|
let source = params.source;
|
||||||
let category = event.target.value;
|
let category = event.target.value;
|
||||||
history.push(`/${type}/explore/${source}/${category}`);
|
history.push(`/${type}/explore/${source}/${category}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
const prettyName = (name) => {
|
const prettyName = name => {
|
||||||
return name
|
return name
|
||||||
.replace("_", " ")
|
.replace("_", " ")
|
||||||
.split(" ")
|
.split(" ")
|
||||||
.map((w) => w[0].toUpperCase() + w.substr(1))
|
.map(w => w[0].toUpperCase() + w.substr(1))
|
||||||
.join(" ");
|
.join(" ");
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ ExplorerOptions.propTypes = {
|
|||||||
history: PropTypes.object,
|
history: PropTypes.object,
|
||||||
type: PropTypes.string,
|
type: PropTypes.string,
|
||||||
options: PropTypes.object,
|
options: PropTypes.object,
|
||||||
display: PropTypes.bool,
|
display: PropTypes.bool
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withRouter(ExplorerOptions);
|
export default withRouter(ExplorerOptions);
|
||||||
|
@ -17,7 +17,7 @@ const ListFilter = ({ placeHolder, updateFilter }) => {
|
|||||||
type="text"
|
type="text"
|
||||||
className="form-control"
|
className="form-control"
|
||||||
placeholder={placeHolder}
|
placeholder={placeHolder}
|
||||||
onChange={(e) => setFilter(e.target.value)}
|
onChange={e => setFilter(e.target.value)}
|
||||||
value={filter}
|
value={filter}
|
||||||
/>
|
/>
|
||||||
<div className="input-group-append d-none d-md-block">
|
<div className="input-group-append d-none d-md-block">
|
||||||
@ -28,6 +28,6 @@ const ListFilter = ({ placeHolder, updateFilter }) => {
|
|||||||
};
|
};
|
||||||
ListFilter.propTypes = {
|
ListFilter.propTypes = {
|
||||||
updateFilter: PropTypes.func.isRequired,
|
updateFilter: PropTypes.func.isRequired,
|
||||||
placeHolder: PropTypes.string.isRequired,
|
placeHolder: PropTypes.string.isRequired
|
||||||
};
|
};
|
||||||
export default ListFilter;
|
export default ListFilter;
|
||||||
|
@ -22,7 +22,7 @@ Poster.propTypes = {
|
|||||||
url: PropTypes.string,
|
url: PropTypes.string,
|
||||||
selected: PropTypes.bool.isRequired,
|
selected: PropTypes.bool.isRequired,
|
||||||
onClick: PropTypes.func,
|
onClick: PropTypes.func,
|
||||||
onDoubleClick: PropTypes.func,
|
onDoubleClick: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Poster;
|
export default Poster;
|
||||||
|
@ -10,7 +10,7 @@ import Poster from "./poster";
|
|||||||
|
|
||||||
import Loader from "../loader/loader";
|
import Loader from "../loader/loader";
|
||||||
|
|
||||||
const ListPosters = (props) => {
|
const ListPosters = props => {
|
||||||
if (props.loading) {
|
if (props.loading) {
|
||||||
return <Loader />;
|
return <Loader />;
|
||||||
}
|
}
|
||||||
@ -20,7 +20,7 @@ const ListPosters = (props) => {
|
|||||||
|
|
||||||
// Filter the list of elements
|
// Filter the list of elements
|
||||||
if (props.filter !== "") {
|
if (props.filter !== "") {
|
||||||
elmts = elmts.filter((v) => fuzzy.test(props.filter, v.get("title")));
|
elmts = elmts.filter(v => fuzzy.test(props.filter, v.get("title")));
|
||||||
} else {
|
} else {
|
||||||
elmts = elmts.slice(0, listSize.items);
|
elmts = elmts.slice(0, listSize.items);
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ ListPosters.propTypes = {
|
|||||||
type: PropTypes.string.isRequired,
|
type: PropTypes.string.isRequired,
|
||||||
placeHolder: PropTypes.string.isRequired,
|
placeHolder: PropTypes.string.isRequired,
|
||||||
updateFilter: PropTypes.func.isRequired,
|
updateFilter: PropTypes.func.isRequired,
|
||||||
filter: PropTypes.string,
|
filter: PropTypes.string
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ListPosters;
|
export default ListPosters;
|
||||||
@ -90,7 +90,7 @@ const Posters = ({
|
|||||||
onKeyEnter,
|
onKeyEnter,
|
||||||
selectedImdbId,
|
selectedImdbId,
|
||||||
selectPoster,
|
selectPoster,
|
||||||
onDoubleClick,
|
onDoubleClick
|
||||||
}) => {
|
}) => {
|
||||||
const addMoreCount = 20;
|
const addMoreCount = 20;
|
||||||
const [size, setSize] = useState(0);
|
const [size, setSize] = useState(0);
|
||||||
@ -113,7 +113,7 @@ const Posters = ({
|
|||||||
}, [elmts.size, loadMore]);
|
}, [elmts.size, loadMore]);
|
||||||
|
|
||||||
const move = useCallback(
|
const move = useCallback(
|
||||||
(event) => {
|
event => {
|
||||||
// Only run the function if nothing else if actively focused
|
// Only run the function if nothing else if actively focused
|
||||||
if (document.activeElement.tagName.toLowerCase() !== "body") {
|
if (document.activeElement.tagName.toLowerCase() !== "body") {
|
||||||
return;
|
return;
|
||||||
@ -144,7 +144,7 @@ const Posters = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the index of the currently selected item
|
// Get the index of the currently selected item
|
||||||
const idx = elmts.keySeq().findIndex((k) => k === selectedImdbId);
|
const idx = elmts.keySeq().findIndex(k => k === selectedImdbId);
|
||||||
|
|
||||||
var newIdx = idx + diff;
|
var newIdx = idx + diff;
|
||||||
|
|
||||||
@ -170,11 +170,11 @@ const Posters = ({
|
|||||||
posterHeight,
|
posterHeight,
|
||||||
postersPerRow,
|
postersPerRow,
|
||||||
selectPoster,
|
selectPoster,
|
||||||
selectedImdbId,
|
selectedImdbId
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
const posterCount = (node) => {
|
const posterCount = node => {
|
||||||
if (node === null) {
|
if (node === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -247,5 +247,5 @@ Posters.propTypes = {
|
|||||||
loading: PropTypes.bool.isRequired,
|
loading: PropTypes.bool.isRequired,
|
||||||
onDoubleClick: PropTypes.func,
|
onDoubleClick: PropTypes.func,
|
||||||
onKeyEnter: PropTypes.func,
|
onKeyEnter: PropTypes.func,
|
||||||
selectPoster: PropTypes.func,
|
selectPoster: PropTypes.func
|
||||||
};
|
};
|
||||||
|
@ -6,7 +6,7 @@ import { Map, List } from "immutable";
|
|||||||
// TODO: udpate this
|
// TODO: udpate this
|
||||||
import { OverlayTrigger, Tooltip } from "react-bootstrap";
|
import { OverlayTrigger, Tooltip } from "react-bootstrap";
|
||||||
|
|
||||||
const Modules = (props) => {
|
const Modules = props => {
|
||||||
if (props.isLoading) {
|
if (props.isLoading) {
|
||||||
return <Loader />;
|
return <Loader />;
|
||||||
}
|
}
|
||||||
@ -28,13 +28,13 @@ const Modules = (props) => {
|
|||||||
};
|
};
|
||||||
Modules.propTypes = {
|
Modules.propTypes = {
|
||||||
isLoading: PropTypes.bool.isRequired,
|
isLoading: PropTypes.bool.isRequired,
|
||||||
modules: PropTypes.instanceOf(Map),
|
modules: PropTypes.instanceOf(Map)
|
||||||
};
|
};
|
||||||
export default Modules;
|
export default Modules;
|
||||||
|
|
||||||
const capitalize = (string) => string.charAt(0).toUpperCase() + string.slice(1);
|
const capitalize = string => string.charAt(0).toUpperCase() + string.slice(1);
|
||||||
|
|
||||||
const ModulesByVideoType = (props) => (
|
const ModulesByVideoType = props => (
|
||||||
<div className="col-12 col-md-6">
|
<div className="col-12 col-md-6">
|
||||||
<div className="card mb-3">
|
<div className="card mb-3">
|
||||||
<div className="card-header">
|
<div className="card-header">
|
||||||
@ -50,10 +50,10 @@ const ModulesByVideoType = (props) => (
|
|||||||
);
|
);
|
||||||
ModulesByVideoType.propTypes = {
|
ModulesByVideoType.propTypes = {
|
||||||
videoType: PropTypes.string.isRequired,
|
videoType: PropTypes.string.isRequired,
|
||||||
data: PropTypes.instanceOf(Map),
|
data: PropTypes.instanceOf(Map)
|
||||||
};
|
};
|
||||||
|
|
||||||
const ModuleByType = (props) => (
|
const ModuleByType = props => (
|
||||||
<div>
|
<div>
|
||||||
<h4>{capitalize(props.type)}</h4>
|
<h4>{capitalize(props.type)}</h4>
|
||||||
<table className="table">
|
<table className="table">
|
||||||
@ -67,10 +67,10 @@ const ModuleByType = (props) => (
|
|||||||
);
|
);
|
||||||
ModuleByType.propTypes = {
|
ModuleByType.propTypes = {
|
||||||
type: PropTypes.string.isRequired,
|
type: PropTypes.string.isRequired,
|
||||||
data: PropTypes.instanceOf(List),
|
data: PropTypes.instanceOf(List)
|
||||||
};
|
};
|
||||||
|
|
||||||
const Module = (props) => {
|
const Module = props => {
|
||||||
let iconClass, prettyStatus, badgeClass;
|
let iconClass, prettyStatus, badgeClass;
|
||||||
const name = props.data.get("name");
|
const name = props.data.get("name");
|
||||||
|
|
||||||
@ -121,5 +121,5 @@ const Module = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
Module.propTypes = {
|
Module.propTypes = {
|
||||||
data: PropTypes.instanceOf(Map),
|
data: PropTypes.instanceOf(Map)
|
||||||
};
|
};
|
||||||
|
@ -5,7 +5,7 @@ import { connect } from "react-redux";
|
|||||||
import {
|
import {
|
||||||
selectMovie,
|
selectMovie,
|
||||||
updateFilter,
|
updateFilter,
|
||||||
movieWishlistToggle,
|
movieWishlistToggle
|
||||||
} from "../../actions/movies";
|
} from "../../actions/movies";
|
||||||
|
|
||||||
import ListDetails from "../list/details";
|
import ListDetails from "../list/details";
|
||||||
@ -24,16 +24,16 @@ function mapStateToProps(state) {
|
|||||||
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"),
|
||||||
exploreOptions: state.movieStore.get("exploreOptions"),
|
exploreOptions: state.movieStore.get("exploreOptions")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const mapDispatchToProps = {
|
const mapDispatchToProps = {
|
||||||
selectMovie,
|
selectMovie,
|
||||||
updateFilter,
|
updateFilter,
|
||||||
movieWishlistToggle,
|
movieWishlistToggle
|
||||||
};
|
};
|
||||||
|
|
||||||
const MovieList = (props) => {
|
const MovieList = props => {
|
||||||
let selectedMovie = Map();
|
let selectedMovie = Map();
|
||||||
if (props.movies !== undefined && props.movies.has(props.selectedImdbId)) {
|
if (props.movies !== undefined && props.movies.has(props.selectedImdbId)) {
|
||||||
selectedMovie = props.movies.get(props.selectedImdbId);
|
selectedMovie = props.movies.get(props.selectedImdbId);
|
||||||
@ -99,7 +99,7 @@ MovieList.propTypes = {
|
|||||||
updateFilter: PropTypes.func,
|
updateFilter: PropTypes.func,
|
||||||
movieWishlistToggle: PropTypes.func,
|
movieWishlistToggle: PropTypes.func,
|
||||||
selectMovie: PropTypes.func,
|
selectMovie: PropTypes.func,
|
||||||
match: PropTypes.object,
|
match: PropTypes.object
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(MovieList);
|
export default connect(mapStateToProps, mapDispatchToProps)(MovieList);
|
||||||
|
@ -4,8 +4,8 @@ import { Route } from "react-router-dom";
|
|||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { fetchMovies, getMovieExploreOptions } from "../../actions/movies";
|
import { fetchMovies, getMovieExploreOptions } from "../../actions/movies";
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = state => ({
|
||||||
isExplorerFetched: state.movieStore.get("exploreOptions").size !== 0,
|
isExplorerFetched: state.movieStore.get("exploreOptions").size !== 0
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = { fetchMovies, getMovieExploreOptions };
|
const mapDispatchToProps = { fetchMovies, getMovieExploreOptions };
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ const MoviesRoute = ({
|
|||||||
return (
|
return (
|
||||||
<Route
|
<Route
|
||||||
{...otherProps}
|
{...otherProps}
|
||||||
render={(props) => {
|
render={props => {
|
||||||
let fetchUrl = "";
|
let fetchUrl = "";
|
||||||
switch (props.match.path) {
|
switch (props.match.path) {
|
||||||
case "/movies/polochon":
|
case "/movies/polochon":
|
||||||
@ -59,7 +59,7 @@ MoviesRoute.propTypes = {
|
|||||||
match: PropTypes.object,
|
match: PropTypes.object,
|
||||||
isExplorerFetched: PropTypes.bool.isRequired,
|
isExplorerFetched: PropTypes.bool.isRequired,
|
||||||
fetchMovies: PropTypes.func.isRequired,
|
fetchMovies: PropTypes.func.isRequired,
|
||||||
getMovieExploreOptions: PropTypes.func.isRequired,
|
getMovieExploreOptions: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(MoviesRoute);
|
export default connect(mapStateToProps, mapDispatchToProps)(MoviesRoute);
|
||||||
|
@ -12,7 +12,7 @@ const movieSubtitlesButton = ({
|
|||||||
imdbId,
|
imdbId,
|
||||||
searching,
|
searching,
|
||||||
searchMovieSubtitles,
|
searchMovieSubtitles,
|
||||||
subtitles,
|
subtitles
|
||||||
}) => (
|
}) => (
|
||||||
<SubtitlesButton
|
<SubtitlesButton
|
||||||
inLibrary={inLibrary}
|
inLibrary={inLibrary}
|
||||||
@ -27,7 +27,7 @@ movieSubtitlesButton.propTypes = {
|
|||||||
inLibrary: PropTypes.bool,
|
inLibrary: PropTypes.bool,
|
||||||
imdbId: PropTypes.string,
|
imdbId: PropTypes.string,
|
||||||
searchMovieSubtitles: PropTypes.func,
|
searchMovieSubtitles: PropTypes.func,
|
||||||
subtitles: PropTypes.instanceOf(List),
|
subtitles: PropTypes.instanceOf(List)
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MovieSubtitlesButton = connect(null, { searchMovieSubtitles })(
|
export const MovieSubtitlesButton = connect(null, { searchMovieSubtitles })(
|
||||||
|
@ -11,7 +11,7 @@ const movieTorrentsButton = ({
|
|||||||
imdbId,
|
imdbId,
|
||||||
title,
|
title,
|
||||||
searching,
|
searching,
|
||||||
getMovieDetails,
|
getMovieDetails
|
||||||
}) => (
|
}) => (
|
||||||
<TorrentsButton
|
<TorrentsButton
|
||||||
torrents={torrents}
|
torrents={torrents}
|
||||||
@ -25,7 +25,7 @@ movieTorrentsButton.propTypes = {
|
|||||||
imdbId: PropTypes.string,
|
imdbId: PropTypes.string,
|
||||||
title: PropTypes.string,
|
title: PropTypes.string,
|
||||||
searching: PropTypes.bool,
|
searching: PropTypes.bool,
|
||||||
getMovieDetails: PropTypes.func,
|
getMovieDetails: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MovieTorrentsButton = connect(null, { getMovieDetails })(
|
export const MovieTorrentsButton = connect(null, { getMovieDetails })(
|
||||||
|
@ -8,7 +8,7 @@ import Nav from "react-bootstrap/Nav";
|
|||||||
import Navbar from "react-bootstrap/Navbar";
|
import Navbar from "react-bootstrap/Navbar";
|
||||||
import NavDropdown from "react-bootstrap/NavDropdown";
|
import NavDropdown from "react-bootstrap/NavDropdown";
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
const mapStateToProps = state => {
|
||||||
let torrentCount = 0;
|
let torrentCount = 0;
|
||||||
if (
|
if (
|
||||||
state.torrentStore.has("torrents") &&
|
state.torrentStore.has("torrents") &&
|
||||||
@ -19,11 +19,11 @@ const mapStateToProps = (state) => {
|
|||||||
return {
|
return {
|
||||||
username: state.userStore.get("username"),
|
username: state.userStore.get("username"),
|
||||||
isAdmin: state.userStore.get("isAdmin"),
|
isAdmin: state.userStore.get("isAdmin"),
|
||||||
torrentCount: torrentCount,
|
torrentCount: torrentCount
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const AppNavBar = (props) => {
|
const AppNavBar = props => {
|
||||||
const [expanded, setExpanded] = useState(false);
|
const [expanded, setExpanded] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -50,7 +50,7 @@ const AppNavBar = (props) => {
|
|||||||
<Nav>
|
<Nav>
|
||||||
<Route
|
<Route
|
||||||
path="/movies"
|
path="/movies"
|
||||||
render={(props) => (
|
render={props => (
|
||||||
<Search
|
<Search
|
||||||
placeholder="Search movies"
|
placeholder="Search movies"
|
||||||
path="/movies/search"
|
path="/movies/search"
|
||||||
@ -61,7 +61,7 @@ const AppNavBar = (props) => {
|
|||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/shows"
|
path="/shows"
|
||||||
render={(props) => (
|
render={props => (
|
||||||
<Search
|
<Search
|
||||||
placeholder="Search shows"
|
placeholder="Search shows"
|
||||||
path="/shows/search"
|
path="/shows/search"
|
||||||
@ -80,7 +80,7 @@ AppNavBar.propTypes = {
|
|||||||
torrentCount: PropTypes.number.isRequired,
|
torrentCount: PropTypes.number.isRequired,
|
||||||
username: PropTypes.string.isRequired,
|
username: PropTypes.string.isRequired,
|
||||||
isAdmin: PropTypes.bool.isRequired,
|
isAdmin: PropTypes.bool.isRequired,
|
||||||
history: PropTypes.object,
|
history: PropTypes.object
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps)(AppNavBar);
|
export default connect(mapStateToProps)(AppNavBar);
|
||||||
@ -88,7 +88,7 @@ export default connect(mapStateToProps)(AppNavBar);
|
|||||||
const Search = ({ path, placeholder, setExpanded, history }) => {
|
const Search = ({ path, placeholder, setExpanded, history }) => {
|
||||||
const [search, setSearch] = useState("");
|
const [search, setSearch] = useState("");
|
||||||
|
|
||||||
const handleSearch = (ev) => {
|
const handleSearch = ev => {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
history.push(`${path}/${encodeURI(search)}`);
|
history.push(`${path}/${encodeURI(search)}`);
|
||||||
setExpanded(false);
|
setExpanded(false);
|
||||||
@ -96,12 +96,12 @@ const Search = ({ path, placeholder, setExpanded, history }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="navbar-form navbar-right">
|
<div className="navbar-form navbar-right">
|
||||||
<form className="input-group" onSubmit={(ev) => handleSearch(ev)}>
|
<form className="input-group" onSubmit={ev => handleSearch(ev)}>
|
||||||
<input
|
<input
|
||||||
className="form-control"
|
className="form-control"
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
value={search}
|
value={search}
|
||||||
onChange={(e) => setSearch(e.target.value)}
|
onChange={e => setSearch(e.target.value)}
|
||||||
/>
|
/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@ -111,7 +111,7 @@ Search.propTypes = {
|
|||||||
placeholder: PropTypes.string.isRequired,
|
placeholder: PropTypes.string.isRequired,
|
||||||
setExpanded: PropTypes.func.isRequired,
|
setExpanded: PropTypes.func.isRequired,
|
||||||
path: PropTypes.string.isRequired,
|
path: PropTypes.string.isRequired,
|
||||||
history: PropTypes.object,
|
history: PropTypes.object
|
||||||
};
|
};
|
||||||
|
|
||||||
const MoviesDropdown = () => (
|
const MoviesDropdown = () => (
|
||||||
@ -136,7 +136,7 @@ const ShowsDropdown = () => (
|
|||||||
</NavDropdown>
|
</NavDropdown>
|
||||||
);
|
);
|
||||||
|
|
||||||
const UserDropdown = (props) => (
|
const UserDropdown = props => (
|
||||||
<Nav>
|
<Nav>
|
||||||
<NavDropdown title={props.username} alignRight>
|
<NavDropdown title={props.username} alignRight>
|
||||||
{props.isAdmin && (
|
{props.isAdmin && (
|
||||||
@ -158,7 +158,7 @@ const UserDropdown = (props) => (
|
|||||||
);
|
);
|
||||||
UserDropdown.propTypes = {
|
UserDropdown.propTypes = {
|
||||||
username: PropTypes.string.isRequired,
|
username: PropTypes.string.isRequired,
|
||||||
isAdmin: PropTypes.bool.isRequired,
|
isAdmin: PropTypes.bool.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
const WishlistDropdown = () => (
|
const WishlistDropdown = () => (
|
||||||
@ -172,7 +172,7 @@ const WishlistDropdown = () => (
|
|||||||
</NavDropdown>
|
</NavDropdown>
|
||||||
);
|
);
|
||||||
|
|
||||||
const TorrentsDropdown = (props) => {
|
const TorrentsDropdown = props => {
|
||||||
const title = <TorrentsDropdownTitle torrentsCount={props.torrentsCount} />;
|
const title = <TorrentsDropdownTitle torrentsCount={props.torrentsCount} />;
|
||||||
return (
|
return (
|
||||||
<NavDropdown title={title} id="navbar-wishlit-dropdown">
|
<NavDropdown title={title} id="navbar-wishlit-dropdown">
|
||||||
@ -187,7 +187,7 @@ const TorrentsDropdown = (props) => {
|
|||||||
};
|
};
|
||||||
TorrentsDropdown.propTypes = { torrentsCount: PropTypes.number.isRequired };
|
TorrentsDropdown.propTypes = { torrentsCount: PropTypes.number.isRequired };
|
||||||
|
|
||||||
const TorrentsDropdownTitle = (props) => {
|
const TorrentsDropdownTitle = props => {
|
||||||
if (props.torrentsCount === 0) {
|
if (props.torrentsCount === 0) {
|
||||||
return <span>Torrents</span>;
|
return <span>Torrents</span>;
|
||||||
}
|
}
|
||||||
@ -206,5 +206,5 @@ const TorrentsDropdownTitle = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
TorrentsDropdownTitle.propTypes = {
|
TorrentsDropdownTitle.propTypes = {
|
||||||
torrentsCount: PropTypes.number.isRequired,
|
torrentsCount: PropTypes.number.isRequired
|
||||||
};
|
};
|
||||||
|
@ -14,7 +14,7 @@ const NotificationConnected = ({
|
|||||||
imageUrl,
|
imageUrl,
|
||||||
autohide,
|
autohide,
|
||||||
delay,
|
delay,
|
||||||
removeNotification,
|
removeNotification
|
||||||
}) => {
|
}) => {
|
||||||
const [show, setShow] = useState(true);
|
const [show, setShow] = useState(true);
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ NotificationConnected.propTypes = {
|
|||||||
imageUrl: PropTypes.string,
|
imageUrl: PropTypes.string,
|
||||||
autohide: PropTypes.bool,
|
autohide: PropTypes.bool,
|
||||||
delay: PropTypes.number,
|
delay: PropTypes.number,
|
||||||
removeNotification: PropTypes.func,
|
removeNotification: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
NotificationConnected.defaultProps = {
|
NotificationConnected.defaultProps = {
|
||||||
@ -55,7 +55,7 @@ NotificationConnected.defaultProps = {
|
|||||||
icon: "",
|
icon: "",
|
||||||
imageUrl: "",
|
imageUrl: "",
|
||||||
title: "Info",
|
title: "Info",
|
||||||
message: "",
|
message: ""
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Notification = connect(null, { removeNotification })(
|
export const Notification = connect(null, { removeNotification })(
|
||||||
|
@ -8,7 +8,7 @@ import { Notification } from "./notification";
|
|||||||
const NotificationsConnected = ({ notifications }) => {
|
const NotificationsConnected = ({ notifications }) => {
|
||||||
return (
|
return (
|
||||||
<div className="notifications">
|
<div className="notifications">
|
||||||
{notifications.map((el) => (
|
{notifications.map(el => (
|
||||||
<Notification
|
<Notification
|
||||||
key={el.get("id")}
|
key={el.get("id")}
|
||||||
id={el.get("id")}
|
id={el.get("id")}
|
||||||
@ -24,11 +24,11 @@ const NotificationsConnected = ({ notifications }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
NotificationsConnected.propTypes = {
|
NotificationsConnected.propTypes = {
|
||||||
notifications: PropTypes.instanceOf(List),
|
notifications: PropTypes.instanceOf(List)
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = state => ({
|
||||||
notifications: state.notifications,
|
notifications: state.notifications
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Notifications = connect(mapStateToProps)(NotificationsConnected);
|
export const Notifications = connect(mapStateToProps)(NotificationsConnected);
|
||||||
|
@ -27,7 +27,7 @@ export const PolochonAddConnected = ({ addPolochon }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
PolochonAddConnected.propTypes = {
|
PolochonAddConnected.propTypes = {
|
||||||
addPolochon: PropTypes.func,
|
addPolochon: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
export const PolochonAdd = connect(null, { addPolochon })(PolochonAddConnected);
|
export const PolochonAdd = connect(null, { addPolochon })(PolochonAddConnected);
|
||||||
|
@ -13,7 +13,7 @@ export const PolochonEdit = ({
|
|||||||
initialName,
|
initialName,
|
||||||
initialUrl,
|
initialUrl,
|
||||||
initialToken,
|
initialToken,
|
||||||
update,
|
update
|
||||||
}) => {
|
}) => {
|
||||||
const [name, setName] = useState(initialName);
|
const [name, setName] = useState(initialName);
|
||||||
const [url, setUrl] = useState(initialUrl);
|
const [url, setUrl] = useState(initialUrl);
|
||||||
@ -53,7 +53,7 @@ PolochonEdit.propTypes = {
|
|||||||
id: PropTypes.string,
|
id: PropTypes.string,
|
||||||
initialName: PropTypes.string,
|
initialName: PropTypes.string,
|
||||||
initialUrl: PropTypes.string,
|
initialUrl: PropTypes.string,
|
||||||
initialToken: PropTypes.string,
|
initialToken: PropTypes.string
|
||||||
};
|
};
|
||||||
PolochonEdit.defaultProps = {
|
PolochonEdit.defaultProps = {
|
||||||
id: "",
|
id: "",
|
||||||
@ -61,5 +61,5 @@ PolochonEdit.defaultProps = {
|
|||||||
icon: "edit",
|
icon: "edit",
|
||||||
initialName: "",
|
initialName: "",
|
||||||
initialUrl: "",
|
initialUrl: "",
|
||||||
initialToken: "",
|
initialToken: ""
|
||||||
};
|
};
|
||||||
|
@ -8,12 +8,12 @@ import { getManagedPolochons } from "../../actions/polochon";
|
|||||||
import { Polochon } from "./polochon";
|
import { Polochon } from "./polochon";
|
||||||
import { PolochonAdd } from "./add";
|
import { PolochonAdd } from "./add";
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = state => ({
|
||||||
managedList: state.polochon.get("managed"),
|
managedList: state.polochon.get("managed")
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
const mapDispatchToProps = {
|
||||||
getManagedPolochons,
|
getManagedPolochons
|
||||||
};
|
};
|
||||||
|
|
||||||
const PolochonListConnected = ({ getManagedPolochons, managedList }) => {
|
const PolochonListConnected = ({ getManagedPolochons, managedList }) => {
|
||||||
@ -46,7 +46,7 @@ const PolochonListConnected = ({ getManagedPolochons, managedList }) => {
|
|||||||
};
|
};
|
||||||
PolochonListConnected.propTypes = {
|
PolochonListConnected.propTypes = {
|
||||||
getManagedPolochons: PropTypes.func,
|
getManagedPolochons: PropTypes.func,
|
||||||
managedList: PropTypes.instanceOf(List),
|
managedList: PropTypes.instanceOf(List)
|
||||||
};
|
};
|
||||||
|
|
||||||
export const PolochonList = connect(
|
export const PolochonList = connect(
|
||||||
|
@ -16,7 +16,7 @@ export const PolochonConnected = ({
|
|||||||
authToken,
|
authToken,
|
||||||
users,
|
users,
|
||||||
updatePolochon,
|
updatePolochon,
|
||||||
deletePolochon,
|
deletePolochon
|
||||||
}) => {
|
}) => {
|
||||||
const [edit, setEdit] = useState(false);
|
const [edit, setEdit] = useState(false);
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ PolochonConnected.propTypes = {
|
|||||||
authToken: PropTypes.string,
|
authToken: PropTypes.string,
|
||||||
users: PropTypes.instanceOf(List),
|
users: PropTypes.instanceOf(List),
|
||||||
updatePolochon: PropTypes.func,
|
updatePolochon: PropTypes.func,
|
||||||
deletePolochon: PropTypes.func,
|
deletePolochon: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Polochon = connect(null, { updatePolochon, deletePolochon })(
|
export const Polochon = connect(null, { updatePolochon, deletePolochon })(
|
||||||
|
@ -7,7 +7,7 @@ export const PolochonSelect = ({ value, changeValue, polochonList }) => {
|
|||||||
<select
|
<select
|
||||||
className="form-control"
|
className="form-control"
|
||||||
value={value}
|
value={value}
|
||||||
onChange={(e) =>
|
onChange={e =>
|
||||||
changeValue(e.target.options[e.target.selectedIndex].value)
|
changeValue(e.target.options[e.target.selectedIndex].value)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@ -22,5 +22,5 @@ export const PolochonSelect = ({ value, changeValue, polochonList }) => {
|
|||||||
PolochonSelect.propTypes = {
|
PolochonSelect.propTypes = {
|
||||||
value: PropTypes.string,
|
value: PropTypes.string,
|
||||||
changeValue: PropTypes.func,
|
changeValue: PropTypes.func,
|
||||||
polochonList: PropTypes.instanceOf(List),
|
polochonList: PropTypes.instanceOf(List)
|
||||||
};
|
};
|
||||||
|
@ -15,7 +15,7 @@ export const PolochonUserConnected = ({
|
|||||||
name,
|
name,
|
||||||
initialToken,
|
initialToken,
|
||||||
initialActivated,
|
initialActivated,
|
||||||
editPolochonUser,
|
editPolochonUser
|
||||||
}) => {
|
}) => {
|
||||||
const [edit, setEdit] = useState(false);
|
const [edit, setEdit] = useState(false);
|
||||||
const [token, setToken] = useState(initialToken);
|
const [token, setToken] = useState(initialToken);
|
||||||
@ -31,7 +31,7 @@ export const PolochonUserConnected = ({
|
|||||||
polochonId,
|
polochonId,
|
||||||
id,
|
id,
|
||||||
token,
|
token,
|
||||||
activated,
|
activated
|
||||||
});
|
});
|
||||||
setEdit(false);
|
setEdit(false);
|
||||||
};
|
};
|
||||||
@ -73,7 +73,7 @@ PolochonUserConnected.propTypes = {
|
|||||||
name: PropTypes.string,
|
name: PropTypes.string,
|
||||||
initialToken: PropTypes.string,
|
initialToken: PropTypes.string,
|
||||||
initialActivated: PropTypes.bool,
|
initialActivated: PropTypes.bool,
|
||||||
editPolochonUser: PropTypes.func,
|
editPolochonUser: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
export const PolochonUser = connect(null, { editPolochonUser })(
|
export const PolochonUser = connect(null, { editPolochonUser })(
|
||||||
|
@ -35,5 +35,5 @@ export const PolochonUsers = ({ id, users }) => {
|
|||||||
};
|
};
|
||||||
PolochonUsers.propTypes = {
|
PolochonUsers.propTypes = {
|
||||||
id: PropTypes.string,
|
id: PropTypes.string,
|
||||||
users: PropTypes.instanceOf(List),
|
users: PropTypes.instanceOf(List)
|
||||||
};
|
};
|
||||||
|
@ -9,9 +9,9 @@ import { Fanart } from "./details/fanart";
|
|||||||
import { Header } from "./details/header";
|
import { Header } from "./details/header";
|
||||||
import { SeasonsList } from "./details/seasons";
|
import { SeasonsList } from "./details/seasons";
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = state => ({
|
||||||
loading: state.showStore.get("loading"),
|
loading: state.showStore.get("loading"),
|
||||||
show: state.showStore.get("show"),
|
show: state.showStore.get("show")
|
||||||
});
|
});
|
||||||
|
|
||||||
const showDetails = ({ show, loading }) => {
|
const showDetails = ({ show, loading }) => {
|
||||||
@ -31,6 +31,6 @@ const showDetails = ({ show, loading }) => {
|
|||||||
};
|
};
|
||||||
showDetails.propTypes = {
|
showDetails.propTypes = {
|
||||||
loading: PropTypes.bool,
|
loading: PropTypes.bool,
|
||||||
show: PropTypes.instanceOf(Map),
|
show: PropTypes.instanceOf(Map)
|
||||||
};
|
};
|
||||||
export const ShowDetails = connect(mapStateToProps)(showDetails);
|
export const ShowDetails = connect(mapStateToProps)(showDetails);
|
||||||
|
@ -8,7 +8,7 @@ import { showWishlistToggle } from "../../../actions/shows";
|
|||||||
import {
|
import {
|
||||||
inLibrary,
|
inLibrary,
|
||||||
isEpisodeWishlisted,
|
isEpisodeWishlisted,
|
||||||
prettyEpisodeName,
|
prettyEpisodeName
|
||||||
} from "../../../utils";
|
} from "../../../utils";
|
||||||
|
|
||||||
import { Plot } from "../../details/plot";
|
import { Plot } from "../../details/plot";
|
||||||
@ -24,12 +24,12 @@ import { EpisodeSubtitlesButton } from "./subtitlesButton";
|
|||||||
import { EpisodeThumb } from "./episodeThumb";
|
import { EpisodeThumb } from "./episodeThumb";
|
||||||
import { EpisodeTorrentsButton } from "./torrentsButton";
|
import { EpisodeTorrentsButton } from "./torrentsButton";
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = state => ({
|
||||||
trackedSeason: state.showStore.getIn(["show", "tracked_season"], null),
|
trackedSeason: state.showStore.getIn(["show", "tracked_season"], null),
|
||||||
trackedEpisode: state.showStore.getIn(["show", "tracked_episode"], null),
|
trackedEpisode: state.showStore.getIn(["show", "tracked_episode"], null)
|
||||||
});
|
});
|
||||||
|
|
||||||
const episode = (props) => (
|
const episode = props => (
|
||||||
<div className="d-flex flex-column flex-lg-row mb-3 pb-3 border-bottom border-light">
|
<div className="d-flex flex-column flex-lg-row mb-3 pb-3 border-bottom border-light">
|
||||||
<EpisodeThumb url={props.data.get("thumb")} />
|
<EpisodeThumb url={props.data.get("thumb")} />
|
||||||
<div className="d-flex flex-column">
|
<div className="d-flex flex-column">
|
||||||
@ -102,7 +102,7 @@ episode.propTypes = {
|
|||||||
trackedSeason: PropTypes.number,
|
trackedSeason: PropTypes.number,
|
||||||
trackedEpisode: PropTypes.number,
|
trackedEpisode: PropTypes.number,
|
||||||
showName: PropTypes.string.isRequired,
|
showName: PropTypes.string.isRequired,
|
||||||
showWishlistToggle: PropTypes.func,
|
showWishlistToggle: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Episode = connect(mapStateToProps, { showWishlistToggle })(
|
export const Episode = connect(mapStateToProps, { showWishlistToggle })(
|
||||||
|
@ -10,5 +10,5 @@ export const Fanart = ({ url }) => (
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
Fanart.propTypes = {
|
Fanart.propTypes = {
|
||||||
url: PropTypes.string,
|
url: PropTypes.string
|
||||||
};
|
};
|
||||||
|
@ -15,7 +15,7 @@ import { TrackingLabel } from "../../details/tracking";
|
|||||||
|
|
||||||
import { ImdbBadge } from "../../buttons/imdb";
|
import { ImdbBadge } from "../../buttons/imdb";
|
||||||
|
|
||||||
export const header = (props) => (
|
export const header = props => (
|
||||||
<div className="card col-12 col-md-10 offset-md-1 mt-n3 mb-3">
|
<div className="card col-12 col-md-10 offset-md-1 mt-n3 mb-3">
|
||||||
<div className="d-flex flex-column flex-md-row">
|
<div className="d-flex flex-column flex-md-row">
|
||||||
<div className="d-flex justify-content-center">
|
<div className="d-flex justify-content-center">
|
||||||
@ -64,7 +64,7 @@ export const header = (props) => (
|
|||||||
);
|
);
|
||||||
header.propTypes = {
|
header.propTypes = {
|
||||||
data: PropTypes.instanceOf(Map),
|
data: PropTypes.instanceOf(Map),
|
||||||
showWishlistToggle: PropTypes.func,
|
showWishlistToggle: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Header = connect(null, { showWishlistToggle })(header);
|
export const Header = connect(null, { showWishlistToggle })(header);
|
||||||
|
@ -4,7 +4,7 @@ import { Map } from "immutable";
|
|||||||
|
|
||||||
import { Episode } from "./episode";
|
import { Episode } from "./episode";
|
||||||
|
|
||||||
export const Season = (props) => {
|
export const Season = props => {
|
||||||
const [show, setShow] = useState(false);
|
const [show, setShow] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -47,5 +47,5 @@ Season.propTypes = {
|
|||||||
addToWishlist: PropTypes.func,
|
addToWishlist: PropTypes.func,
|
||||||
addTorrent: PropTypes.func,
|
addTorrent: PropTypes.func,
|
||||||
refreshSubtitles: PropTypes.func,
|
refreshSubtitles: PropTypes.func,
|
||||||
getEpisodeDetails: PropTypes.func,
|
getEpisodeDetails: PropTypes.func
|
||||||
};
|
};
|
||||||
|
@ -4,7 +4,7 @@ import { Map } from "immutable";
|
|||||||
|
|
||||||
import { Season } from "./season";
|
import { Season } from "./season";
|
||||||
|
|
||||||
export const SeasonsList = (props) => (
|
export const SeasonsList = props => (
|
||||||
<div className="col col-12 col-md-10 offset-md-1">
|
<div className="col col-12 col-md-10 offset-md-1">
|
||||||
{props.data
|
{props.data
|
||||||
.get("seasons")
|
.get("seasons")
|
||||||
@ -33,5 +33,5 @@ SeasonsList.propTypes = {
|
|||||||
addToWishlist: PropTypes.func,
|
addToWishlist: PropTypes.func,
|
||||||
addTorrent: PropTypes.func,
|
addTorrent: PropTypes.func,
|
||||||
refreshSubtitles: PropTypes.func,
|
refreshSubtitles: PropTypes.func,
|
||||||
getEpisodeDetails: PropTypes.func,
|
getEpisodeDetails: PropTypes.func
|
||||||
};
|
};
|
||||||
|
@ -14,7 +14,7 @@ const episodeSubtitlesButton = ({
|
|||||||
episode,
|
episode,
|
||||||
searching,
|
searching,
|
||||||
searchEpisodeSubtitles,
|
searchEpisodeSubtitles,
|
||||||
subtitles,
|
subtitles
|
||||||
}) => (
|
}) => (
|
||||||
<SubtitlesButton
|
<SubtitlesButton
|
||||||
subtitles={subtitles}
|
subtitles={subtitles}
|
||||||
@ -31,7 +31,7 @@ episodeSubtitlesButton.propTypes = {
|
|||||||
season: PropTypes.number,
|
season: PropTypes.number,
|
||||||
episode: PropTypes.number,
|
episode: PropTypes.number,
|
||||||
searchEpisodeSubtitles: PropTypes.func,
|
searchEpisodeSubtitles: PropTypes.func,
|
||||||
subtitles: PropTypes.instanceOf(List),
|
subtitles: PropTypes.instanceOf(List)
|
||||||
};
|
};
|
||||||
|
|
||||||
export const EpisodeSubtitlesButton = connect(null, { searchEpisodeSubtitles })(
|
export const EpisodeSubtitlesButton = connect(null, { searchEpisodeSubtitles })(
|
||||||
|
@ -14,7 +14,7 @@ const episodeTorrentsButton = ({
|
|||||||
episode,
|
episode,
|
||||||
showName,
|
showName,
|
||||||
searching,
|
searching,
|
||||||
getEpisodeDetails,
|
getEpisodeDetails
|
||||||
}) => (
|
}) => (
|
||||||
<TorrentsButton
|
<TorrentsButton
|
||||||
torrents={torrents}
|
torrents={torrents}
|
||||||
@ -32,7 +32,7 @@ episodeTorrentsButton.propTypes = {
|
|||||||
episode: PropTypes.number.isRequired,
|
episode: PropTypes.number.isRequired,
|
||||||
season: PropTypes.number.isRequired,
|
season: PropTypes.number.isRequired,
|
||||||
searching: PropTypes.bool.isRequired,
|
searching: PropTypes.bool.isRequired,
|
||||||
getEpisodeDetails: PropTypes.func.isRequired,
|
getEpisodeDetails: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
export const EpisodeTorrentsButton = connect(null, { getEpisodeDetails })(
|
export const EpisodeTorrentsButton = connect(null, { getEpisodeDetails })(
|
||||||
|
@ -6,7 +6,7 @@ import {
|
|||||||
selectShow,
|
selectShow,
|
||||||
showWishlistToggle,
|
showWishlistToggle,
|
||||||
getShowDetails,
|
getShowDetails,
|
||||||
updateFilter,
|
updateFilter
|
||||||
} from "../../actions/shows";
|
} from "../../actions/shows";
|
||||||
|
|
||||||
import { isWishlisted } from "../../utils";
|
import { isWishlisted } from "../../utils";
|
||||||
@ -20,18 +20,18 @@ function mapStateToProps(state) {
|
|||||||
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"),
|
||||||
exploreOptions: state.showsStore.get("exploreOptions"),
|
exploreOptions: state.showsStore.get("exploreOptions")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const mapDispatchToProps = {
|
const mapDispatchToProps = {
|
||||||
selectShow,
|
selectShow,
|
||||||
showWishlistToggle,
|
showWishlistToggle,
|
||||||
getShowDetails,
|
getShowDetails,
|
||||||
updateFilter,
|
updateFilter
|
||||||
};
|
};
|
||||||
|
|
||||||
const ShowList = (props) => {
|
const ShowList = props => {
|
||||||
const showDetails = (imdbId) => {
|
const showDetails = imdbId => {
|
||||||
props.history.push("/shows/details/" + imdbId);
|
props.history.push("/shows/details/" + imdbId);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -90,6 +90,6 @@ ShowList.propTypes = {
|
|||||||
showWishlistToggle: PropTypes.func,
|
showWishlistToggle: PropTypes.func,
|
||||||
selectShow: PropTypes.func,
|
selectShow: PropTypes.func,
|
||||||
getShowDetails: PropTypes.func,
|
getShowDetails: PropTypes.func,
|
||||||
updateFilter: PropTypes.func,
|
updateFilter: PropTypes.func
|
||||||
};
|
};
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(ShowList);
|
export default connect(mapStateToProps, mapDispatchToProps)(ShowList);
|
||||||
|
@ -5,16 +5,16 @@ import { connect } from "react-redux";
|
|||||||
import {
|
import {
|
||||||
fetchShows,
|
fetchShows,
|
||||||
fetchShowDetails,
|
fetchShowDetails,
|
||||||
getShowExploreOptions,
|
getShowExploreOptions
|
||||||
} from "../../actions/shows";
|
} from "../../actions/shows";
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = state => ({
|
||||||
isExplorerFetched: state.showsStore.get("exploreOptions").size !== 0,
|
isExplorerFetched: state.showsStore.get("exploreOptions").size !== 0
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = {
|
const mapDispatchToProps = {
|
||||||
fetchShows,
|
fetchShows,
|
||||||
fetchShowDetails,
|
fetchShowDetails,
|
||||||
getShowExploreOptions,
|
getShowExploreOptions
|
||||||
};
|
};
|
||||||
|
|
||||||
const ShowsRoute = ({
|
const ShowsRoute = ({
|
||||||
@ -28,7 +28,7 @@ const ShowsRoute = ({
|
|||||||
return (
|
return (
|
||||||
<Route
|
<Route
|
||||||
{...otherProps}
|
{...otherProps}
|
||||||
render={(props) => {
|
render={props => {
|
||||||
let fetchUrl = "";
|
let fetchUrl = "";
|
||||||
switch (props.match.path) {
|
switch (props.match.path) {
|
||||||
case "/shows/polochon":
|
case "/shows/polochon":
|
||||||
@ -65,12 +65,12 @@ const ShowsRoute = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
ShowsRoute.propTypes = {
|
ShowsRoute.propTypes = {
|
||||||
component: PropTypes.object,
|
component: PropTypes.func,
|
||||||
match: PropTypes.object,
|
match: PropTypes.object,
|
||||||
isExplorerFetched: PropTypes.bool.isRequired,
|
isExplorerFetched: PropTypes.bool.isRequired,
|
||||||
fetchShows: PropTypes.func.isRequired,
|
fetchShows: PropTypes.func.isRequired,
|
||||||
fetchShowDetails: PropTypes.func.isRequired,
|
fetchShowDetails: PropTypes.func.isRequired,
|
||||||
getShowExploreOptions: PropTypes.func.isRequired,
|
getShowExploreOptions: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(ShowsRoute);
|
export default connect(mapStateToProps, mapDispatchToProps)(ShowsRoute);
|
||||||
|
@ -7,19 +7,19 @@ import { prettySize } from "../../utils";
|
|||||||
import {
|
import {
|
||||||
fetchTorrents,
|
fetchTorrents,
|
||||||
addTorrent,
|
addTorrent,
|
||||||
removeTorrent,
|
removeTorrent
|
||||||
} from "../../actions/torrents";
|
} from "../../actions/torrents";
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = state => ({
|
||||||
torrents: state.torrentStore.get("torrents"),
|
torrents: state.torrentStore.get("torrents")
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = {
|
const mapDispatchToProps = {
|
||||||
fetchTorrents,
|
fetchTorrents,
|
||||||
addTorrent,
|
addTorrent,
|
||||||
removeTorrent,
|
removeTorrent
|
||||||
};
|
};
|
||||||
|
|
||||||
const TorrentList = (props) => (
|
const TorrentList = props => (
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col-12">
|
<div className="col-12">
|
||||||
<AddTorrent addTorrent={props.addTorrent} />
|
<AddTorrent addTorrent={props.addTorrent} />
|
||||||
@ -31,14 +31,14 @@ TorrentList.propTypes = {
|
|||||||
fetchTorrents: PropTypes.func.isRequired,
|
fetchTorrents: PropTypes.func.isRequired,
|
||||||
addTorrent: PropTypes.func.isRequired,
|
addTorrent: PropTypes.func.isRequired,
|
||||||
removeTorrent: PropTypes.func.isRequired,
|
removeTorrent: PropTypes.func.isRequired,
|
||||||
torrents: PropTypes.instanceOf(List),
|
torrents: PropTypes.instanceOf(List)
|
||||||
};
|
};
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(TorrentList);
|
export default connect(mapStateToProps, mapDispatchToProps)(TorrentList);
|
||||||
|
|
||||||
const AddTorrent = (props) => {
|
const AddTorrent = props => {
|
||||||
const [url, setUrl] = useState("");
|
const [url, setUrl] = useState("");
|
||||||
|
|
||||||
const handleSubmit = (e) => {
|
const handleSubmit = e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (url === "") {
|
if (url === "") {
|
||||||
return;
|
return;
|
||||||
@ -48,23 +48,23 @@ const AddTorrent = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form onSubmit={(e) => handleSubmit(e)}>
|
<form onSubmit={e => handleSubmit(e)}>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
className="form-control mb-3 w-100"
|
className="form-control mb-3 w-100"
|
||||||
placeholder="Add torrent URL"
|
placeholder="Add torrent URL"
|
||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
value={url}
|
value={url}
|
||||||
onChange={(e) => setUrl(e.target.value)}
|
onChange={e => setUrl(e.target.value)}
|
||||||
/>
|
/>
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
AddTorrent.propTypes = {
|
AddTorrent.propTypes = {
|
||||||
addTorrent: PropTypes.func.isRequired,
|
addTorrent: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
const Torrents = (props) => {
|
const Torrents = props => {
|
||||||
if (props.torrents.size === 0) {
|
if (props.torrents.size === 0) {
|
||||||
return (
|
return (
|
||||||
<div className="jumbotron">
|
<div className="jumbotron">
|
||||||
@ -83,10 +83,10 @@ const Torrents = (props) => {
|
|||||||
};
|
};
|
||||||
Torrents.propTypes = {
|
Torrents.propTypes = {
|
||||||
removeTorrent: PropTypes.func.isRequired,
|
removeTorrent: PropTypes.func.isRequired,
|
||||||
torrents: PropTypes.instanceOf(List),
|
torrents: PropTypes.instanceOf(List)
|
||||||
};
|
};
|
||||||
|
|
||||||
const Torrent = (props) => {
|
const Torrent = props => {
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
props.removeTorrent(props.data.get("id"));
|
props.removeTorrent(props.data.get("id"));
|
||||||
};
|
};
|
||||||
@ -141,5 +141,5 @@ const Torrent = (props) => {
|
|||||||
};
|
};
|
||||||
Torrent.propTypes = {
|
Torrent.propTypes = {
|
||||||
removeTorrent: PropTypes.func.isRequired,
|
removeTorrent: PropTypes.func.isRequired,
|
||||||
data: PropTypes.instanceOf(Map),
|
data: PropTypes.instanceOf(Map)
|
||||||
};
|
};
|
||||||
|
@ -9,9 +9,9 @@ import { OverlayTrigger, Tooltip } from "react-bootstrap";
|
|||||||
|
|
||||||
import { prettySize } from "../../utils";
|
import { prettySize } from "../../utils";
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = state => ({
|
||||||
searching: state.torrentStore.get("searching"),
|
searching: state.torrentStore.get("searching"),
|
||||||
results: state.torrentStore.get("searchResults"),
|
results: state.torrentStore.get("searchResults")
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = { addTorrent, searchTorrents };
|
const mapDispatchToProps = { addTorrent, searchTorrents };
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ const TorrentSearch = ({
|
|||||||
results,
|
results,
|
||||||
addTorrent,
|
addTorrent,
|
||||||
history,
|
history,
|
||||||
match,
|
match
|
||||||
}) => {
|
}) => {
|
||||||
const [search, setSearch] = useState(match.params.search || "");
|
const [search, setSearch] = useState(match.params.search || "");
|
||||||
const [type, setType] = useState(match.params.type || "");
|
const [type, setType] = useState(match.params.type || "");
|
||||||
@ -52,7 +52,7 @@ const TorrentSearch = ({
|
|||||||
className="form-control mb-1 w-100 form-control-lg"
|
className="form-control mb-1 w-100 form-control-lg"
|
||||||
placeholder="Search torrents"
|
placeholder="Search torrents"
|
||||||
value={search}
|
value={search}
|
||||||
onChange={(e) => setSearch(e.target.value)}
|
onChange={e => setSearch(e.target.value)}
|
||||||
/>
|
/>
|
||||||
<div className="mb-3 w-100 d-flex">
|
<div className="mb-3 w-100 d-flex">
|
||||||
<SearchButton
|
<SearchButton
|
||||||
@ -93,10 +93,10 @@ TorrentSearch.propTypes = {
|
|||||||
match: PropTypes.object,
|
match: PropTypes.object,
|
||||||
history: PropTypes.object,
|
history: PropTypes.object,
|
||||||
addTorrent: PropTypes.func.isRequired,
|
addTorrent: PropTypes.func.isRequired,
|
||||||
searchTorrents: PropTypes.func.isRequired,
|
searchTorrents: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
const SearchButton = (props) => {
|
const SearchButton = props => {
|
||||||
const variant = props.type === props.typeFromURL ? "primary" : "secondary";
|
const variant = props.type === props.typeFromURL ? "primary" : "secondary";
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
@ -112,10 +112,10 @@ SearchButton.propTypes = {
|
|||||||
type: PropTypes.string,
|
type: PropTypes.string,
|
||||||
typeFromURL: PropTypes.string,
|
typeFromURL: PropTypes.string,
|
||||||
text: PropTypes.string,
|
text: PropTypes.string,
|
||||||
handleClick: PropTypes.func.isRequired,
|
handleClick: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
const TorrentList = (props) => {
|
const TorrentList = props => {
|
||||||
if (props.searching) {
|
if (props.searching) {
|
||||||
return <Loader />;
|
return <Loader />;
|
||||||
}
|
}
|
||||||
@ -144,10 +144,10 @@ TorrentList.propTypes = {
|
|||||||
searching: PropTypes.bool.isRequired,
|
searching: PropTypes.bool.isRequired,
|
||||||
results: PropTypes.instanceOf(List),
|
results: PropTypes.instanceOf(List),
|
||||||
searchFromURL: PropTypes.string,
|
searchFromURL: PropTypes.string,
|
||||||
addTorrent: PropTypes.func.isRequired,
|
addTorrent: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
const Torrent = (props) => (
|
const Torrent = props => (
|
||||||
<div className="alert d-flex border-bottom border-secondary align-items-center">
|
<div className="alert d-flex border-bottom border-secondary align-items-center">
|
||||||
<TorrentHealth
|
<TorrentHealth
|
||||||
url={props.data.get("url")}
|
url={props.data.get("url")}
|
||||||
@ -184,10 +184,10 @@ const Torrent = (props) => (
|
|||||||
);
|
);
|
||||||
Torrent.propTypes = {
|
Torrent.propTypes = {
|
||||||
data: PropTypes.instanceOf(Map),
|
data: PropTypes.instanceOf(Map),
|
||||||
addTorrent: PropTypes.func.isRequired,
|
addTorrent: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
const TorrentHealth = (props) => {
|
const TorrentHealth = props => {
|
||||||
const seeders = props.seeders || 0;
|
const seeders = props.seeders || 0;
|
||||||
const leechers = props.leechers || 1;
|
const leechers = props.leechers || 1;
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ const TorrentHealth = (props) => {
|
|||||||
TorrentHealth.propTypes = {
|
TorrentHealth.propTypes = {
|
||||||
url: PropTypes.string,
|
url: PropTypes.string,
|
||||||
seeders: PropTypes.number,
|
seeders: PropTypes.number,
|
||||||
leechers: PropTypes.number,
|
leechers: PropTypes.number
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(TorrentSearch);
|
export default connect(mapStateToProps, mapDispatchToProps)(TorrentSearch);
|
||||||
|
@ -3,12 +3,12 @@ import PropTypes from "prop-types";
|
|||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { Redirect, Link } from "react-router-dom";
|
import { Redirect, Link } from "react-router-dom";
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = state => ({
|
||||||
isActivated: state.userStore.get("isActivated"),
|
isActivated: state.userStore.get("isActivated"),
|
||||||
isLogged: state.userStore.get("isLogged"),
|
isLogged: state.userStore.get("isLogged")
|
||||||
});
|
});
|
||||||
|
|
||||||
const UserActivation = (props) => {
|
const UserActivation = props => {
|
||||||
if (!props.isLogged) {
|
if (!props.isLogged) {
|
||||||
return <Redirect to="/users/login" />;
|
return <Redirect to="/users/login" />;
|
||||||
}
|
}
|
||||||
@ -33,7 +33,7 @@ const UserActivation = (props) => {
|
|||||||
};
|
};
|
||||||
UserActivation.propTypes = {
|
UserActivation.propTypes = {
|
||||||
isActivated: PropTypes.bool.isRequired,
|
isActivated: PropTypes.bool.isRequired,
|
||||||
isLogged: PropTypes.bool.isRequired,
|
isLogged: PropTypes.bool.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps)(UserActivation);
|
export default connect(mapStateToProps)(UserActivation);
|
||||||
|
@ -9,17 +9,17 @@ import { getPolochons } from "../../actions/polochon";
|
|||||||
|
|
||||||
import { PolochonSelect } from "../polochons/select";
|
import { PolochonSelect } from "../polochons/select";
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = state => ({
|
||||||
loading: state.userStore.get("loading"),
|
loading: state.userStore.get("loading"),
|
||||||
publicPolochons: state.polochon.get("public"),
|
publicPolochons: state.polochon.get("public"),
|
||||||
polochonId: state.userStore.get("polochonId"),
|
polochonId: state.userStore.get("polochonId"),
|
||||||
polochonActivated: state.userStore.get("polochonActivated"),
|
polochonActivated: state.userStore.get("polochonActivated")
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
const mapDispatchToProps = {
|
||||||
updateUser,
|
updateUser,
|
||||||
getPolochons,
|
getPolochons,
|
||||||
getUserInfos,
|
getUserInfos
|
||||||
};
|
};
|
||||||
|
|
||||||
const UserEditConnect = ({
|
const UserEditConnect = ({
|
||||||
@ -29,7 +29,7 @@ const UserEditConnect = ({
|
|||||||
updateUser,
|
updateUser,
|
||||||
getPolochons,
|
getPolochons,
|
||||||
getUserInfos,
|
getUserInfos,
|
||||||
publicPolochons,
|
publicPolochons
|
||||||
}) => {
|
}) => {
|
||||||
const [id, setId] = useState(polochonId);
|
const [id, setId] = useState(polochonId);
|
||||||
const [password, setPassword] = useState("");
|
const [password, setPassword] = useState("");
|
||||||
@ -44,12 +44,12 @@ const UserEditConnect = ({
|
|||||||
setId(polochonId);
|
setId(polochonId);
|
||||||
}, [polochonId]);
|
}, [polochonId]);
|
||||||
|
|
||||||
const handleSubmit = (ev) => {
|
const handleSubmit = ev => {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
updateUser({
|
updateUser({
|
||||||
password: password,
|
password: password,
|
||||||
password_confirm: passwordConfirm, // eslint-disable-line camelcase
|
password_confirm: passwordConfirm, // eslint-disable-line camelcase
|
||||||
polochon_id: id, // eslint-disable-line camelcase
|
polochon_id: id // eslint-disable-line camelcase
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ const UserEditConnect = ({
|
|||||||
<div className="col-12 col-md-8 offset-md-2">
|
<div className="col-12 col-md-8 offset-md-2">
|
||||||
<h2>Edit user</h2>
|
<h2>Edit user</h2>
|
||||||
<hr />
|
<hr />
|
||||||
<form className="form-horizontal" onSubmit={(ev) => handleSubmit(ev)}>
|
<form className="form-horizontal" onSubmit={ev => handleSubmit(ev)}>
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label className="control-label">
|
<label className="control-label">
|
||||||
Polochon
|
Polochon
|
||||||
@ -88,7 +88,7 @@ const UserEditConnect = ({
|
|||||||
type="password"
|
type="password"
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
value={password}
|
value={password}
|
||||||
onChange={(e) => setPassword(e.target.value)}
|
onChange={e => setPassword(e.target.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ const UserEditConnect = ({
|
|||||||
type="password"
|
type="password"
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
value={passwordConfirm}
|
value={passwordConfirm}
|
||||||
onChange={(e) => setPasswordConfirm(e.target.value)}
|
onChange={e => setPasswordConfirm(e.target.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ UserEditConnect.propTypes = {
|
|||||||
updateUser: PropTypes.func,
|
updateUser: PropTypes.func,
|
||||||
getPolochons: PropTypes.func,
|
getPolochons: PropTypes.func,
|
||||||
getUserInfos: PropTypes.func,
|
getUserInfos: PropTypes.func,
|
||||||
publicPolochons: PropTypes.instanceOf(List),
|
publicPolochons: PropTypes.instanceOf(List)
|
||||||
};
|
};
|
||||||
|
|
||||||
export const UserEdit = connect(
|
export const UserEdit = connect(
|
||||||
|
@ -5,18 +5,18 @@ import { Redirect, Link } from "react-router-dom";
|
|||||||
|
|
||||||
import { loginUser } from "../../actions/users";
|
import { loginUser } from "../../actions/users";
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = state => ({
|
||||||
isLogged: state.userStore.get("isLogged"),
|
isLogged: state.userStore.get("isLogged"),
|
||||||
isLoading: state.userStore.get("loading"),
|
isLoading: state.userStore.get("loading"),
|
||||||
error: state.userStore.get("error"),
|
error: state.userStore.get("error")
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = { loginUser };
|
const mapDispatchToProps = { loginUser };
|
||||||
|
|
||||||
const UserLoginForm = (props) => {
|
const UserLoginForm = props => {
|
||||||
const [username, setUsername] = useState("");
|
const [username, setUsername] = useState("");
|
||||||
const [password, setPassword] = useState("");
|
const [password, setPassword] = useState("");
|
||||||
|
|
||||||
const handleSubmit = (e) => {
|
const handleSubmit = e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (!props.isLoading) {
|
if (!props.isLoading) {
|
||||||
props.loginUser(username, password);
|
props.loginUser(username, password);
|
||||||
@ -35,7 +35,7 @@ const UserLoginForm = (props) => {
|
|||||||
{props.error && props.error !== "" && (
|
{props.error && props.error !== "" && (
|
||||||
<div className="alert alert-danger">{props.error}</div>
|
<div className="alert alert-danger">{props.error}</div>
|
||||||
)}
|
)}
|
||||||
<form className="form-horizontal" onSubmit={(e) => handleSubmit(e)}>
|
<form className="form-horizontal" onSubmit={e => handleSubmit(e)}>
|
||||||
<div>
|
<div>
|
||||||
<label>Username</label>
|
<label>Username</label>
|
||||||
<br />
|
<br />
|
||||||
@ -44,7 +44,7 @@ const UserLoginForm = (props) => {
|
|||||||
type="username"
|
type="username"
|
||||||
autoFocus
|
autoFocus
|
||||||
value={username}
|
value={username}
|
||||||
onChange={(e) => setUsername(e.target.value)}
|
onChange={e => setUsername(e.target.value)}
|
||||||
/>
|
/>
|
||||||
<p></p>
|
<p></p>
|
||||||
</div>
|
</div>
|
||||||
@ -56,7 +56,7 @@ const UserLoginForm = (props) => {
|
|||||||
type="password"
|
type="password"
|
||||||
autoComplete="new-password"
|
autoComplete="new-password"
|
||||||
value={password}
|
value={password}
|
||||||
onChange={(e) => setPassword(e.target.value)}
|
onChange={e => setPassword(e.target.value)}
|
||||||
/>
|
/>
|
||||||
<p></p>
|
<p></p>
|
||||||
</div>
|
</div>
|
||||||
@ -91,7 +91,7 @@ UserLoginForm.propTypes = {
|
|||||||
loginUser: PropTypes.func.isRequired,
|
loginUser: PropTypes.func.isRequired,
|
||||||
isLoading: PropTypes.bool.isRequired,
|
isLoading: PropTypes.bool.isRequired,
|
||||||
isLogged: PropTypes.bool.isRequired,
|
isLogged: PropTypes.bool.isRequired,
|
||||||
error: PropTypes.string,
|
error: PropTypes.string
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(UserLoginForm);
|
export default connect(mapStateToProps, mapDispatchToProps)(UserLoginForm);
|
||||||
|
@ -5,12 +5,12 @@ import { Redirect } from "react-router-dom";
|
|||||||
|
|
||||||
import { userLogout } from "../../actions/users";
|
import { userLogout } from "../../actions/users";
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = state => ({
|
||||||
isLogged: state.userStore.get("isLogged"),
|
isLogged: state.userStore.get("isLogged")
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = { userLogout };
|
const mapDispatchToProps = { userLogout };
|
||||||
|
|
||||||
const UserLogout = (props) => {
|
const UserLogout = props => {
|
||||||
if (props.isLogged) {
|
if (props.isLogged) {
|
||||||
props.userLogout();
|
props.userLogout();
|
||||||
}
|
}
|
||||||
@ -20,7 +20,7 @@ const UserLogout = (props) => {
|
|||||||
UserLogout.propTypes = {
|
UserLogout.propTypes = {
|
||||||
isLogged: PropTypes.bool.isRequired,
|
isLogged: PropTypes.bool.isRequired,
|
||||||
userLogout: PropTypes.func.isRequired,
|
userLogout: PropTypes.func.isRequired,
|
||||||
history: PropTypes.object,
|
history: PropTypes.object
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(UserLogout);
|
export default connect(mapStateToProps, mapDispatchToProps)(UserLogout);
|
||||||
|
@ -9,9 +9,9 @@ import { UserEdit } from "./edit";
|
|||||||
import { getUserModules } from "../../actions/users";
|
import { getUserModules } from "../../actions/users";
|
||||||
import Modules from "../modules/modules";
|
import Modules from "../modules/modules";
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = state => ({
|
||||||
modules: state.userStore.get("modules"),
|
modules: state.userStore.get("modules"),
|
||||||
modulesLoading: state.userStore.get("modulesLoading"),
|
modulesLoading: state.userStore.get("modulesLoading")
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = { getUserModules };
|
const mapDispatchToProps = { getUserModules };
|
||||||
@ -32,7 +32,7 @@ const UserProfile = ({ modules, modulesLoading, getUserModules }) => {
|
|||||||
UserProfile.propTypes = {
|
UserProfile.propTypes = {
|
||||||
getUserModules: PropTypes.func.isRequired,
|
getUserModules: PropTypes.func.isRequired,
|
||||||
modules: PropTypes.instanceOf(Map),
|
modules: PropTypes.instanceOf(Map),
|
||||||
modulesLoading: PropTypes.bool.isRequired,
|
modulesLoading: PropTypes.bool.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(UserProfile);
|
export default connect(mapStateToProps, mapDispatchToProps)(UserProfile);
|
||||||
|
@ -5,14 +5,14 @@ import { Redirect } from "react-router-dom";
|
|||||||
|
|
||||||
import { userSignUp } from "../../actions/users";
|
import { userSignUp } from "../../actions/users";
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = state => ({
|
||||||
isLogged: state.userStore.get("isLogged"),
|
isLogged: state.userStore.get("isLogged"),
|
||||||
isLoading: state.userStore.get("loading"),
|
isLoading: state.userStore.get("loading"),
|
||||||
error: state.userStore.get("error"),
|
error: state.userStore.get("error")
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = { userSignUp };
|
const mapDispatchToProps = { userSignUp };
|
||||||
|
|
||||||
const UserSignUp = (props) => {
|
const UserSignUp = props => {
|
||||||
const [username, setUsername] = useState("");
|
const [username, setUsername] = useState("");
|
||||||
const [password, setPassword] = useState("");
|
const [password, setPassword] = useState("");
|
||||||
const [passwordConfirm, setPasswordConfirm] = useState("");
|
const [passwordConfirm, setPasswordConfirm] = useState("");
|
||||||
@ -21,12 +21,12 @@ const UserSignUp = (props) => {
|
|||||||
return <Redirect to="/" />;
|
return <Redirect to="/" />;
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSubmit = (e) => {
|
const handleSubmit = e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
props.userSignUp({
|
props.userSignUp({
|
||||||
username: username,
|
username: username,
|
||||||
password: password,
|
password: password,
|
||||||
password_confirm: passwordConfirm, // eslint-disable-line camelcase
|
password_confirm: passwordConfirm // eslint-disable-line camelcase
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -39,14 +39,14 @@ const UserSignUp = (props) => {
|
|||||||
<div className="alert alert-danger">{props.error}</div>
|
<div className="alert alert-danger">{props.error}</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<form className="form-horizontal" onSubmit={(e) => handleSubmit(e)}>
|
<form className="form-horizontal" onSubmit={e => handleSubmit(e)}>
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label className="control-label">Username</label>
|
<label className="control-label">Username</label>
|
||||||
<input
|
<input
|
||||||
autoFocus="autofocus"
|
autoFocus="autofocus"
|
||||||
className="form-control"
|
className="form-control"
|
||||||
value={username}
|
value={username}
|
||||||
onChange={(e) => setUsername(e.target.value)}
|
onChange={e => setUsername(e.target.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ const UserSignUp = (props) => {
|
|||||||
className="form-control"
|
className="form-control"
|
||||||
type="password"
|
type="password"
|
||||||
value={password}
|
value={password}
|
||||||
onChange={(e) => setPassword(e.target.value)}
|
onChange={e => setPassword(e.target.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ const UserSignUp = (props) => {
|
|||||||
className="form-control"
|
className="form-control"
|
||||||
type="password"
|
type="password"
|
||||||
value={passwordConfirm}
|
value={passwordConfirm}
|
||||||
onChange={(e) => setPasswordConfirm(e.target.value)}
|
onChange={e => setPasswordConfirm(e.target.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@ -94,7 +94,7 @@ UserSignUp.propTypes = {
|
|||||||
isLogged: PropTypes.bool.isRequired,
|
isLogged: PropTypes.bool.isRequired,
|
||||||
isLoading: PropTypes.bool.isRequired,
|
isLoading: PropTypes.bool.isRequired,
|
||||||
userSignUp: PropTypes.func.isRequired,
|
userSignUp: PropTypes.func.isRequired,
|
||||||
error: PropTypes.string,
|
error: PropTypes.string
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(UserSignUp);
|
export default connect(mapStateToProps, mapDispatchToProps)(UserSignUp);
|
||||||
|
@ -7,12 +7,12 @@ import { Map, List } from "immutable";
|
|||||||
|
|
||||||
import { getUserTokens, deleteUserToken } from "../../actions/users";
|
import { getUserTokens, deleteUserToken } from "../../actions/users";
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = state => ({
|
||||||
tokens: state.userStore.get("tokens"),
|
tokens: state.userStore.get("tokens")
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = { getUserTokens, deleteUserToken };
|
const mapDispatchToProps = { getUserTokens, deleteUserToken };
|
||||||
|
|
||||||
const UserTokens = (props) => {
|
const UserTokens = props => {
|
||||||
const [fetched, setIsFetched] = useState(false);
|
const [fetched, setIsFetched] = useState(false);
|
||||||
if (!fetched) {
|
if (!fetched) {
|
||||||
props.getUserTokens();
|
props.getUserTokens();
|
||||||
@ -33,10 +33,10 @@ UserTokens.propTypes = {
|
|||||||
tokens: PropTypes.instanceOf(List),
|
tokens: PropTypes.instanceOf(List),
|
||||||
isLoading: PropTypes.bool,
|
isLoading: PropTypes.bool,
|
||||||
getUserTokens: PropTypes.func.isRequired,
|
getUserTokens: PropTypes.func.isRequired,
|
||||||
deleteUserToken: PropTypes.func.isRequired,
|
deleteUserToken: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
const Token = (props) => {
|
const Token = props => {
|
||||||
const ua = UAParser(props.data.get("user_agent"));
|
const ua = UAParser(props.data.get("user_agent"));
|
||||||
return (
|
return (
|
||||||
<div className="card mt-3">
|
<div className="card mt-3">
|
||||||
@ -69,10 +69,10 @@ const Token = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
Token.propTypes = {
|
Token.propTypes = {
|
||||||
data: PropTypes.instanceOf(Map).isRequired,
|
data: PropTypes.instanceOf(Map).isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
const Actions = (props) => {
|
const Actions = props => {
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
props.deleteToken(props.data.get("token"));
|
props.deleteToken(props.data.get("token"));
|
||||||
};
|
};
|
||||||
@ -86,7 +86,7 @@ const Actions = (props) => {
|
|||||||
};
|
};
|
||||||
Actions.propTypes = {
|
Actions.propTypes = {
|
||||||
data: PropTypes.instanceOf(Map).isRequired,
|
data: PropTypes.instanceOf(Map).isRequired,
|
||||||
deleteToken: PropTypes.func.isRequired,
|
deleteToken: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
const Logo = ({ ua, device, browser }) => {
|
const Logo = ({ ua, device, browser }) => {
|
||||||
@ -120,7 +120,7 @@ const Logo = ({ ua, device, browser }) => {
|
|||||||
Logo.propTypes = {
|
Logo.propTypes = {
|
||||||
ua: PropTypes.string,
|
ua: PropTypes.string,
|
||||||
device: PropTypes.object,
|
device: PropTypes.object,
|
||||||
browser: PropTypes.object,
|
browser: PropTypes.object
|
||||||
};
|
};
|
||||||
|
|
||||||
const OS = ({ name, version }) => {
|
const OS = ({ name, version }) => {
|
||||||
@ -138,7 +138,7 @@ const OS = ({ name, version }) => {
|
|||||||
};
|
};
|
||||||
OS.propTypes = {
|
OS.propTypes = {
|
||||||
name: PropTypes.string,
|
name: PropTypes.string,
|
||||||
version: PropTypes.string,
|
version: PropTypes.string
|
||||||
};
|
};
|
||||||
|
|
||||||
const Device = ({ model }) => {
|
const Device = ({ model }) => {
|
||||||
@ -151,7 +151,7 @@ const Device = ({ model }) => {
|
|||||||
return <span> {deviceName}</span>;
|
return <span> {deviceName}</span>;
|
||||||
};
|
};
|
||||||
Device.propTypes = {
|
Device.propTypes = {
|
||||||
model: PropTypes.string,
|
model: PropTypes.string
|
||||||
};
|
};
|
||||||
|
|
||||||
const Browser = ({ name, version }) => {
|
const Browser = ({ name, version }) => {
|
||||||
@ -168,7 +168,7 @@ const Browser = ({ name, version }) => {
|
|||||||
};
|
};
|
||||||
Browser.propTypes = {
|
Browser.propTypes = {
|
||||||
name: PropTypes.string,
|
name: PropTypes.string,
|
||||||
version: PropTypes.string,
|
version: PropTypes.string
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(UserTokens);
|
export default connect(mapStateToProps, mapDispatchToProps)(UserTokens);
|
||||||
|
@ -5,20 +5,20 @@ import { setFetchedTorrents } from "../actions/torrents";
|
|||||||
import { newMovieEvent } from "../actions/movies";
|
import { newMovieEvent } from "../actions/movies";
|
||||||
import { newEpisodeEvent } from "../actions/shows";
|
import { newEpisodeEvent } from "../actions/shows";
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = state => ({
|
||||||
isLogged: state.userStore.get("isLogged"),
|
isLogged: state.userStore.get("isLogged")
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = {
|
const mapDispatchToProps = {
|
||||||
setFetchedTorrents,
|
setFetchedTorrents,
|
||||||
newMovieEvent,
|
newMovieEvent,
|
||||||
newEpisodeEvent,
|
newEpisodeEvent
|
||||||
};
|
};
|
||||||
|
|
||||||
const WsHandler = ({
|
const WsHandler = ({
|
||||||
isLogged,
|
isLogged,
|
||||||
setFetchedTorrents,
|
setFetchedTorrents,
|
||||||
newMovieEvent,
|
newMovieEvent,
|
||||||
newEpisodeEvent,
|
newEpisodeEvent
|
||||||
}) => {
|
}) => {
|
||||||
const [ws, setWs] = useState(null);
|
const [ws, setWs] = useState(null);
|
||||||
|
|
||||||
@ -45,18 +45,18 @@ const WsHandler = ({
|
|||||||
socket.send(
|
socket.send(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
type: "subscribe",
|
type: "subscribe",
|
||||||
message: "torrents",
|
message: "torrents"
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
socket.send(
|
socket.send(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
type: "subscribe",
|
type: "subscribe",
|
||||||
message: "newVideo",
|
message: "newVideo"
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
socket.onmessage = (event) => {
|
socket.onmessage = event => {
|
||||||
if (!event.data) {
|
if (!event.data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ WsHandler.propTypes = {
|
|||||||
isLogged: PropTypes.bool.isRequired,
|
isLogged: PropTypes.bool.isRequired,
|
||||||
setFetchedTorrents: PropTypes.func,
|
setFetchedTorrents: PropTypes.func,
|
||||||
newMovieEvent: PropTypes.func,
|
newMovieEvent: PropTypes.func,
|
||||||
newEpisodeEvent: PropTypes.func,
|
newEpisodeEvent: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(WsHandler);
|
export default connect(mapStateToProps, mapDispatchToProps)(WsHandler);
|
||||||
|
@ -4,7 +4,7 @@ export const defaultState = Map({
|
|||||||
fetchingModules: false,
|
fetchingModules: false,
|
||||||
users: List(),
|
users: List(),
|
||||||
stats: Map({}),
|
stats: Map({}),
|
||||||
modules: Map({}),
|
modules: Map({})
|
||||||
});
|
});
|
||||||
|
|
||||||
const handlers = {
|
const handlers = {
|
||||||
@ -12,14 +12,14 @@ const handlers = {
|
|||||||
state.set("users", fromJS(action.payload.response.data)),
|
state.set("users", fromJS(action.payload.response.data)),
|
||||||
ADMIN_GET_STATS_FULFILLED: (state, action) =>
|
ADMIN_GET_STATS_FULFILLED: (state, action) =>
|
||||||
state.set("stats", fromJS(action.payload.response.data)),
|
state.set("stats", fromJS(action.payload.response.data)),
|
||||||
ADMIN_GET_MODULES_PENDING: (state) => state.set("fetchingModules", true),
|
ADMIN_GET_MODULES_PENDING: state => state.set("fetchingModules", true),
|
||||||
ADMIN_GET_MODULES_FULFILLED: (state, action) =>
|
ADMIN_GET_MODULES_FULFILLED: (state, action) =>
|
||||||
state.merge(
|
state.merge(
|
||||||
fromJS({
|
fromJS({
|
||||||
modules: action.payload.response.data,
|
modules: action.payload.response.data,
|
||||||
fetchingModules: false,
|
fetchingModules: false
|
||||||
})
|
})
|
||||||
),
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (state = defaultState, action) =>
|
export default (state = defaultState, action) =>
|
||||||
|
@ -3,7 +3,7 @@ import { Map } from "immutable";
|
|||||||
const defaultState = Map({
|
const defaultState = Map({
|
||||||
show: false,
|
show: false,
|
||||||
message: "",
|
message: "",
|
||||||
type: "",
|
type: ""
|
||||||
});
|
});
|
||||||
|
|
||||||
const handlers = {
|
const handlers = {
|
||||||
@ -12,7 +12,7 @@ const handlers = {
|
|||||||
Map({
|
Map({
|
||||||
message: action.payload.message,
|
message: action.payload.message,
|
||||||
show: true,
|
show: true,
|
||||||
type: "error",
|
type: "error"
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
ADD_ALERT_OK: (state, action) =>
|
ADD_ALERT_OK: (state, action) =>
|
||||||
@ -20,17 +20,17 @@ const handlers = {
|
|||||||
Map({
|
Map({
|
||||||
message: action.payload.message,
|
message: action.payload.message,
|
||||||
show: true,
|
show: true,
|
||||||
type: "success",
|
type: "success"
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
DISMISS_ALERT: (state) =>
|
DISMISS_ALERT: state =>
|
||||||
state.merge(
|
state.merge(
|
||||||
Map({
|
Map({
|
||||||
message: "",
|
message: "",
|
||||||
show: false,
|
show: false,
|
||||||
type: "",
|
type: ""
|
||||||
})
|
})
|
||||||
),
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (state = defaultState, action) =>
|
export default (state = defaultState, action) =>
|
||||||
|
@ -19,5 +19,5 @@ export default combineReducers({
|
|||||||
torrentStore,
|
torrentStore,
|
||||||
adminStore,
|
adminStore,
|
||||||
polochon,
|
polochon,
|
||||||
notifications,
|
notifications
|
||||||
});
|
});
|
||||||
|
@ -6,12 +6,12 @@ const defaultState = Map({
|
|||||||
filter: "",
|
filter: "",
|
||||||
selectedImdbId: "",
|
selectedImdbId: "",
|
||||||
lastFetchUrl: "",
|
lastFetchUrl: "",
|
||||||
exploreOptions: Map(),
|
exploreOptions: Map()
|
||||||
});
|
});
|
||||||
|
|
||||||
const handlers = {
|
const handlers = {
|
||||||
MOVIE_LIST_FETCH_PENDING: (state) => state.set("loading", true),
|
MOVIE_LIST_FETCH_PENDING: state => state.set("loading", true),
|
||||||
MOVIE_LIST_FETCH_ERROR: (state) => state.set("loading", false),
|
MOVIE_LIST_FETCH_ERROR: state => state.set("loading", false),
|
||||||
MOVIE_LIST_FETCH_FULFILLED: (state, action) => {
|
MOVIE_LIST_FETCH_FULFILLED: (state, action) => {
|
||||||
let allMoviesInPolochon = true;
|
let allMoviesInPolochon = true;
|
||||||
let movies = Map();
|
let movies = Map();
|
||||||
@ -46,7 +46,7 @@ const handlers = {
|
|||||||
movies: movies,
|
movies: movies,
|
||||||
filter: "",
|
filter: "",
|
||||||
loading: false,
|
loading: false,
|
||||||
selectedImdbId: selectedImdbId,
|
selectedImdbId: selectedImdbId
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -93,7 +93,7 @@ const handlers = {
|
|||||||
SELECT_MOVIE: (state, action) =>
|
SELECT_MOVIE: (state, action) =>
|
||||||
state.set("selectedImdbId", action.payload.imdbId),
|
state.set("selectedImdbId", action.payload.imdbId),
|
||||||
MOVIE_UPDATE_FILTER: (state, action) =>
|
MOVIE_UPDATE_FILTER: (state, action) =>
|
||||||
state.set("filter", action.payload.filter),
|
state.set("filter", action.payload.filter)
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (state = defaultState, action) =>
|
export default (state = defaultState, action) =>
|
||||||
|
@ -6,12 +6,14 @@ const handlers = {
|
|||||||
ADD_NOTIFICATION: (state, action) =>
|
ADD_NOTIFICATION: (state, action) =>
|
||||||
state.push(
|
state.push(
|
||||||
fromJS({
|
fromJS({
|
||||||
id: Math.random().toString(36).substring(7),
|
id: Math.random()
|
||||||
...action.payload,
|
.toString(36)
|
||||||
|
.substring(7),
|
||||||
|
...action.payload
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
REMOVE_NOTIFICATION: (state, action) =>
|
REMOVE_NOTIFICATION: (state, action) =>
|
||||||
state.filter((e) => e.get("id") !== action.payload.id),
|
state.filter(e => e.get("id") !== action.payload.id)
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (state = defaultState, action) =>
|
export default (state = defaultState, action) =>
|
||||||
|
@ -4,26 +4,25 @@ const defaultState = Map({
|
|||||||
loadingPublic: false,
|
loadingPublic: false,
|
||||||
loadingManaged: false,
|
loadingManaged: false,
|
||||||
public: List(),
|
public: List(),
|
||||||
managed: List(),
|
managed: List()
|
||||||
});
|
});
|
||||||
|
|
||||||
const handlers = {
|
const handlers = {
|
||||||
PUBLIC_POLOCHON_LIST_FETCH_PENDING: (state) =>
|
PUBLIC_POLOCHON_LIST_FETCH_PENDING: state => state.set("loadingPublic", true),
|
||||||
state.set("loadingPublic", true),
|
|
||||||
PUBLIC_POLOCHON_LIST_FETCH_FULFILLED: (state, action) => {
|
PUBLIC_POLOCHON_LIST_FETCH_FULFILLED: (state, action) => {
|
||||||
return state.merge({
|
return state.merge({
|
||||||
loadingPublic: false,
|
loadingPublic: false,
|
||||||
public: List(fromJS(action.payload.response.data)),
|
public: List(fromJS(action.payload.response.data))
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
MANAGED_POLOCHON_LIST_FETCH_PENDING: (state) =>
|
MANAGED_POLOCHON_LIST_FETCH_PENDING: state =>
|
||||||
state.set("loadingManaged", true),
|
state.set("loadingManaged", true),
|
||||||
MANAGED_POLOCHON_LIST_FETCH_FULFILLED: (state, action) => {
|
MANAGED_POLOCHON_LIST_FETCH_FULFILLED: (state, action) => {
|
||||||
return state.merge({
|
return state.merge({
|
||||||
loadingManaged: false,
|
loadingManaged: false,
|
||||||
managed: List(fromJS(action.payload.response.data)),
|
managed: List(fromJS(action.payload.response.data))
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (state = defaultState, action) =>
|
export default (state = defaultState, action) =>
|
||||||
|
@ -3,12 +3,12 @@ import { OrderedMap, Map, fromJS } from "immutable";
|
|||||||
const defaultState = Map({
|
const defaultState = Map({
|
||||||
loading: false,
|
loading: false,
|
||||||
show: Map({
|
show: Map({
|
||||||
seasons: OrderedMap(),
|
seasons: OrderedMap()
|
||||||
}),
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
const handlers = {
|
const handlers = {
|
||||||
SHOW_FETCH_DETAILS_PENDING: (state) => state.set("loading", true),
|
SHOW_FETCH_DETAILS_PENDING: state => state.set("loading", true),
|
||||||
SHOW_FETCH_DETAILS_FULFILLED: (state, action) =>
|
SHOW_FETCH_DETAILS_FULFILLED: (state, action) =>
|
||||||
sortEpisodes(state, action.payload.response.data),
|
sortEpisodes(state, action.payload.response.data),
|
||||||
SHOW_UPDATE_STORE_WISHLIST: (state, action) => {
|
SHOW_UPDATE_STORE_WISHLIST: (state, action) => {
|
||||||
@ -16,8 +16,8 @@ const handlers = {
|
|||||||
fromJS({
|
fromJS({
|
||||||
show: {
|
show: {
|
||||||
tracked_season: action.payload.season, // eslint-disable-line camelcase
|
tracked_season: action.payload.season, // eslint-disable-line camelcase
|
||||||
tracked_episode: action.payload.episode, // eslint-disable-line camelcase
|
tracked_episode: action.payload.episode // eslint-disable-line camelcase
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -28,7 +28,7 @@ const handlers = {
|
|||||||
"seasons",
|
"seasons",
|
||||||
action.payload.main.season,
|
action.payload.main.season,
|
||||||
action.payload.main.episode,
|
action.payload.main.episode,
|
||||||
"fetching",
|
"fetching"
|
||||||
],
|
],
|
||||||
true
|
true
|
||||||
),
|
),
|
||||||
@ -50,7 +50,7 @@ const handlers = {
|
|||||||
"seasons",
|
"seasons",
|
||||||
action.payload.main.season,
|
action.payload.main.season,
|
||||||
action.payload.main.episode,
|
action.payload.main.episode,
|
||||||
"fetchingSubtitles",
|
"fetchingSubtitles"
|
||||||
],
|
],
|
||||||
true
|
true
|
||||||
),
|
),
|
||||||
@ -62,7 +62,7 @@ const handlers = {
|
|||||||
"seasons",
|
"seasons",
|
||||||
action.payload.main.season,
|
action.payload.main.season,
|
||||||
action.payload.main.episode,
|
action.payload.main.episode,
|
||||||
"subtitles",
|
"subtitles"
|
||||||
],
|
],
|
||||||
fromJS(action.payload.response.data)
|
fromJS(action.payload.response.data)
|
||||||
)
|
)
|
||||||
@ -72,10 +72,10 @@ const handlers = {
|
|||||||
"seasons",
|
"seasons",
|
||||||
action.payload.main.season,
|
action.payload.main.season,
|
||||||
action.payload.main.episode,
|
action.payload.main.episode,
|
||||||
"fetchingSubtitles",
|
"fetchingSubtitles"
|
||||||
],
|
],
|
||||||
false
|
false
|
||||||
),
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
const sortEpisodes = (state, show) => {
|
const sortEpisodes = (state, show) => {
|
||||||
|
@ -6,11 +6,11 @@ const defaultState = Map({
|
|||||||
filter: "",
|
filter: "",
|
||||||
selectedImdbId: "",
|
selectedImdbId: "",
|
||||||
lastFetchUrl: "",
|
lastFetchUrl: "",
|
||||||
exploreOptions: Map(),
|
exploreOptions: Map()
|
||||||
});
|
});
|
||||||
|
|
||||||
const handlers = {
|
const handlers = {
|
||||||
SHOW_LIST_FETCH_PENDING: (state) => state.set("loading", true),
|
SHOW_LIST_FETCH_PENDING: state => state.set("loading", true),
|
||||||
SHOW_LIST_FETCH_FULFILLED: (state, action) => {
|
SHOW_LIST_FETCH_FULFILLED: (state, action) => {
|
||||||
let shows = Map();
|
let shows = Map();
|
||||||
action.payload.response.data.map(function(show) {
|
action.payload.response.data.map(function(show) {
|
||||||
@ -31,7 +31,7 @@ const handlers = {
|
|||||||
shows: shows,
|
shows: shows,
|
||||||
filter: "",
|
filter: "",
|
||||||
loading: false,
|
loading: false,
|
||||||
selectedImdbId: selectedImdbId,
|
selectedImdbId: selectedImdbId
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -61,7 +61,7 @@ const handlers = {
|
|||||||
["shows", action.payload.imdbId],
|
["shows", action.payload.imdbId],
|
||||||
Map({
|
Map({
|
||||||
tracked_season: season,
|
tracked_season: season,
|
||||||
tracked_episode: episode,
|
tracked_episode: episode
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -70,7 +70,7 @@ const handlers = {
|
|||||||
SELECT_SHOW: (state, action) =>
|
SELECT_SHOW: (state, action) =>
|
||||||
state.set("selectedImdbId", action.payload.imdbId),
|
state.set("selectedImdbId", action.payload.imdbId),
|
||||||
SHOWS_UPDATE_FILTER: (state, action) =>
|
SHOWS_UPDATE_FILTER: (state, action) =>
|
||||||
state.set("filter", action.payload.filter),
|
state.set("filter", action.payload.filter)
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (state = defaultState, action) =>
|
export default (state = defaultState, action) =>
|
||||||
|
@ -4,26 +4,26 @@ const defaultState = Map({
|
|||||||
fetching: false,
|
fetching: false,
|
||||||
searching: false,
|
searching: false,
|
||||||
torrents: List(),
|
torrents: List(),
|
||||||
searchResults: List(),
|
searchResults: List()
|
||||||
});
|
});
|
||||||
|
|
||||||
const handlers = {
|
const handlers = {
|
||||||
TORRENTS_FETCH_PENDING: (state) => state.set("fetching", true),
|
TORRENTS_FETCH_PENDING: state => state.set("fetching", true),
|
||||||
TORRENTS_FETCH_FULFILLED: (state, action) =>
|
TORRENTS_FETCH_FULFILLED: (state, action) =>
|
||||||
state.merge(
|
state.merge(
|
||||||
fromJS({
|
fromJS({
|
||||||
fetching: false,
|
fetching: false,
|
||||||
torrents: action.payload.response.data,
|
torrents: action.payload.response.data
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
TORRENTS_SEARCH_PENDING: (state) => state.set("searching", true),
|
TORRENTS_SEARCH_PENDING: state => state.set("searching", true),
|
||||||
TORRENTS_SEARCH_FULFILLED: (state, action) =>
|
TORRENTS_SEARCH_FULFILLED: (state, action) =>
|
||||||
state.merge(
|
state.merge(
|
||||||
fromJS({
|
fromJS({
|
||||||
searching: false,
|
searching: false,
|
||||||
searchResults: action.payload.response.data,
|
searchResults: action.payload.response.data
|
||||||
})
|
})
|
||||||
),
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (state = defaultState, action) =>
|
export default (state = defaultState, action) =>
|
||||||
|
@ -18,7 +18,7 @@ const defaultState = Map({
|
|||||||
polochonActivated: false,
|
polochonActivated: false,
|
||||||
tokens: List(),
|
tokens: List(),
|
||||||
modules: Map(),
|
modules: Map(),
|
||||||
modulesLoading: false,
|
modulesLoading: false
|
||||||
});
|
});
|
||||||
|
|
||||||
let initialState = defaultState;
|
let initialState = defaultState;
|
||||||
@ -28,7 +28,7 @@ if (token && token !== "") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handlers = {
|
const handlers = {
|
||||||
USER_LOGIN_PENDING: (state) => state.set("loading", true),
|
USER_LOGIN_PENDING: state => state.set("loading", true),
|
||||||
USER_LOGIN_ERROR: (state, action) => {
|
USER_LOGIN_ERROR: (state, action) => {
|
||||||
state.set("loading", false);
|
state.set("loading", false);
|
||||||
return logoutUser(action.payload.response.message);
|
return logoutUser(action.payload.response.message);
|
||||||
@ -36,20 +36,20 @@ const handlers = {
|
|||||||
USER_LOGIN_FULFILLED: (state, action) => {
|
USER_LOGIN_FULFILLED: (state, action) => {
|
||||||
return updateFromToken(state, action.payload.response.data.token);
|
return updateFromToken(state, action.payload.response.data.token);
|
||||||
},
|
},
|
||||||
USER_SIGNUP_PENDING: (state) => state.set("loading", true),
|
USER_SIGNUP_PENDING: state => state.set("loading", true),
|
||||||
USER_SIGNUP_ERROR: (state, action) =>
|
USER_SIGNUP_ERROR: (state, action) =>
|
||||||
state.merge(
|
state.merge(
|
||||||
Map({
|
Map({
|
||||||
error: action.payload.response.message,
|
error: action.payload.response.message,
|
||||||
loading: false,
|
loading: false
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
USER_SIGNUP_FULFILLED: (state) =>
|
USER_SIGNUP_FULFILLED: state =>
|
||||||
state.merge(Map({ error: "", loading: false })),
|
state.merge(Map({ error: "", loading: false })),
|
||||||
USER_SET_TOKEN: (state, action) =>
|
USER_SET_TOKEN: (state, action) =>
|
||||||
updateFromToken(state, action.payload.token),
|
updateFromToken(state, action.payload.token),
|
||||||
USER_LOGOUT: () => logoutUser(),
|
USER_LOGOUT: () => logoutUser(),
|
||||||
GET_USER_PENDING: (state) => state.set("loading", true),
|
GET_USER_PENDING: state => state.set("loading", true),
|
||||||
GET_USER_FULFILLED: (state, action) =>
|
GET_USER_FULFILLED: (state, action) =>
|
||||||
state.merge(
|
state.merge(
|
||||||
Map({
|
Map({
|
||||||
@ -58,25 +58,25 @@ const handlers = {
|
|||||||
polochonName: action.payload.response.data.name,
|
polochonName: action.payload.response.data.name,
|
||||||
polochonId: action.payload.response.data.id,
|
polochonId: action.payload.response.data.id,
|
||||||
polochonActivated: action.payload.response.data.activated,
|
polochonActivated: action.payload.response.data.activated,
|
||||||
loading: false,
|
loading: false
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
GET_USER_TOKENS_PENDING: (state) => state.set("loading", true),
|
GET_USER_TOKENS_PENDING: state => state.set("loading", true),
|
||||||
GET_USER_TOKENS_FULFILLED: (state, action) =>
|
GET_USER_TOKENS_FULFILLED: (state, action) =>
|
||||||
state.merge(
|
state.merge(
|
||||||
Map({
|
Map({
|
||||||
tokens: fromJS(action.payload.response.data),
|
tokens: fromJS(action.payload.response.data),
|
||||||
loading: false,
|
loading: false
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
GET_USER_MODULES_PENDING: (state) => state.set("modulesLoading", true),
|
GET_USER_MODULES_PENDING: state => state.set("modulesLoading", true),
|
||||||
GET_USER_MODULES_FULFILLED: (state, action) =>
|
GET_USER_MODULES_FULFILLED: (state, action) =>
|
||||||
state.merge(
|
state.merge(
|
||||||
Map({
|
Map({
|
||||||
modules: fromJS(action.payload.response.data),
|
modules: fromJS(action.payload.response.data),
|
||||||
modulesLoading: false,
|
modulesLoading: false
|
||||||
})
|
})
|
||||||
),
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
function logoutUser(error) {
|
function logoutUser(error) {
|
||||||
@ -104,7 +104,7 @@ function updateFromToken(state, token) {
|
|||||||
isTokenSet: true,
|
isTokenSet: true,
|
||||||
isAdmin: decodedToken.isAdmin,
|
isAdmin: decodedToken.isAdmin,
|
||||||
isActivated: decodedToken.isActivated,
|
isActivated: decodedToken.isActivated,
|
||||||
username: decodedToken.username,
|
username: decodedToken.username
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ export function configureAxios(headers = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return axios.create({
|
return axios.create({
|
||||||
headers,
|
headers
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,26 +31,26 @@ export function request(
|
|||||||
dispatch({
|
dispatch({
|
||||||
type: pending,
|
type: pending,
|
||||||
payload: {
|
payload: {
|
||||||
main: mainPayload,
|
main: mainPayload
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return promise
|
return promise
|
||||||
.then((response) => {
|
.then(response => {
|
||||||
if (response.data.status === "error") {
|
if (response.data.status === "error") {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: "ADD_ALERT_ERROR",
|
type: "ADD_ALERT_ERROR",
|
||||||
payload: {
|
payload: {
|
||||||
message: response.data.message,
|
message: response.data.message,
|
||||||
main: mainPayload,
|
main: mainPayload
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
dispatch({
|
dispatch({
|
||||||
type: errored,
|
type: errored,
|
||||||
payload: {
|
payload: {
|
||||||
response: response.data,
|
response: response.data,
|
||||||
main: mainPayload,
|
main: mainPayload
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -58,8 +58,8 @@ export function request(
|
|||||||
type: fulfilled,
|
type: fulfilled,
|
||||||
payload: {
|
payload: {
|
||||||
response: response.data,
|
response: response.data,
|
||||||
main: mainPayload,
|
main: mainPayload
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
if (callbackEvents) {
|
if (callbackEvents) {
|
||||||
for (let event of callbackEvents) {
|
for (let event of callbackEvents) {
|
||||||
@ -70,19 +70,19 @@ export function request(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch(error => {
|
||||||
// Unauthorized
|
// Unauthorized
|
||||||
if (error.response && error.response.status == 401) {
|
if (error.response && error.response.status == 401) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: "USER_LOGOUT",
|
type: "USER_LOGOUT"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
dispatch({
|
dispatch({
|
||||||
type: "ADD_ALERT_ERROR",
|
type: "ADD_ALERT_ERROR",
|
||||||
payload: {
|
payload: {
|
||||||
message: error.response.data,
|
message: error.response.data,
|
||||||
main: mainPayload,
|
main: mainPayload
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export const prettyDurationFromMinutes = (runtime) => {
|
export const prettyDurationFromMinutes = runtime => {
|
||||||
const hours = Math.floor(runtime / 60);
|
const hours = Math.floor(runtime / 60);
|
||||||
const minutes = runtime % 60;
|
const minutes = runtime % 60;
|
||||||
|
|
||||||
@ -16,14 +16,14 @@ export const prettyDurationFromMinutes = (runtime) => {
|
|||||||
return duration;
|
return duration;
|
||||||
};
|
};
|
||||||
|
|
||||||
const pad = (d) => (d < 10 ? "0" + d.toString() : d.toString());
|
const pad = d => (d < 10 ? "0" + d.toString() : d.toString());
|
||||||
|
|
||||||
export const prettyEpisodeName = (showName, season, episode) =>
|
export const prettyEpisodeName = (showName, season, episode) =>
|
||||||
`${showName} S${pad(season)}E${pad(episode)}`;
|
`${showName} S${pad(season)}E${pad(episode)}`;
|
||||||
|
|
||||||
export const inLibrary = (element) => element.get("polochon_url", "") !== "";
|
export const inLibrary = element => element.get("polochon_url", "") !== "";
|
||||||
|
|
||||||
export const isWishlisted = (element) => {
|
export const isWishlisted = element => {
|
||||||
const wishlisted = element.get("wishlisted", undefined);
|
const wishlisted = element.get("wishlisted", undefined);
|
||||||
if (wishlisted !== undefined) {
|
if (wishlisted !== undefined) {
|
||||||
return wishlisted;
|
return wishlisted;
|
||||||
@ -58,7 +58,7 @@ export const isEpisodeWishlisted = (element, trackedSeason, trackedEpisode) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const prettySize = (fileSizeInBytes) => {
|
export const 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 {
|
||||||
|
1236
frontend/package-lock.json
generated
1236
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -6,8 +6,8 @@
|
|||||||
"lint": "./node_modules/eslint/bin/eslint.js ."
|
"lint": "./node_modules/eslint/bin/eslint.js ."
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bootstrap": "^4.4.1",
|
"bootstrap": "^4.3.1",
|
||||||
"bootswatch": "^4.4.1",
|
"bootswatch": "^4.3.1",
|
||||||
"font-awesome": "^4.7.0",
|
"font-awesome": "^4.7.0",
|
||||||
"fuzzy": "^0.1.3",
|
"fuzzy": "^0.1.3",
|
||||||
"history": "^4.9.0",
|
"history": "^4.9.0",
|
||||||
@ -17,47 +17,47 @@
|
|||||||
"moment": "^2.20.1",
|
"moment": "^2.20.1",
|
||||||
"popper.js": "^1.15.0",
|
"popper.js": "^1.15.0",
|
||||||
"prop-types": "^15.6.0",
|
"prop-types": "^15.6.0",
|
||||||
"react": "^16.13.1",
|
"react": "^16.13.0",
|
||||||
"react-bootstrap": "^1.0.0",
|
"react-bootstrap": "^1.0.0-beta.9",
|
||||||
"react-bootstrap-sweetalert": "^5.1.9",
|
"react-bootstrap-sweetalert": "^5.1.9",
|
||||||
"react-bootstrap-toggle": "^2.2.6",
|
"react-bootstrap-toggle": "^2.2.6",
|
||||||
"react-dom": "^16.13.1",
|
"react-dom": "^16.13.0",
|
||||||
"react-infinite-scroll-component": "^5.0.4",
|
"react-infinite-scroll-component": "^5.0.4",
|
||||||
"react-loading": "2.0.3",
|
"react-loading": "2.0.3",
|
||||||
"react-redux": "^7.2.0",
|
"react-redux": "^7.2.0",
|
||||||
"react-router-bootstrap": "^0.25.0",
|
"react-router-bootstrap": "^0.25.0",
|
||||||
"react-router-dom": "^5.1.2",
|
"react-router-dom": "^5.0.1",
|
||||||
"redux": "^4.0.5",
|
"redux": "^4.0.1",
|
||||||
"redux-logger": "^3.0.6",
|
"redux-logger": "^3.0.6",
|
||||||
"redux-thunk": "^2.3.0",
|
"redux-thunk": "^2.3.0",
|
||||||
"ua-parser-js": "^0.7.17"
|
"ua-parser-js": "^0.7.17"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.9.0",
|
"@babel/core": "^7.5.0",
|
||||||
"@babel/preset-env": "^7.9.0",
|
"@babel/preset-env": "^7.5.0",
|
||||||
"@babel/preset-react": "^7.9.4",
|
"@babel/preset-react": "^7.0.0",
|
||||||
"autoprefixer": "^9.7.5",
|
"autoprefixer": "^9.5.1",
|
||||||
"axios": "^0.19.2",
|
"axios": "^0.19.2",
|
||||||
"babel-eslint": "^10.1.0",
|
"babel-eslint": "^10.1.0",
|
||||||
"babel-loader": "^8.1.0",
|
"babel-loader": "^8.0.6",
|
||||||
"clean-webpack-plugin": "^3.0.0",
|
"clean-webpack-plugin": "^3.0.0",
|
||||||
"css-loader": "^3.4.2",
|
"css-loader": "^3.4.2",
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
"eslint-config-prettier": "^6.10.1",
|
"eslint-config-prettier": "^6.10.0",
|
||||||
"eslint-plugin-import": "^2.20.2",
|
"eslint-plugin-import": "^2.20.1",
|
||||||
"eslint-plugin-prettier": "^3.1.2",
|
"eslint-plugin-prettier": "^3.1.2",
|
||||||
"eslint-plugin-react": "^7.19.0",
|
"eslint-plugin-react": "^7.6.1",
|
||||||
"eslint-plugin-react-hooks": "^2.5.1",
|
"eslint-plugin-react-hooks": "^2.5.0",
|
||||||
"file-loader": "^5.1.0",
|
"file-loader": "^5.1.0",
|
||||||
"html-webpack-plugin": "^3.2.0",
|
"html-webpack-plugin": "^3.2.0",
|
||||||
"node-sass": "^4.12.0",
|
"node-sass": "^4.12.0",
|
||||||
"postcss-loader": "^3.0.0",
|
"postcss-loader": "^3.0.0",
|
||||||
"prettier": "^2.0.2",
|
"prettier": "^1.19.1",
|
||||||
"sass-loader": "^8.0.2",
|
"sass-loader": "^8.0.2",
|
||||||
"style-loader": "^1.1.3",
|
"style-loader": "^1.1.3",
|
||||||
"universal-cookie": "^4.0.3",
|
"universal-cookie": "^4.0.3",
|
||||||
"url-loader": "^3.0.0",
|
"url-loader": "^3.0.0",
|
||||||
"webpack": "^4.42.1",
|
"webpack": "^4.31.0",
|
||||||
"webpack-cli": "^3.3.11",
|
"webpack-cli": "^3.3.11",
|
||||||
"webpack-pwa-manifest": "^4.0.0"
|
"webpack-pwa-manifest": "^4.0.0"
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
plugins: [require("autoprefixer")],
|
plugins: [require("autoprefixer")]
|
||||||
};
|
};
|
||||||
|
@ -19,7 +19,7 @@ const config = {
|
|||||||
entry: path.join(SRC_DIR, "js/app.js"),
|
entry: path.join(SRC_DIR, "js/app.js"),
|
||||||
output: {
|
output: {
|
||||||
path: BUILD_DIR,
|
path: BUILD_DIR,
|
||||||
filename: "[contenthash]-app.js",
|
filename: "[contenthash]-app.js"
|
||||||
},
|
},
|
||||||
optimization: {
|
optimization: {
|
||||||
runtimeChunk: "single",
|
runtimeChunk: "single",
|
||||||
@ -28,10 +28,10 @@ const config = {
|
|||||||
vendor: {
|
vendor: {
|
||||||
test: /[\\/]node_modules[\\/]/,
|
test: /[\\/]node_modules[\\/]/,
|
||||||
name: "vendors",
|
name: "vendors",
|
||||||
chunks: "all",
|
chunks: "all"
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
@ -41,45 +41,45 @@ const config = {
|
|||||||
use: {
|
use: {
|
||||||
loader: "babel-loader",
|
loader: "babel-loader",
|
||||||
options: {
|
options: {
|
||||||
presets: ["@babel/preset-env", "@babel/preset-react"],
|
presets: ["@babel/preset-env", "@babel/preset-react"]
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.scss$/,
|
test: /\.scss$/,
|
||||||
use: ["style-loader", "css-loader", "sass-loader", "postcss-loader"],
|
use: ["style-loader", "css-loader", "sass-loader", "postcss-loader"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.(png|jpg|svg|ico)$/,
|
test: /\.(png|jpg|svg|ico)$/,
|
||||||
use: ["file-loader?name=[hash]-[name].[ext]"],
|
use: ["file-loader?name=[hash]-[name].[ext]"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
||||||
use: ["url-loader?limit=10000&mimetype=application/font-woff"],
|
use: ["url-loader?limit=10000&mimetype=application/font-woff"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
||||||
use: ["file-loader"],
|
use: ["file-loader"]
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV),
|
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV)
|
||||||
}),
|
}),
|
||||||
new webpack.HashedModuleIdsPlugin(),
|
new webpack.HashedModuleIdsPlugin(),
|
||||||
new CleanWebpackPlugin({
|
new CleanWebpackPlugin({
|
||||||
cleanOnceBeforeBuildPatterns: ["**/*", "!img/**/*", "!img"],
|
cleanOnceBeforeBuildPatterns: ["**/*", "!img/**/*", "!img"]
|
||||||
}),
|
}),
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
template: path.join(SRC_DIR, "index.html"),
|
template: path.join(SRC_DIR, "index.html")
|
||||||
}),
|
}),
|
||||||
new WebpackPwaManifest({
|
new WebpackPwaManifest({
|
||||||
fingerprints: true,
|
fingerprints: true,
|
||||||
inject: true,
|
inject: true,
|
||||||
ios: {
|
ios: {
|
||||||
"apple-mobile-web-app-status-bar-style": "default",
|
"apple-mobile-web-app-status-bar-style": "default",
|
||||||
"apple-mobile-web-app-title": "Canapé",
|
"apple-mobile-web-app-title": "Canapé"
|
||||||
},
|
},
|
||||||
name: "Canapé",
|
name: "Canapé",
|
||||||
short_name: "Canapé", // eslint-disable-line camelcase
|
short_name: "Canapé", // eslint-disable-line camelcase
|
||||||
@ -92,20 +92,20 @@ const config = {
|
|||||||
icons: [
|
icons: [
|
||||||
{
|
{
|
||||||
src: path.resolve(__dirname, "img/android-chrome-512x512.png"),
|
src: path.resolve(__dirname, "img/android-chrome-512x512.png"),
|
||||||
sizes: [96, 128, 192, 256, 384, 512],
|
sizes: [96, 128, 192, 256, 384, 512]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
src: path.resolve(__dirname, "img/apple-touch-icon.png"),
|
src: path.resolve(__dirname, "img/apple-touch-icon.png"),
|
||||||
sizes: [80, 120, 152, 167, 180],
|
sizes: [80, 120, 152, 167, 180],
|
||||||
ios: true,
|
ios: true
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
}),
|
})
|
||||||
],
|
],
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: [".js"],
|
extensions: [".js"]
|
||||||
},
|
},
|
||||||
devtool: mode === "production" ? "source-map" : "inline-source-map",
|
devtool: mode === "production" ? "source-map" : "inline-source-map"
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = config;
|
module.exports = config;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user