mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-29 16:14:43 +00:00
Sites No Data & Pagination fix
This commit is contained in:
@@ -9,7 +9,11 @@ export default function Pagination({
|
||||
itemsPerPage: number;
|
||||
onPageChange: (page: number) => void;
|
||||
}) {
|
||||
const totalPages = Math.ceil(totalItems / itemsPerPage);
|
||||
const totalPages = Math.max(1, Math.ceil(totalItems / itemsPerPage));
|
||||
|
||||
if (totalItems === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex justify-center pt-4">
|
||||
@@ -25,7 +29,7 @@ export default function Pagination({
|
||||
<button
|
||||
className="join-item btn"
|
||||
onClick={() => onPageChange(currentPage + 1)}
|
||||
disabled={currentPage === totalPages}
|
||||
disabled={currentPage === totalPages || totalItems === 0}
|
||||
>
|
||||
»
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user