feat(Tables): implement pagination and loading state handling across multiple tables
- Added `getPaginatedRowNumber` utility function to calculate the correct row number based on pagination. - Integrated `isLoading` prop in `EmptyListWrapper` to conditionally render loading state. - Updated various table components (Admins, CMS, Companies, Inquiries, etc.) to utilize the new pagination logic and loading state handling. - Wrapped pagination components in `IsVisible` to conditionally display based on data availability.
This commit is contained in:
@@ -52,6 +52,8 @@ const useInquiriesListPresenter = () => {
|
||||
}, [searchParams, filterFormReset]);
|
||||
|
||||
const { data, isPending } = useGetInquiries(params);
|
||||
const shouldShowPagination =
|
||||
!isPending && (data?.meta?.pages ?? 1) * (data?.meta?.limit ?? 10) > 10;
|
||||
const { mutate } = useDeleteInquiry(() => setIsDeleteModalOpen(false));
|
||||
const { mutate: changeStatus } =
|
||||
useChangeInquiryStatus(() => setIsChangeStatusModalOpen(false));
|
||||
@@ -100,6 +102,7 @@ const useInquiriesListPresenter = () => {
|
||||
setFilterValue,
|
||||
isMutating,
|
||||
setParams,
|
||||
shouldShowPagination,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user