refactor: refactor superadmin modules

This commit is contained in:
2026-06-17 01:35:09 +05:30
parent 6f4399a048
commit 1325afdab2
40 changed files with 1709 additions and 1320 deletions

View File

@@ -126,7 +126,14 @@ export function DataTable<TData, TValue>({
pageIndex: Math.floor(pagination.skip / pagination.limit),
pageSize: pagination.limit,
});
pagination.onLimitChange(newState.pageSize);
const pageSizeChanged = newState.pageSize !== pagination.limit;
if (pageSizeChanged) {
pagination.onLimitChange(newState.pageSize);
pagination.onPageChange(0);
return;
}
pagination.onPageChange(newState.pageIndex * newState.pageSize);
}
},
@@ -144,7 +151,7 @@ export function DataTable<TData, TValue>({
<div>
<Table
containerClassName="max-h-[calc(100vh-300px)] overflow-y-auto"
containerClassName="max-h-[calc(100vh-350px)] overflow-y-auto"
className="border-separate border-spacing-0"
>
<TableHeader table={table} />
@@ -154,7 +161,7 @@ export function DataTable<TData, TValue>({
<TableRow key={idx}>
{columns.map((_, colIdx) => (
<TableCell key={colIdx}>
<Skeleton className="h-4 w-full max-w-[140px]" />
<Skeleton className="h-4 w-full max-w-35" />
</TableCell>
))}
</TableRow>
@@ -185,7 +192,12 @@ export function DataTable<TData, TValue>({
</TableBody>
</Table>
</div>
<TableFooter table={table} totalItems={pagination?.totalItems ?? data.length} />
<TableFooter
table={table}
totalItems={pagination?.totalItems ?? data.length}
pageSize={pagination?.limit}
onPageSizeChange={pagination?.onLimitChange}
/>
</section>
);
}