diff --git a/src/components/profiledetail/MatrimonyProfile.jsx b/src/components/profiledetail/MatrimonyProfile.jsx
index bfea8fb..fb4c557 100644
--- a/src/components/profiledetail/MatrimonyProfile.jsx
+++ b/src/components/profiledetail/MatrimonyProfile.jsx
@@ -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' ? (
<>
@@ -208,7 +212,7 @@ const InterestSendPage = () => {
);
};
-const ProfileCard = ({ profile, tabIndex, onStatusUpdate }) => {
+const ProfileCard = ({ profile, tabIndex, onStatusUpdate, onRefresh }) => {
const navigate = useNavigate();
const [isUpgradeModalOpen, setIsUpgradeModalOpen] = useState(false);
const [isViewContactModalOpen, setIsViewContactModalOpen] = useState(false);
@@ -218,6 +222,10 @@ const ProfileCard = ({ profile, tabIndex, onStatusUpdate }) => {
const [isInterestRejectedModalOpen, setIsInterestRejectedModalOpen] = useState(false);
const [unlockedMobile, setUnlockedMobile] = useState(null);
const [isCreatingChat, setIsCreatingChat] = useState(false);
+ const [showMenu, setShowMenu] = useState(false);
+ const [reportModalOpen, setReportModalOpen] = useState(false);
+ const [reportActionType, setReportActionType] = useState("report");
+
// New state for Accept/Reject confirmation
const [statusConfirm, setStatusConfirm] = useState({ open: false, status: null });
@@ -324,9 +332,47 @@ const ProfileCard = ({ profile, tabIndex, onStatusUpdate }) => {
}
};
+ const openReportModal = (type) => {
+ setReportActionType(type);
+ setReportModalOpen(true);
+ setShowMenu(false);
+ };
+
+ const handleReportAction = async (reason) => {
+ try {
+ if (reportActionType === 'report') {
+ const res = await reportProfile(profile.id, reason);
+ toast.success(res?.message || "Profile Reported successfully");
+ } else {
+ const res = await blockProfile(profile.id, reason);
+ toast.success(res?.message || "Profile Blocked successfully");
+ }
+ if (onRefresh) onRefresh(false);
+ } catch (error) {
+ toast.error(error?.message || `Failed to ${reportActionType === 'report' ? 'Report' : 'Block'}`);
+ }
+ };
+
+ 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);
+ } catch (error) {
+ toast.error(error?.message || "Failed to Unblock");
+ }
+ };
+
return (
<>
+ setReportModalOpen(false)}
+ onSubmit={handleReportAction}
+ actionType={reportActionType}
+ />
navigate(`/profile-details/${profile.id}`)}
className="bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden hover:shadow-md transition-shadow cursor-pointer p-4"
@@ -351,9 +397,54 @@ const ProfileCard = ({ profile, tabIndex, onStatusUpdate }) => {
{profile.name}
-
*/}
+
+
{
+ e.stopPropagation();
+ setShowMenu(!showMenu);
+ }}
+ className="p-2 hover:bg-gray-100 rounded-full transition-colors"
+ >
+
+
+ {showMenu && (
+
e.stopPropagation()}>
+ {
+ e.stopPropagation();
+ setShowMenu(false);
+ if (profile.is_blocked) {
+ handleUnblock();
+ } else {
+ openReportModal('block');
+ }
+ }}
+ className="w-full px-4 py-3 text-left hover:bg-gray-50 flex items-center gap-3"
+ >
+ {profile.is_blocked ? "Unblock Profile" : "Block Profile"}
+
+ {
+ e.stopPropagation();
+ setShowMenu(false);
+ openReportModal('report');
+ }}
+ className="w-full px-4 py-3 text-left hover:bg-gray-50 flex items-center gap-3 text-red-600"
+ >
+ Report Profile
+
+
+ )}
+
@@ -392,7 +483,14 @@ const ProfileCard = ({ profile, tabIndex, onStatusUpdate }) => {
{/* Action Buttons based on Tab */}
- {tabIndex === 0 && profile.statusReceived === 'pending' ? (
+ {profile.is_blocked ? (
+ { e.stopPropagation(); handleUnblock(); }}
+ className="flex-1 py-2 rounded-lg font-bold bg-gray-500 text-white hover:bg-gray-600 transition-all flex items-center justify-center gap-2"
+ >
+ Unblock Profile
+
+ ) : tabIndex === 0 && profile.statusReceived === 'pending' ? (
<>
{ e.stopPropagation(); setStatusConfirm({ open: true, status: 'reject' }); }}