mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-18 07:56:57 +00:00
Sites No Data & Pagination fix
This commit is contained in:
parent
58ae03b535
commit
8357768e4d
@ -56,6 +56,7 @@ export default function SitesPage({ username, name }: SitesPageProps) {
|
|||||||
setItemPerPage={setItemPerPage}
|
setItemPerPage={setItemPerPage}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{sites.length > 0 ? (
|
||||||
<div className={
|
<div className={
|
||||||
itemPerPage === 5
|
itemPerPage === 5
|
||||||
? "flex flex-col gap-4 pt-4"
|
? "flex flex-col gap-4 pt-4"
|
||||||
@ -71,6 +72,14 @@ export default function SitesPage({ username, name }: SitesPageProps) {
|
|||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="flex justify-center items-center h-48 bg-base-200 rounded-lg mt-4">
|
||||||
|
<div className="text-center">
|
||||||
|
<h3 className="text-lg font-bold">No Sites Found</h3>
|
||||||
|
<p className="text-sm opacity-70">No sites match your current search criteria</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<Pagination
|
<Pagination
|
||||||
currentPage={currentPage}
|
currentPage={currentPage}
|
||||||
|
|||||||
@ -9,7 +9,11 @@ export default function Pagination({
|
|||||||
itemsPerPage: number;
|
itemsPerPage: number;
|
||||||
onPageChange: (page: number) => void;
|
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 (
|
return (
|
||||||
<div className="flex justify-center pt-4">
|
<div className="flex justify-center pt-4">
|
||||||
@ -25,7 +29,7 @@ export default function Pagination({
|
|||||||
<button
|
<button
|
||||||
className="join-item btn"
|
className="join-item btn"
|
||||||
onClick={() => onPageChange(currentPage + 1)}
|
onClick={() => onPageChange(currentPage + 1)}
|
||||||
disabled={currentPage === totalPages}
|
disabled={currentPage === totalPages || totalItems === 0}
|
||||||
>
|
>
|
||||||
»
|
»
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user