From f9be584db44ffa0a8cddc723c31312810f2c6fe5 Mon Sep 17 00:00:00 2001 From: mortezaei Date: Thu, 27 Aug 2026 10:22:45 +0330 Subject: [PATCH] fix ui request send --- .../candidate-contact-client.tsx | 2 +- src/app/new-match/profile/page.tsx | 10 ++++++---- .../request-accepted/request-accepted-client.tsx | 16 ++++++++-------- src/app/request-sent/request-sent-client.tsx | 4 ++-- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/app/candidate-contact/candidate-contact-client.tsx b/src/app/candidate-contact/candidate-contact-client.tsx index f27f0d6..d2143b9 100644 --- a/src/app/candidate-contact/candidate-contact-client.tsx +++ b/src/app/candidate-contact/candidate-contact-client.tsx @@ -89,7 +89,7 @@ export default function CandidateContactClient() { }); }; - if (isProfileLoading || isRedirecting) { + if ((isProfileLoading && !profile) || !profile) { return ; } diff --git a/src/app/new-match/profile/page.tsx b/src/app/new-match/profile/page.tsx index 43ea8b6..bcb20b5 100644 --- a/src/app/new-match/profile/page.tsx +++ b/src/app/new-match/profile/page.tsx @@ -311,15 +311,17 @@ export default function NewMatchProfilePage({ const caseStatus = profile?.active_case?.status; const isFemaleProfile = profile?.gender === "female"; const respondMutation = useRespondToMarriageCaseMutation(caseId ?? "", { - onSuccess: async (_, variables) => { + onSuccess: async (data, variables) => { + onClose?.(); if (variables.action === "accept") { - const { data: updatedProfile } = await refetchProfile(); - const nextPath = getSubmitPath(updatedProfile); + const nextPath = + profile?.gender === "female" + ? "/request-accepted" + : "/request-sent"; router.replace(localizePath(nextPath, locale)); return; } - onClose?.(); router.replace(localizePath("/finding-match", locale)); }, }); diff --git a/src/app/request-accepted/request-accepted-client.tsx b/src/app/request-accepted/request-accepted-client.tsx index 03b9307..3a9d3f6 100644 --- a/src/app/request-accepted/request-accepted-client.tsx +++ b/src/app/request-accepted/request-accepted-client.tsx @@ -253,7 +253,7 @@ export default function RequestAcceptedClient() { enabled: false, }); - if (isLoading || isRedirecting) { + if ((isLoading && !profile) || !profile) { return ; } @@ -626,7 +626,7 @@ export default function RequestAcceptedClient() { type="button" onClick={() => setIsOutcomeSheetOpen(true)} disabled={outcomeMutation.isPending} - className="w-full h-[50px] px-6 rounded-full bg-gradient-to-r from-[#FF6687] to-[#FF456C] text-white font-bold text-[15px] flex items-center justify-center shadow-sm transition-transform active:scale-[0.98] cursor-pointer hover:opacity-95 disabled:opacity-50" + className="w-full h-[50px] px-6 rounded-[14px] bg-gradient-to-r from-[#FF6687] to-[#FF456C] text-white font-bold text-[15px] flex items-center justify-center shadow-sm transition-transform active:scale-[0.98] cursor-pointer hover:opacity-95 disabled:opacity-50" > {outcomeMutation.isPending ? ( @@ -639,7 +639,7 @@ export default function RequestAcceptedClient() { @@ -648,7 +648,7 @@ export default function RequestAcceptedClient() { type="button" onClick={() => setIsOutcomeSheetOpen(true)} disabled={outcomeMutation.isPending} - className="flex-1 h-[50px] px-3 rounded-full bg-gradient-to-r from-[#FF6687] to-[#FF456C] text-white font-bold text-[14px] flex items-center justify-center shadow-sm transition-transform active:scale-[0.98] cursor-pointer hover:opacity-95 disabled:opacity-50" + className="flex-1 h-[50px] px-3 rounded-[14px] bg-gradient-to-r from-[#FF6687] to-[#FF456C] text-white font-bold text-[14px] flex items-center justify-center shadow-sm transition-transform active:scale-[0.98] cursor-pointer hover:opacity-95 disabled:opacity-50" > {outcomeMutation.isPending ? ( @@ -669,7 +669,7 @@ export default function RequestAcceptedClient() { contactStatusMutation.isPending || noContactReportedSuccess } - className="flex-1 min-h-[48px] px-3.5 py-2.5 rounded-full border border-[#E2E8F0] bg-white/95 backdrop-blur-sm text-[#475569] font-bold text-[13.5px] leading-tight shadow-sm flex items-center justify-center text-center whitespace-nowrap transition-all cursor-pointer hover:bg-[#F8FAFC] active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed" + className="flex-1 min-h-[48px] px-3.5 py-2.5 rounded-[14px] border border-[#E2E8F0] bg-white/95 backdrop-blur-sm text-[#475569] font-bold text-[13.5px] leading-tight shadow-sm flex items-center justify-center text-center whitespace-nowrap transition-all cursor-pointer hover:bg-[#F8FAFC] active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed" > {contactStatusMutation.isPending ? ( @@ -682,7 +682,7 @@ export default function RequestAcceptedClient() { href={profileHref} className="flex-1 max-w-[170px]" > -
+
{primaryActionText}
@@ -696,7 +696,7 @@ export default function RequestAcceptedClient() { disabled={paymentMutation.isPending} className={ isFemaleProfile - ? "flex-1 min-h-[48px] px-3.5 py-2.5 rounded-full bg-gradient-to-r from-[#FF6687] to-[#FF456C] text-white font-bold text-[13.5px] leading-tight flex items-center justify-center text-center whitespace-nowrap shadow-sm transition-all cursor-pointer hover:opacity-95 active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed" + ? "flex-1 min-h-[48px] px-3.5 py-2.5 rounded-[14px] bg-gradient-to-r from-[#FF6687] to-[#FF456C] text-white font-bold text-[13.5px] leading-tight flex items-center justify-center text-center whitespace-nowrap shadow-sm transition-all cursor-pointer hover:opacity-95 active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed" : "flex-1 max-w-[170px] min-h-[48px] appearance-none border-0 bg-transparent p-0 text-center cursor-pointer transition-transform active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed" } > @@ -707,7 +707,7 @@ export default function RequestAcceptedClient() { secondaryActionText ) ) : ( -
+
{paymentMutation.isPending ? ( ) : ( diff --git a/src/app/request-sent/request-sent-client.tsx b/src/app/request-sent/request-sent-client.tsx index b6fffa0..18a58a4 100644 --- a/src/app/request-sent/request-sent-client.tsx +++ b/src/app/request-sent/request-sent-client.tsx @@ -55,7 +55,7 @@ export default function RequestSentClient() { return getSubmitPath(profile) !== "/request-sent"; }, [profile]); - if (isLoading || isRedirecting) { + if ((isLoading && !profile) || !profile) { return ; } @@ -126,7 +126,7 @@ export default function RequestSentClient() { onClick={openProfile} className="mt-12 w-full max-w-[300px] cursor-pointer transition-transform active:scale-[0.97]" > -
+
{requestSentCopy.matchProfile}