Browse Source

feat(payment): show success toast with green indicator on subscription purchase before opening full profile

master
mortezaei 21 hours ago
parent
commit
844cd18920
  1. 12
      src/app/new-match/new-match-client.tsx
  2. 20
      src/app/request-accepted/request-accepted-client.tsx
  3. 2
      src/components/Componentes/error-toast.tsx

12
src/app/new-match/new-match-client.tsx

@ -20,6 +20,7 @@ import AdvisorActionsCard from "@/components/Componentes/advisor-actions-card";
import MarriageAdvisorsOverlay, {
useMarriageAdvisorsOverlay,
} from "@/components/Componentes/marriage-advisors-overlay";
import ErrorToast from "@/components/Componentes/error-toast";
import MatchProfileOverlay, {
useMatchProfileOverlay,
} from "@/components/Componentes/match-profile-overlay";
@ -502,6 +503,8 @@ export default function NewMatchClient() {
const [paymentError, setPaymentError] = useState<string | null>(null);
const [isInsufficientCoins, setIsInsufficientCoins] = useState(false);
const [showPaymentSuccessToast, setShowPaymentSuccessToast] = useState(false);
const [appliedDiscount, setAppliedDiscount] =
useState<CheckDiscountResult | null>(null);
@ -539,6 +542,7 @@ export default function NewMatchClient() {
discountCode: appliedDiscount?.valid ? appliedDiscount.code : undefined,
});
setIsPaymentSheetOpen(false);
setShowPaymentSuccessToast(true);
openProfile();
} catch (err: any) {
console.error("Payment failed", err);
@ -1166,6 +1170,14 @@ export default function NewMatchClient() {
<MarriageAdvisorsOverlay open={isAdvisorOpen} onClose={closeAdvisors} />
<MatchProfileOverlay open={isProfileOpen} onClose={closeProfile} />
{showPaymentSuccessToast && (
<ErrorToast
variant="success"
message={t["Payment successful"] || "Payment successful"}
onClose={() => setShowPaymentSuccessToast(false)}
/>
)}
</>
);
}

20
src/app/request-accepted/request-accepted-client.tsx

@ -9,6 +9,7 @@ import AdvisorActionsCard from "@/components/Componentes/advisor-actions-card";
import MarriageAdvisorsOverlay, {
useMarriageAdvisorsOverlay,
} from "@/components/Componentes/marriage-advisors-overlay";
import ErrorToast from "@/components/Componentes/error-toast";
import MatchProfileOverlay, {
useMatchProfileOverlay,
} from "@/components/Componentes/match-profile-overlay";
@ -199,6 +200,7 @@ export default function RequestAcceptedClient() {
useState(false);
const [hasConfirmedFemaleContact, setHasConfirmedFemaleContact] =
useState(false);
const [showPaymentSuccessToast, setShowPaymentSuccessToast] = useState(false);
const profileHref = localizePath("/new-match/profile", locale);
const { data: profile, isLoading } = useMarriageProfileQuery({
refetchInterval: 3000,
@ -260,6 +262,7 @@ export default function RequestAcceptedClient() {
: caseStatus === "payment_done" || caseStatus === "contacted"
? t["Contact info released"]
: t["Request approved!"];
const primaryActionText = isFemaleProfile
? t["No Contact"] || t["No Contact Received"] || "No Contact"
: t["View profile"];
@ -272,6 +275,14 @@ export default function RequestAcceptedClient() {
contactInfoQuery.data?.contact_info,
);
const handlePrimaryAction = () => {
if (isFemaleProfile) {
setIsDismissReasonSheetOpen(true);
} else {
openProfile();
}
};
const handleSecondaryAction = async () => {
if (isFemaleProfile) {
setIsContactReceivedConfirmOpen(true);
@ -314,6 +325,7 @@ export default function RequestAcceptedClient() {
}
setIsSubscriptionSheetOpen(false);
setShowPaymentSuccessToast(true);
if (caseId) {
await contactInfoQuery.refetch();
@ -773,6 +785,14 @@ export default function RequestAcceptedClient() {
open={isProfileOpen}
onClose={closeProfile}
/>
{showPaymentSuccessToast && (
<ErrorToast
variant="success"
message={t["Payment successful"] || "Payment successful"}
onClose={() => setShowPaymentSuccessToast(false)}
/>
)}
</>
);
}

2
src/components/Componentes/error-toast.tsx

@ -51,7 +51,7 @@ export default function ErrorToast({
return (
<div
className={[
"fixed top-3.5 left-1/2 z-50 flex w-[calc(100%-32px)] max-w-[360px] -translate-x-1/2 items-start justify-between gap-3 rounded-[16px] bg-[#141414]/95 p-3.5 px-4 text-white shadow-[0_10px_30px_rgba(0,0,0,0.35)] backdrop-blur-md border border-white/5 border-t-[2.5px] transition-all duration-300 ease-out",
"fixed top-3.5 left-1/2 z-[70] flex w-[calc(100%-32px)] max-w-[360px] -translate-x-1/2 items-start justify-between gap-3 rounded-[16px] bg-[#141414]/95 p-3.5 px-4 text-white shadow-[0_10px_30px_rgba(0,0,0,0.35)] backdrop-blur-md border border-white/5 border-t-[2.5px] transition-all duration-300 ease-out",
getBorderColor(),
isVisible
? "translate-y-0 opacity-100 scale-100"

Loading…
Cancel
Save