use ITEM_PER_PAGE constant to standardize pagination
This commit is contained in:
parent
75897a2ab4
commit
a9a5206062
@ -5,6 +5,7 @@ import { convertShortTime } from "../../utils/dateUtils";
|
|||||||
import RenderAttendanceStatus from "./RenderAttendanceStatus";
|
import RenderAttendanceStatus from "./RenderAttendanceStatus";
|
||||||
import usePagination from "../../hooks/usePagination";
|
import usePagination from "../../hooks/usePagination";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
import {ITEMS_PER_PAGE} from "../../utils/constants";
|
||||||
|
|
||||||
const Attendance = ({ attendance, getRole, handleModalData }) => {
|
const Attendance = ({ attendance, getRole, handleModalData }) => {
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
@ -33,7 +34,7 @@ const Attendance = ({ attendance, getRole, handleModalData }) => {
|
|||||||
|
|
||||||
const { currentPage, totalPages, currentItems, paginate } = usePagination(
|
const { currentPage, totalPages, currentItems, paginate } = usePagination(
|
||||||
filteredData,
|
filteredData,
|
||||||
10
|
ITEMS_PER_PAGE
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import UpdateContact from "../../components/Directory/UpdateContact";
|
|||||||
import CardViewDirectory from "../../components/Directory/CardViewDirectory";
|
import CardViewDirectory from "../../components/Directory/CardViewDirectory";
|
||||||
import { useContactCategory } from "../../hooks/masterHook/useMaster";
|
import { useContactCategory } from "../../hooks/masterHook/useMaster";
|
||||||
import usePagination from "../../hooks/usePagination";
|
import usePagination from "../../hooks/usePagination";
|
||||||
|
import {ITEMS_PER_PAGE} from "../../utils/constants";
|
||||||
|
|
||||||
const Directory = () => {
|
const Directory = () => {
|
||||||
const [isOpenModal, setIsOpenModal] = useState(false);
|
const [isOpenModal, setIsOpenModal] = useState(false);
|
||||||
@ -93,7 +94,7 @@ const Directory = () => {
|
|||||||
}, [ContatList, searchText, selectedCategoryIds]);
|
}, [ContatList, searchText, selectedCategoryIds]);
|
||||||
const { currentPage, totalPages, currentItems, paginate } = usePagination(
|
const { currentPage, totalPages, currentItems, paginate } = usePagination(
|
||||||
filteredContacts,
|
filteredContacts,
|
||||||
10
|
ITEMS_PER_PAGE
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { useHasUserPermission } from "../../hooks/useHasUserPermission";
|
import { useHasUserPermission } from "../../hooks/useHasUserPermission";
|
||||||
import { MANAGE_MASTER } from "../../utils/constants";
|
import { ITEMS_PER_PAGE, MANAGE_MASTER } from "../../utils/constants";
|
||||||
import showToast from "../../services/toastService";
|
import showToast from "../../services/toastService";
|
||||||
|
|
||||||
const MasterTable = ({ data, columns, loading, handleModalData }) => {
|
const MasterTable = ({ data, columns, loading, handleModalData }) => {
|
||||||
@ -21,7 +21,7 @@ const MasterTable = ({ data, columns, loading, handleModalData }) => {
|
|||||||
const safeData = Array.isArray(data) ? data : [];
|
const safeData = Array.isArray(data) ? data : [];
|
||||||
|
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
const [currentPage, setCurrentPage] = useState(1);
|
||||||
const [itemsPerPage] = useState(20);
|
const [itemsPerPage] = useState(ITEMS_PER_PAGE);
|
||||||
|
|
||||||
const sortKeys = {
|
const sortKeys = {
|
||||||
"Application Role": "role",
|
"Application Role": "role",
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import showToast from "../../services/toastService";
|
|||||||
import { getCachedData, cacheData } from "../../slices/apiDataManager";
|
import { getCachedData, cacheData } from "../../slices/apiDataManager";
|
||||||
import { useHasUserPermission } from "../../hooks/useHasUserPermission";
|
import { useHasUserPermission } from "../../hooks/useHasUserPermission";
|
||||||
import { useProfile } from "../../hooks/useProfile";
|
import { useProfile } from "../../hooks/useProfile";
|
||||||
import { MANAGE_PROJECT } from "../../utils/constants";
|
import { ITEMS_PER_PAGE, MANAGE_PROJECT } from "../../utils/constants";
|
||||||
import ProjectListView from "./ProjectListView";
|
import ProjectListView from "./ProjectListView";
|
||||||
|
|
||||||
const ProjectList = () => {
|
const ProjectList = () => {
|
||||||
@ -25,7 +25,7 @@ const ProjectList = () => {
|
|||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
const [currentPage, setCurrentPage] = useState(1);
|
||||||
const [itemsPerPage] = useState(10);
|
const [itemsPerPage] = useState(ITEMS_PER_PAGE);
|
||||||
const [searchTerm, setSearchTerm] = useState("");
|
const [searchTerm, setSearchTerm] = useState("");
|
||||||
const [selectedStatuses, setSelectedStatuses] = useState([
|
const [selectedStatuses, setSelectedStatuses] = useState([
|
||||||
"b74da4c2-d07e-46f2-9919-e75e49b12731",
|
"b74da4c2-d07e-46f2-9919-e75e49b12731",
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
export const THRESH_HOLD = 48; // hours
|
export const THRESH_HOLD = 48; // hours
|
||||||
export const DURATION_TIME = 10; // minutes
|
export const DURATION_TIME = 10; // minutes
|
||||||
|
export const ITEMS_PER_PAGE = 20;
|
||||||
|
|
||||||
export const MANAGE_MASTER = "588a8824-f924-4955-82d8-fc51956cf323";
|
export const MANAGE_MASTER = "588a8824-f924-4955-82d8-fc51956cf323";
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user