mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-22 22:16:13 -04:00
38 lines
981 B
TypeScript
38 lines
981 B
TypeScript
import { IconDefinition } from '@fortawesome/fontawesome-common-types';
|
|
import React, { useCallback } from 'react';
|
|
import { useSelect } from 'App/SelectContext';
|
|
import PageToolbarButton from 'Components/Page/Toolbar/PageToolbarButton';
|
|
|
|
interface SeriesIndexSelectModeButtonProps {
|
|
label: string;
|
|
iconName: IconDefinition;
|
|
isSelectMode: boolean;
|
|
overflowComponent: React.FunctionComponent<never>;
|
|
onPress: () => void;
|
|
}
|
|
|
|
function SeriesIndexSelectModeButton(props: SeriesIndexSelectModeButtonProps) {
|
|
const { label, iconName, isSelectMode, onPress } = props;
|
|
const [, selectDispatch] = useSelect();
|
|
|
|
const onPressWrapper = useCallback(() => {
|
|
if (isSelectMode) {
|
|
selectDispatch({
|
|
type: 'reset',
|
|
});
|
|
}
|
|
|
|
onPress();
|
|
}, [isSelectMode, onPress, selectDispatch]);
|
|
|
|
return (
|
|
<PageToolbarButton
|
|
label={label}
|
|
iconName={iconName}
|
|
onPress={onPressWrapper}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export default SeriesIndexSelectModeButton;
|