diff --git a/src/api/apiEndpoints.js b/src/api/apiEndpoints.js index 632f3e9..bb9ab48 100644 --- a/src/api/apiEndpoints.js +++ b/src/api/apiEndpoints.js @@ -36,7 +36,7 @@ export const API_ENDPOINTS = { EDIT_LIFESTYLE_DETAILS: "get_lifestyle_details", EDIT_PREFERED_PARTNER_DETAILS: "get_preferred_details", - // delete api + // delete api DELETE_ACCOUNT: "delete_account", PHONE_NUMBER_VISIBILITY: "get_phone_number_visibility", @@ -76,7 +76,10 @@ export const API_ENDPOINTS = { SUBSCRIPTION_PLANS: "subscription-plans", SUBSCRIPTION_PURCHASE_RAZORPAY: "subscription-purchase-razorpay", SUBSCRIPTION_HISTORY: "subscription-history", + + //Report and Block profile + REPORT_PROFILE : "report_profile", + BLOCK_PROFILE: "block_profile", }; - - +// https://www.thirukalyanam.amrithaa.net/backend/api/report_profile?profile_id=151&reason=test diff --git a/src/components/matches/MatchesProfilesTab.jsx b/src/components/matches/MatchesProfilesTab.jsx index 96885d5..ec806c0 100644 --- a/src/components/matches/MatchesProfilesTab.jsx +++ b/src/components/matches/MatchesProfilesTab.jsx @@ -35,7 +35,7 @@ export default function MatchesInterface() { const selectedTab = filterType || "all_matches"; const isPaidMember = filters.isPaidMember; -const { ref, inView } = useInView({ + const { ref, inView } = useInView({ threshold: 0, rootMargin: "300px" }); @@ -48,30 +48,30 @@ const { ref, inView } = useInView({ isFetchingNextPage, } = useProfiles(filters); const profiles = - profilesData?.pages.flatMap((page) => page?.data|| []) || []; + profilesData?.pages.flatMap((page) => page?.data || []) || []; // const { ref, inView } = useInView(); -// useEffect(() => { -// if (inView && hasNextPage && !isFetchingNextPage) { -// fetchNextPage(); -// } -// }, [inView, hasNextPage, isFetchingNextPage]); + // useEffect(() => { + // if (inView && hasNextPage && !isFetchingNextPage) { + // fetchNextPage(); + // } + // }, [inView, hasNextPage, isFetchingNextPage]); -useEffect(() => { - if (inView && hasNextPage && !isFetchingNextPage) { + useEffect(() => { + if (inView && hasNextPage && !isFetchingNextPage) { - setShowSkeleton(true); // show skeleton + setShowSkeleton(true); // show skeleton - const timer = setTimeout(() => { - fetchNextPage(); - setShowSkeleton(false); // hide skeleton after API call - }, 120); // 0.5 seconds + const timer = setTimeout(() => { + fetchNextPage(); + setShowSkeleton(false); // hide skeleton after API call + }, 120); // 0.5 seconds - return () => clearTimeout(timer); - } -}, [inView, hasNextPage, isFetchingNextPage, fetchNextPage]); + return () => clearTimeout(timer); + } + }, [inView, hasNextPage, isFetchingNextPage, fetchNextPage]); @@ -84,10 +84,10 @@ useEffect(() => { console.log("Fetched profiles:", profiles); console.log({ - inView, - hasNextPage, - isFetchingNextPage, -}); + inView, + hasNextPage, + isFetchingNextPage, + }); const tabs = [ { id: "all_matches", @@ -159,169 +159,165 @@ useEffect(() => { return ( - <> + <> - {/*
*/} + {/*
*/}
- - {/* Left Sidebar - Fixed on desktop, scrollable on mobile */} -
-
+
+ > -
-

- Filter Matches

+
+

+ Filter Matches

-
+
-
- {tabs.map((tab) => { - const showCategory = tab.category !== currentCategory; - if (showCategory) { - currentCategory = tab.category; - } - - return ( -
- {showCategory && ( -

- {tab.category} -

- )} - -
{ - const finalFilterType = tab.id === "all_matches" ? "" : tab.id; - dispatch(updateFilter({ filter_type: finalFilterType })); - }} - - className={`p-4 rounded-lg mb-3 cursor-pointer transition-all ${ - selectedTab === tab.id - ? "bg-green-50 border-l-4 border-green-600" - : "hover:bg-gray-50" - }`} - > -
-
- {tab.icon} -
-
-
-

- {tab.title} -

- - - -
-

- {tab.description} -

-
-
-
-
- ); - })} -
-
-
- {/* Right Content Area - Scrollable */} -
-
-
-

- {tabs.find((t) => t.id === selectedTab)?.title} -

-
-
{ - if (isPaidMember) { - navigate("/horoscoper-generate"); - } else { - toast.error("Star Matching is locked for free members"); +
+ {tabs.map((tab) => { + const showCategory = tab.category !== currentCategory; + if (showCategory) { + currentCategory = tab.category; } - }}> - - {!isPaidMember && ( -
- + + return ( +
+ {showCategory && ( +

+ {tab.category} +

+ )} + +
{ + const finalFilterType = tab.id === "all_matches" ? "" : tab.id; + dispatch(updateFilter({ filter_type: finalFilterType })); + }} + + className={`p-4 rounded-lg mb-3 cursor-pointer transition-all ${selectedTab === tab.id + ? "bg-green-50 border-l-4 border-green-600" + : "hover:bg-gray-50" + }`} + > +
+
+ {tab.icon} +
+
+
+

+ {tab.title} +

+ + + +
+

+ {tab.description} +

+
+
+
- )} -
- + ); + })}
-
- {isLoading && !isFetchingNextPage ? ( - [...Array(6)].map((_, i) => ) - ) : profiles.length > 0 ? ( - profiles.map((profile) => ( - - )) - ) : !isLoading && !isFetchingNextPage ? ( -
- No profiles found +
+ {/* Right Content Area - Scrollable */} +
+
+
+

+ {tabs.find((t) => t.id === selectedTab)?.title} +

+
+
{ + if (isPaidMember) { + navigate("/horoscoper-generate"); + } else { + toast.error("Star Matching is locked for free members"); + } + }}> + + {!isPaidMember && ( +
+ +
+ )} +
+
- ) : null} +
+
+ {isLoading && !isFetchingNextPage ? ( + [...Array(6)].map((_, i) => ) + ) : profiles.length > 0 ? ( + profiles.map((profile) => ( + + )) + ) : !isLoading && !isFetchingNextPage ? ( +
+ No profiles found +
+ ) : null} - {/* {isFetchingNextPage && + {/* {isFetchingNextPage && [...Array(5)].map((_, i) => ( ))} */} {(isFetchingNextPage || showSkeleton) && - [...Array(6)].map((_, i) => ( - - ))} + [...Array(6)].map((_, i) => ( + + ))} -
-
- {!isLoading && !hasNextPage && profiles.length > 0 && ( -

- You've reached the end. -

- )} +
+
+ {!isLoading && !hasNextPage && profiles.length > 0 && ( +

+ You've reached the end. +

+ )} +
-
@@ -336,7 +332,7 @@ useEffect(() => { -