mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-14 00:53:57 -07:00
Added artists index selection
(cherry picked from commit 815a16d5cfced17ca4db7f1b66991c5cc9f3b719)
This commit is contained in:
parent
d31c323f3c
commit
84d5f2bcee
17 changed files with 553 additions and 135 deletions
|
@ -0,0 +1,35 @@
|
|||
import React, { useCallback } from 'react';
|
||||
import { SelectActionType, useSelect } from 'App/SelectContext';
|
||||
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
||||
import { icons } from 'Helpers/Props';
|
||||
|
||||
function ArtistIndexSelectAllButton() {
|
||||
const [selectState, selectDispatch] = useSelect();
|
||||
const { allSelected, allUnselected } = selectState;
|
||||
|
||||
let icon = icons.SQUARE_MINUS;
|
||||
|
||||
if (allSelected) {
|
||||
icon = icons.CHECK_SQUARE;
|
||||
} else if (allUnselected) {
|
||||
icon = icons.SQUARE;
|
||||
}
|
||||
|
||||
const onPress = useCallback(() => {
|
||||
selectDispatch({
|
||||
type: allSelected
|
||||
? SelectActionType.UnselectAll
|
||||
: SelectActionType.SelectAll,
|
||||
});
|
||||
}, [allSelected, selectDispatch]);
|
||||
|
||||
return (
|
||||
<PageToolbarButton
|
||||
label={allSelected ? 'Unselect All' : 'Select All'}
|
||||
iconName={icon}
|
||||
onPress={onPress}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default ArtistIndexSelectAllButton;
|
Loading…
Add table
Add a link
Reference in a new issue