Добавление настроек в localStorage
This commit is contained in:
parent
f8ddae0f94
commit
11237605b9
4 changed files with 137 additions and 63 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import React, {useState} from 'react';
|
||||
import React, {useEffect, useState} from 'react';
|
||||
import { DeviceUser } from '../../../../../../store/useDeviceStore';
|
||||
|
||||
interface TableScannerProps {
|
||||
|
|
@ -10,6 +10,7 @@ import {buttonNames} from "../../../../../../const/buttons/names";
|
|||
import {ModalMap} from "../../../../../modalwindows/windowsType";
|
||||
import {useModalContext} from "../../../../../../store";
|
||||
import Pagination from "../../../../../UI/Pagination";
|
||||
import {useSettingsStore} from "../../../../../../store/settingsStore";
|
||||
|
||||
const TableContainer = styled.div`
|
||||
width: 100%;
|
||||
|
|
@ -74,9 +75,19 @@ const TableScanner = ({devices}:TableScannerProps) => {
|
|||
});
|
||||
};
|
||||
|
||||
const paginateSetting = useSettingsStore(state =>
|
||||
state.settingsValues['paginate-nodes'] ??
|
||||
state.settingsConfig.find(s => s.id === 'paginate-nodes')?.defaultValue ??
|
||||
15
|
||||
);
|
||||
|
||||
// Пагинация
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
const [devicesPerPage] = useState(15);
|
||||
const [devicesPerPage, setDevicesPerPage] = useState(paginateSetting);
|
||||
|
||||
useEffect(() => {
|
||||
setDevicesPerPage(paginateSetting);
|
||||
}, [paginateSetting]);
|
||||
|
||||
const indexOfLastDevice = currentPage * devicesPerPage;
|
||||
const indexOfFirstDevice = indexOfLastDevice - devicesPerPage;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue