Skip to content

Commit df91363

Browse files
fix: pagination issue
1 parent a43d95a commit df91363

File tree

3 files changed

+35
-54
lines changed

3 files changed

+35
-54
lines changed

apps/OpenSign/src/pages/TeamList.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,18 @@ const TeamList = () => {
146146
};
147147

148148
// Change page
149-
const paginateFront = () => setCurrentPage(currentPage + 1);
150-
const paginateBack = () => setCurrentPage(currentPage - 1);
149+
const paginateFront = () => {
150+
if (currentPage < Math.max(...pageNumbers)) {
151+
setCurrentPage(currentPage + 1);
152+
}
153+
};
154+
155+
const paginateBack = () => {
156+
if (startIndex > 0) {
157+
setCurrentPage(currentPage - 1);
158+
}
159+
};
160+
151161
const handleActionBtn = (act, item) => {
152162
if (act.action === "edit") {
153163
setIsEditModal({ [item.objectId]: true });

apps/OpenSign/src/pages/UserList.js

Lines changed: 12 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,18 @@ const UserList = () => {
128128
};
129129

130130
// Change page
131-
const paginateFront = () => setCurrentPage(currentPage + 1);
132-
const paginateBack = () => setCurrentPage(currentPage - 1);
133-
// const handleActionBtn = (act, item) => {
134-
// if (act.action === "delete") {
135-
// setIsDeleteModal({ [item.objectId]: true });
136-
// }
137-
// };
131+
const paginateFront = () => {
132+
if (currentPage < Math.max(...pageNumbers)) {
133+
setCurrentPage(currentPage + 1);
134+
}
135+
};
136+
137+
const paginateBack = () => {
138+
if (startIndex > 0) {
139+
setCurrentPage(currentPage - 1);
140+
}
141+
};
142+
138143
const handleUserData = (userData) => {
139144
setUserList((prev) => [userData, ...prev]);
140145
};
@@ -296,49 +301,6 @@ const UserList = () => {
296301
)}
297302
</td>
298303
)}
299-
{/* <td className="px-3 py-2 text-white grid grid-cols-2">
300-
{actions?.length > 0 &&
301-
actions.map((act, index) => (
302-
<button
303-
key={index}
304-
onClick={() => handleActionBtn(act, item)}
305-
title={act.hoverLabel}
306-
className={`${
307-
act?.btnColor ? act.btnColor : ""
308-
} op-btn op-btn-sm`}
309-
>
310-
<i className={act.btnIcon}></i>
311-
</button>
312-
))}
313-
{isDeleteModal[item.objectId] && (
314-
<ModalUi
315-
isOpen
316-
title={t("delete-user")}
317-
handleClose={handleClose}
318-
>
319-
<div className="m-[20px]">
320-
<div className="text-lg font-normal text-black">
321-
{t( "are-you-sure")} {t("delete")} {t("this-user")}?
322-
</div>
323-
<hr className="bg-[#ccc] mt-4 " />
324-
<div className="flex items-center mt-3 gap-2 text-white">
325-
<button
326-
onClick={() => handleDelete(item)}
327-
className="op-btn op-btn-primary"
328-
>
329-
{t("yes")}
330-
</button>
331-
<button
332-
onClick={handleClose}
333-
className="op-btn op-btn-secondary"
334-
>
335-
{('no)}
336-
</button>
337-
</div>
338-
</div>
339-
</ModalUi>
340-
)}
341-
</td> */}
342304
</tr>
343305
))}
344306
</>

apps/OpenSign/src/primitives/GetReportDisplay.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,17 @@ const ReportTable = (props) => {
372372
const currentList = props.List?.slice(indexOfFirstDoc, indexOfLastDoc);
373373

374374
// Change page
375-
const paginateFront = () => setCurrentPage(currentPage + 1);
376-
const paginateBack = () => setCurrentPage(currentPage - 1);
375+
const paginateFront = () => {
376+
if (currentPage < Math.max(...pageNumbers)) {
377+
setCurrentPage(currentPage + 1);
378+
}
379+
};
380+
381+
const paginateBack = () => {
382+
if (startIndex > 0) {
383+
setCurrentPage(currentPage - 1);
384+
}
385+
};
377386

378387
const handleContactFormModal = () => {
379388
setIsContactform(!isContactform);

0 commit comments

Comments
 (0)