mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-28 23:16:32 -04:00
Use react-query for series
This commit is contained in:
+10
-13
@@ -1,5 +1,4 @@
|
||||
import React, { useCallback } from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import Form from 'Components/Form/Form';
|
||||
import FormGroup from 'Components/Form/FormGroup';
|
||||
import FormInputGroup from 'Components/Form/FormInputGroup';
|
||||
@@ -11,9 +10,11 @@ import ModalContent from 'Components/Modal/ModalContent';
|
||||
import ModalFooter from 'Components/Modal/ModalFooter';
|
||||
import ModalHeader from 'Components/Modal/ModalHeader';
|
||||
import { inputTypes } from 'Helpers/Props';
|
||||
import { setSeriesOverviewOption } from 'Store/Actions/seriesIndexActions';
|
||||
import {
|
||||
setSeriesOverviewOptions,
|
||||
useSeriesOverviewOptions,
|
||||
} from 'Series/seriesOptionsStore';
|
||||
import translate from 'Utilities/String/translate';
|
||||
import selectOverviewOptions from '../selectOverviewOptions';
|
||||
|
||||
const posterSizeOptions: EnhancedSelectInputValue<string>[] = [
|
||||
{
|
||||
@@ -40,11 +41,9 @@ interface SeriesIndexOverviewOptionsModalContentProps {
|
||||
onModalClose(...args: unknown[]): void;
|
||||
}
|
||||
|
||||
function SeriesIndexOverviewOptionsModalContent(
|
||||
props: SeriesIndexOverviewOptionsModalContentProps
|
||||
) {
|
||||
const { onModalClose } = props;
|
||||
|
||||
function SeriesIndexOverviewOptionsModalContent({
|
||||
onModalClose,
|
||||
}: SeriesIndexOverviewOptionsModalContentProps) {
|
||||
const {
|
||||
detailedProgressBar,
|
||||
size,
|
||||
@@ -58,15 +57,13 @@ function SeriesIndexOverviewOptionsModalContent(
|
||||
showSizeOnDisk,
|
||||
showTags,
|
||||
showSearchAction,
|
||||
} = useSelector(selectOverviewOptions);
|
||||
|
||||
const dispatch = useDispatch();
|
||||
} = useSeriesOverviewOptions();
|
||||
|
||||
const onOverviewOptionChange = useCallback(
|
||||
({ name, value }: { name: string; value: unknown }) => {
|
||||
dispatch(setSeriesOverviewOption({ [name]: value }));
|
||||
setSeriesOverviewOptions({ [name]: value });
|
||||
},
|
||||
[dispatch]
|
||||
[]
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import classNames from 'classnames';
|
||||
import React, { useCallback, useMemo, useState } from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import TextTruncate from 'react-text-truncate';
|
||||
import { REFRESH_SERIES, SERIES_SEARCH } from 'Commands/commandNames';
|
||||
import IconButton from 'Components/Link/IconButton';
|
||||
@@ -13,13 +13,13 @@ import EditSeriesModal from 'Series/Edit/EditSeriesModal';
|
||||
import SeriesIndexProgressBar from 'Series/Index/ProgressBar/SeriesIndexProgressBar';
|
||||
import SeriesIndexPosterSelect from 'Series/Index/Select/SeriesIndexPosterSelect';
|
||||
import { Statistics } from 'Series/Series';
|
||||
import { useSeriesOverviewOptions } from 'Series/seriesOptionsStore';
|
||||
import SeriesPoster from 'Series/SeriesPoster';
|
||||
import { executeCommand } from 'Store/Actions/commandActions';
|
||||
import dimensions from 'Styles/Variables/dimensions';
|
||||
import fonts from 'Styles/Variables/fonts';
|
||||
import translate from 'Utilities/String/translate';
|
||||
import createSeriesIndexItemSelector from '../createSeriesIndexItemSelector';
|
||||
import selectOverviewOptions from './selectOverviewOptions';
|
||||
import useSeriesIndexItem from '../useSeriesIndexItem';
|
||||
import SeriesIndexOverviewInfo from './SeriesIndexOverviewInfo';
|
||||
import styles from './SeriesIndexOverview.css';
|
||||
|
||||
@@ -56,9 +56,9 @@ function SeriesIndexOverview(props: SeriesIndexOverviewProps) {
|
||||
} = props;
|
||||
|
||||
const { series, qualityProfile, isRefreshingSeries, isSearchingSeries } =
|
||||
useSelector(createSeriesIndexItemSelector(props.seriesId));
|
||||
useSeriesIndexItem(seriesId);
|
||||
|
||||
const overviewOptions = useSelector(selectOverviewOptions);
|
||||
const overviewOptions = useSeriesOverviewOptions();
|
||||
|
||||
const {
|
||||
title,
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { throttle } from 'lodash';
|
||||
import React, { RefObject, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { FixedSizeList as List, ListChildComponentProps } from 'react-window';
|
||||
import useMeasure from 'Helpers/Hooks/useMeasure';
|
||||
import Series from 'Series/Series';
|
||||
import { useSeriesOverviewOptions } from 'Series/seriesOptionsStore';
|
||||
import dimensions from 'Styles/Variables/dimensions';
|
||||
import getIndexOfFirstCharacter from 'Utilities/Array/getIndexOfFirstCharacter';
|
||||
import selectOverviewOptions from './selectOverviewOptions';
|
||||
import SeriesIndexOverview from './SeriesIndexOverview';
|
||||
|
||||
// Poster container dimensions
|
||||
@@ -72,9 +71,7 @@ function SeriesIndexOverviews(props: SeriesIndexOverviewsProps) {
|
||||
isSmallScreen,
|
||||
} = props;
|
||||
|
||||
const { size: posterSize, detailedProgressBar } = useSelector(
|
||||
selectOverviewOptions
|
||||
);
|
||||
const { size: posterSize, detailedProgressBar } = useSeriesOverviewOptions();
|
||||
const listRef = useRef<List>(null);
|
||||
const [measureRef, bounds] = useMeasure();
|
||||
const [size, setSize] = useState({ width: 0, height: 0 });
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import { createSelector } from 'reselect';
|
||||
import AppState from 'App/State/AppState';
|
||||
|
||||
const selectOverviewOptions = createSelector(
|
||||
(state: AppState) => state.seriesIndex.overviewOptions,
|
||||
(overviewOptions) => overviewOptions
|
||||
);
|
||||
|
||||
export default selectOverviewOptions;
|
||||
Reference in New Issue
Block a user