mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-17 23:47:13 +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}
|
setItemPerPage={setItemPerPage}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className={
|
{sites.length > 0 ? (
|
||||||
itemPerPage === 5
|
<div className={
|
||||||
? "flex flex-col gap-4 pt-4"
|
itemPerPage === 5
|
||||||
: "grid grid-cols-1 md:grid-cols-2 gap-4 pt-4"
|
? "flex flex-col gap-4 pt-4"
|
||||||
}>
|
: "grid grid-cols-1 md:grid-cols-2 gap-4 pt-4"
|
||||||
{sites.map((site: any) => (
|
}>
|
||||||
<Sites
|
{sites.map((site: any) => (
|
||||||
key={site.id}
|
<Sites
|
||||||
id={site.id}
|
key={site.id}
|
||||||
name={site.name}
|
id={site.id}
|
||||||
description={site.description}
|
name={site.name}
|
||||||
networks={site.networks}
|
description={site.description}
|
||||||
/>
|
networks={site.networks}
|
||||||
))}
|
/>
|
||||||
</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