diff --git a/src/common/PaginateInput/PaginateInput.js b/src/common/PaginateInput/PaginateInput.js
index e0f207a31..9795238a3 100644
--- a/src/common/PaginateInput/PaginateInput.js
+++ b/src/common/PaginateInput/PaginateInput.js
@@ -3,90 +3,29 @@ const PropTypes = require('prop-types');
const classnames = require('classnames');
const Icon = require('stremio-icons/dom');
const Button = require('stremio/common/Button');
-const Multiselect = require('stremio/common/Multiselect');
const styles = require('./styles');
-const PaginateInput = ({ className, options, selected, dataset, onSelect }) => {
- const selectedLabelText = React.useMemo(() => {
- if (Array.isArray(options)) {
- const selectedOption = options.find(({ value }) => {
- return selected === value;
- });
- if (selectedOption && typeof selectedOption.label === 'string') {
- return selectedOption.label;
- }
- }
-
- return selected;
- }, [options, selected]);
+const PaginateInput = ({ className, label, dataset, onSelect, ...props }) => {
const prevNextButtonOnClick = React.useCallback((event) => {
if (typeof onSelect === 'function') {
- if (Array.isArray(options) && options.length > 0) {
- const selectedValueIndex = options.findIndex(({ value }) => {
- return selected === value;
- });
- const nextSelectedIndex = event.currentTarget.dataset.button === 'next' ?
- Math.min(selectedValueIndex + 1, options.length - 1)
- :
- Math.max(selectedValueIndex - 1, 0);
- const nextSelectedValue = options[nextSelectedIndex].value;
- onSelect({
- type: 'select',
- value: nextSelectedValue,
- dataset: dataset,
- reactEvent: event,
- nativeEvent: event.nativeEvent
- });
- } else {
- const nextSelectedValue = event.currentTarget.dataset.button === 'next' ?
- selected + 1
- :
- Math.max(selected - 1, 1);
- onSelect({
- type: 'select',
- value: nextSelectedValue,
- dataset: dataset,
- reactEvent: event,
- nativeEvent: event.nativeEvent
- });
- }
- }
- }, [options, selected, dataset, onSelect]);
- const optionOnSelect = React.useCallback((event) => {
- const page = parseInt(event.value);
- if (!isNaN(page) && typeof onSelect === 'function') {
onSelect({
- type: 'select',
- value: page,
+ type: 'change-page',
+ value: event.currentTarget.dataset.value,
dataset: dataset,
- reactEvent: event.reactEvent,
+ reactEvent: event,
nativeEvent: event.nativeEvent
});
}
}, [dataset, onSelect]);
return (
-
-