diff --git a/frontend/js/components/shows/details/episode.js b/frontend/js/components/shows/details/episode.js
index e45d895..ce2c3e8 100644
--- a/frontend/js/components/shows/details/episode.js
+++ b/frontend/js/components/shows/details/episode.js
@@ -1,7 +1,7 @@
import React from "react";
import PropTypes from "prop-types";
import { Map } from "immutable";
-import { connect } from "react-redux";
+import { useDispatch, useSelector } from "react-redux";
import { showWishlistToggle } from "../../../actions/shows";
@@ -24,87 +24,88 @@ import { EpisodeSubtitlesButton } from "./subtitlesButton";
import { EpisodeThumb } from "./episodeThumb";
import { EpisodeTorrentsButton } from "./torrentsButton";
-const mapStateToProps = (state) => ({
- trackedSeason: state.showStore.getIn(["show", "tracked_season"], null),
- trackedEpisode: state.showStore.getIn(["show", "tracked_episode"], null),
-});
+export const Episode = (props) => {
+ const dispatch = useDispatch();
-const episode = (props) => (
-
-
-
-
- props.showWishlistToggle(
- isEpisodeWishlisted(props.data),
- props.data.get("show_imdb_id"),
+ const trackedSeason = useSelector((state) =>
+ state.showStore.getIn(["show", "tracked_season"], null)
+ );
+ const trackedEpisode = useSelector((state) =>
+ state.showStore.getIn(["show", "tracked_episode"], null)
+ );
+
+ return (
+
+
+
+
+ dispatch(
+ showWishlistToggle(
+ isEpisodeWishlisted(props.data),
+ props.data.get("show_imdb_id"),
+ props.data.get("season"),
+ props.data.get("episode")
+ )
+ )
+ }
+ />
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-);
-episode.propTypes = {
- data: PropTypes.instanceOf(Map).isRequired,
- trackedSeason: PropTypes.number,
- trackedEpisode: PropTypes.number,
- showName: PropTypes.string.isRequired,
- showWishlistToggle: PropTypes.func,
+ );
+};
+Episode.propTypes = {
+ data: PropTypes.instanceOf(Map).isRequired,
+ showName: PropTypes.string.isRequired,
};
-
-export const Episode = connect(mapStateToProps, { showWishlistToggle })(
- episode
-);
diff --git a/frontend/js/components/shows/details/header.js b/frontend/js/components/shows/details/header.js
index bf77ebd..ece6bf0 100644
--- a/frontend/js/components/shows/details/header.js
+++ b/frontend/js/components/shows/details/header.js
@@ -1,7 +1,7 @@
import React from "react";
import PropTypes from "prop-types";
import { Map } from "immutable";
-import { connect } from "react-redux";
+import { useDispatch } from "react-redux";
import { isWishlisted } from "../../../utils";
@@ -15,56 +15,58 @@ import { TrackingLabel } from "../../details/tracking";
import { ImdbBadge } from "../../buttons/imdb";
-export const header = (props) => (
-
-
-
-
})
-
-
-
-
-
- props.showWishlistToggle(
- isWishlisted(props.data),
- props.data.get("imdb_id")
- )
- }
- />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+export const Header = (props) => {
+ const dispatch = useDispatch();
+ return (
+
+
+
+
})
+
+
+
+
+
+ dispatch(
+ showWishlistToggle(
+ isWishlisted(props.data),
+ props.data.get("imdb_id")
+ )
+ )
+ }
+ />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-);
-header.propTypes = {
- data: PropTypes.instanceOf(Map),
- showWishlistToggle: PropTypes.func,
+ );
+};
+Header.propTypes = {
+ data: PropTypes.instanceOf(Map),
};
-
-export const Header = connect(null, { showWishlistToggle })(header);
diff --git a/frontend/js/components/shows/details/subtitlesButton.js b/frontend/js/components/shows/details/subtitlesButton.js
index 2585383..70a8b31 100644
--- a/frontend/js/components/shows/details/subtitlesButton.js
+++ b/frontend/js/components/shows/details/subtitlesButton.js
@@ -1,39 +1,37 @@
import React from "react";
import PropTypes from "prop-types";
import { List } from "immutable";
-import { connect } from "react-redux";
+import { useDispatch } from "react-redux";
import { searchEpisodeSubtitles } from "../../../actions/subtitles";
import { SubtitlesButton } from "../../buttons/subtitles";
-const episodeSubtitlesButton = ({
+export const EpisodeSubtitlesButton = ({
inLibrary,
imdbId,
season,
episode,
searching,
- searchEpisodeSubtitles,
subtitles,
-}) => (
-
searchEpisodeSubtitles(imdbId, season, episode)}
- />
-);
+}) => {
+ const dispatch = useDispatch();
-episodeSubtitlesButton.propTypes = {
+ return (
+ dispatch(searchEpisodeSubtitles(imdbId, season, episode))}
+ />
+ );
+};
+
+EpisodeSubtitlesButton.propTypes = {
inLibrary: PropTypes.bool,
searching: PropTypes.bool,
imdbId: PropTypes.string,
season: PropTypes.number,
episode: PropTypes.number,
- searchEpisodeSubtitles: PropTypes.func,
subtitles: PropTypes.instanceOf(List),
};
-
-export const EpisodeSubtitlesButton = connect(null, { searchEpisodeSubtitles })(
- episodeSubtitlesButton
-);
diff --git a/frontend/js/components/shows/details/torrentsButton.js b/frontend/js/components/shows/details/torrentsButton.js
index 931f9ad..f1125ab 100644
--- a/frontend/js/components/shows/details/torrentsButton.js
+++ b/frontend/js/components/shows/details/torrentsButton.js
@@ -1,40 +1,39 @@
import React from "react";
import PropTypes from "prop-types";
-import { connect } from "react-redux";
+import { useDispatch } from "react-redux";
import { List } from "immutable";
import { getEpisodeDetails } from "../../../actions/shows";
+
import { TorrentsButton } from "../../buttons/torrents";
import { prettyEpisodeName } from "../../../utils";
-const episodeTorrentsButton = ({
+export const EpisodeTorrentsButton = ({
torrents,
imdbId,
season,
episode,
showName,
searching,
- getEpisodeDetails,
-}) => (
- getEpisodeDetails(imdbId, season, episode)}
- url={`#/torrents/search/shows/${encodeURI(
- prettyEpisodeName(showName, season, episode)
- )}`}
- />
-);
-episodeTorrentsButton.propTypes = {
+}) => {
+ const dispatch = useDispatch();
+
+ return (
+ dispatch(getEpisodeDetails(imdbId, season, episode))}
+ url={`#/torrents/search/shows/${encodeURI(
+ prettyEpisodeName(showName, season, episode)
+ )}`}
+ />
+ );
+};
+EpisodeTorrentsButton.propTypes = {
torrents: PropTypes.instanceOf(List),
showName: PropTypes.string.isRequired,
imdbId: PropTypes.string.isRequired,
episode: PropTypes.number.isRequired,
season: PropTypes.number.isRequired,
searching: PropTypes.bool.isRequired,
- getEpisodeDetails: PropTypes.func.isRequired,
};
-
-export const EpisodeTorrentsButton = connect(null, { getEpisodeDetails })(
- episodeTorrentsButton
-);