From c2e8276d5f2b61e5da8f4991bb117bbe02ce70eb Mon Sep 17 00:00:00 2001 From: Nagarajan Date: Thu, 30 Apr 2026 12:00:31 +0530 Subject: [PATCH] Changes DailyRecommended --- .../profiledashboard/DailyRecommendedCard.jsx | 82 ++++++++++++------- .../profiledetail/MatrimonyProfile.jsx | 11 ++- 2 files changed, 62 insertions(+), 31 deletions(-) diff --git a/src/components/profiledashboard/DailyRecommendedCard.jsx b/src/components/profiledashboard/DailyRecommendedCard.jsx index 446f15b..0fce7af 100644 --- a/src/components/profiledashboard/DailyRecommendedCard.jsx +++ b/src/components/profiledashboard/DailyRecommendedCard.jsx @@ -2,12 +2,13 @@ import { useRef, useState, useEffect } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { Swiper, SwiperSlide } from 'swiper/react'; import { Navigation, Pagination, Autoplay, EffectCoverflow } from 'swiper/modules'; -import { Crown, Bookmark, X, ChevronLeft, ChevronRight, RotateCcw, Heart, Timer } from 'lucide-react'; +import { Crown, Bookmark, X, Ban, ChevronLeft, ChevronRight, RotateCcw, Heart, Timer } from 'lucide-react'; import { useNavigate } from 'react-router-dom'; import { toast } from 'react-hot-toast'; import axiosInstance from "../../api/axiosInstance"; import { API_ENDPOINTS } from "../../api/apiEndpoints"; import { sendInterest, shortlistProfile } from '../../services/shortlistapi'; +import { unblockProfile } from '../../services/profileActionApi'; import UpgradeModal from '../common/UpgradeModal'; // Custom Icons @@ -16,7 +17,8 @@ import religionIcon from "../../assets/images/religonicon.svg"; import locationIcon from "../../assets/images/locationicon.svg"; import cashIcon from "../../assets/images/cashicon.svg"; import SchoolIcon from "@mui/icons-material/School"; - +import { useQuery } from '@tanstack/react-query'; +import { getHeaderDetails } from "../../api/preview.api"; // Import Swiper styles import 'swiper/css'; @@ -100,9 +102,6 @@ const CountdownTimer = ({ onContinue }) => { ); }; -import { useQuery } from '@tanstack/react-query'; -import { getHeaderDetails } from "../../api/preview.api"; - const DailyRecommendedCard = ({ profiles: initialProfiles = [] }) => { const swiperRef = useRef(null); const navigate = useNavigate(); @@ -119,6 +118,7 @@ const DailyRecommendedCard = ({ profiles: initialProfiles = [] }) => { staleTime: 60000, }); + console.log("Header Data:", headerData); const isUserPaid = headerData?.myDetails?.is_paid_member === true; useEffect(() => { @@ -165,6 +165,17 @@ const DailyRecommendedCard = ({ profiles: initialProfiles = [] }) => { } }; + const handleUnblock = async (e, profileId) => { + e.stopPropagation(); + try { + const res = await unblockProfile(profileId); + toast.success(res?.message || "Profile unblocked successfully"); + setActiveProfiles(prev => prev.map(p => p.id === profileId ? { ...p, is_blocked: 0 } : p)); + } catch (error) { + toast.error(error?.message || "Failed to unblock profile."); + } + }; + const ProfileCard = ({ profile }) => { const image = profile.photo || profile.image; const memberId = profile.member_id || profile.userId; @@ -211,18 +222,20 @@ const DailyRecommendedCard = ({ profiles: initialProfiles = [] }) => { )} - - - - {isShortlisted ? "Shortlisted" : "Shortlist"} - - + {!profile.is_blocked && ( + + + + {isShortlisted ? "Shortlisted" : "Shortlist"} + + + )}
{ )}
- - + {profile.is_blocked ? ( + + ) : ( + <> + + + + )}
diff --git a/src/components/profiledetail/MatrimonyProfile.jsx b/src/components/profiledetail/MatrimonyProfile.jsx index 89c7c68..2bacd87 100644 --- a/src/components/profiledetail/MatrimonyProfile.jsx +++ b/src/components/profiledetail/MatrimonyProfile.jsx @@ -49,6 +49,7 @@ const MatrimonyProfile = ({ data, onRefresh }) => { if (!data) return null; const profile = data.profile; + console.log("profile",profile); const personal = data.personalDetails; const family = data.familyDetails; const education = data.educationalDetails; @@ -344,7 +345,6 @@ const MatrimonyProfile = ({ data, onRefresh }) => { const handleUnblock = async () => { try { - // Calling the same blockProfile API without a model/reason to trigger unblocking const res = await blockProfile(profile.id, ""); toast.success(res?.message || "Profile Unblocked successfully"); if (onRefresh) onRefresh(false); @@ -543,7 +543,14 @@ const MatrimonyProfile = ({ data, onRefresh }) => { {/* Action Buttons */}
- {profile.is_send_interest_received && profile.statusReceived?.toLowerCase() === 'pending' ? ( + {profile.is_blocked ? ( + + ) : profile.is_send_interest_received && profile.statusReceived?.toLowerCase() === 'pending' ? ( <>