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:
+16
-1
@@ -110,4 +110,19 @@ export const deleteEmptyKeys = (obj: Record<string, any>) => {
|
||||
}
|
||||
return newObj;
|
||||
};
|
||||
export const isValidAlpha2CountryCode = (code: string) => /^[A-Za-z]{2}$/.test(code);
|
||||
export const isValidAlpha2CountryCode = (code: string) => /^[A-Za-z]{2}$/.test(code);
|
||||
|
||||
export const getPaginatedRowNumber = ({
|
||||
index,
|
||||
page = 1,
|
||||
limit = 10,
|
||||
}: {
|
||||
index: number;
|
||||
page?: number;
|
||||
limit?: number;
|
||||
}) => {
|
||||
const safePage = page > 0 ? page : 1;
|
||||
const safeLimit = limit > 0 ? limit : 10;
|
||||
|
||||
return (safePage - 1) * safeLimit + index + 1;
|
||||
};
|
||||
Reference in New Issue
Block a user