1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-20 21:54:58 -04:00

New: Improve 'Select All' in Library Import

Closes #7909
This commit is contained in:
Mark McDowall
2025-10-25 16:13:31 -07:00
parent 08f0a5a960
commit 910b85f37d
32 changed files with 666 additions and 439 deletions
@@ -5,7 +5,7 @@ import {
setAddSeriesOption,
useAddSeriesOptions,
} from 'AddSeries/addSeriesOptionsStore';
import { useSelect } from 'App/SelectContext';
import { useSelect } from 'App/Select/SelectContext';
import AppState from 'App/State/AppState';
import CheckInput from 'Components/Form/CheckInput';
import FormInputGroup from 'Components/Form/FormInputGroup';
@@ -25,7 +25,6 @@ import {
} from 'Store/Actions/importSeriesActions';
import { InputChanged } from 'typings/inputs';
import translate from 'Utilities/String/translate';
import getSelectedIds from 'Utilities/Table/getSelectedIds';
import styles from './ImportSeriesFooter.css';
type MixedType = 'mixed';
@@ -56,11 +55,7 @@ function ImportSeriesFooter() {
defaultSeasonFolder
);
const [selectState] = useSelect();
const selectedIds = useMemo(() => {
return getSelectedIds(selectState.selectedState, (id) => id);
}, [selectState.selectedState]);
const { selectedCount, getSelectedIds } = useSelect();
const {
hasUnsearchedItems,
@@ -127,7 +122,7 @@ function ImportSeriesFooter() {
setAddSeriesOption(name as keyof AddSeriesOptions, value);
selectedIds.forEach((id) => {
getSelectedIds().forEach((id) => {
dispatch(
// @ts-expect-error - actions are not typed
setImportSeriesValue({
@@ -137,7 +132,7 @@ function ImportSeriesFooter() {
);
});
},
[selectedIds, dispatch]
[getSelectedIds, dispatch]
);
const handleLookupPress = useCallback(() => {
@@ -149,8 +144,8 @@ function ImportSeriesFooter() {
}, [dispatch]);
const handleImportPress = useCallback(() => {
dispatch(importSeries({ ids: selectedIds }));
}, [selectedIds, dispatch]);
dispatch(importSeries({ ids: getSelectedIds() }));
}, [getSelectedIds, dispatch]);
useEffect(() => {
if (isMonitorMixed && monitor !== 'mixed') {
@@ -187,8 +182,6 @@ function ImportSeriesFooter() {
}
}, [defaultSeasonFolder, isSeasonFolderMixed, seasonFolder]);
const selectedCount = selectedIds.length;
return (
<PageContentFooter>
<div className={styles.inputContainer}>