mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-17 15:36:50 +00:00
Sites No Data & Pagination fix
This commit is contained in:
parent
58ae03b535
commit
8357768e4d
@ -56,21 +56,30 @@ export default function SitesPage({ username, name }: SitesPageProps) {
|
||||
setItemPerPage={setItemPerPage}
|
||||
/>
|
||||
|
||||
<div className={
|
||||
itemPerPage === 5
|
||||
? "flex flex-col gap-4 pt-4"
|
||||
: "grid grid-cols-1 md:grid-cols-2 gap-4 pt-4"
|
||||
}>
|
||||
{sites.map((site: any) => (
|
||||
<Sites
|
||||
key={site.id}
|
||||
id={site.id}
|
||||
name={site.name}
|
||||
description={site.description}
|
||||
networks={site.networks}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
{sites.length > 0 ? (
|
||||
<div className={
|
||||
itemPerPage === 5
|
||||
? "flex flex-col gap-4 pt-4"
|
||||
: "grid grid-cols-1 md:grid-cols-2 gap-4 pt-4"
|
||||
}>
|
||||
{sites.map((site: any) => (
|
||||
<Sites
|
||||
key={site.id}
|
||||
id={site.id}
|
||||
name={site.name}
|
||||
description={site.description}
|
||||
networks={site.networks}
|
||||
/>
|
||||
))}
|
||||
</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
|
||||
currentPage={currentPage}
|
||||
|
||||
@ -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>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user