feat(contact-us & feedback tables): implement pagination and loading states

- Added pagination functionality to ContactUsTable and FeedbackTable components, enhancing user navigation through large datasets.
- Integrated loading states to provide visual feedback during data fetching.
- Updated data fetching hooks to accept parameters for improved query handling.
- Refactored table row rendering to include pagination metadata for accurate row numbering.
- Enhanced overall user experience by conditionally rendering pagination controls based on data availability.
This commit is contained in:
AmirReza Jamali
2026-05-11 17:30:34 +03:30
parent 71f961ee49
commit 88bc939956
8 changed files with 129 additions and 22 deletions
+6 -3
View File
@@ -4,12 +4,15 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { useMemo } from "react";
import { toast } from "react-toastify";
export const useReadAllContactUs = () => {
const queryKey = useMemo(() => [API_ENDPOINTS.CONTACT_US.BASE()], []);
export const useReadAllContactUs = (params?: Record<string, unknown>) => {
const queryKey = useMemo(
() => [API_ENDPOINTS.CONTACT_US.BASE(), params],
[params],
);
return useQuery({
queryKey,
queryFn: () => contactUsService.getAllContactUs(),
queryFn: () => contactUsService.getAllContactUs(params),
});
};
export const useDeleteContactUs = (successCallback?: () => void) => {
+1 -1
View File
@@ -10,7 +10,7 @@ export const useGetFeedSingleFeedback = (id: string) => {
queryFn: () => feedbackService.getSingleFeedback(id),
});
};
export const useGetFeedback = (params: Record<string, any>) => {
export const useGetFeedback = (params: Record<string, unknown>) => {
const queryKey = useMemo(
() => [API_ENDPOINTS.FEEDBACK.READ_ALL, params],
[params],