"use client"; import Image from "next/image"; import Link from "next/link"; import { useRouter } from "next/navigation"; import { useEffect, useMemo, useState } from "react"; import { useHabibWebReady } from "@/hooks/use-habib-web-ready"; import { LoadingThreeDot } from "@/components/Componentes/loading-three-dot"; import AdvisorActionsCard from "@/components/Componentes/advisor-actions-card"; import MarriageAdvisorsOverlay, { useMarriageAdvisorsOverlay, } from "@/components/Componentes/marriage-advisors-overlay"; import MatchProfileOverlay, { useMatchProfileOverlay, } from "@/components/Componentes/match-profile-overlay"; import PageHeader from "@/components/Componentes/page-header"; import { PageBackground } from "@/components/Componentes/page-background"; import { useMarriageProfileQuery } from "@/hooks/marriage/use-profile-main"; import { getSubmitPath } from "@/lib/get-submit-path"; import { localizePath } from "@/translations/config"; import { useI18n } from "@/translations/provider"; const advisorAvatars = [ { id: "advisor-primary", src: "/assets/images/Avatar Image.png" }, { id: "advisor-secondary", src: "/assets/images/Avatar Image.png" }, { id: "advisor-tertiary", src: "/assets/images/Avatar Image.png" }, ]; export default function RequestSentClient() { const router = useRouter(); const { dictionary: t, locale } = useI18n(); const { isAdvisorOpen, openAdvisors, closeAdvisors } = useMarriageAdvisorsOverlay(); const { isProfileOpen, openProfile, closeProfile } = useMatchProfileOverlay(); const [isOpeningProfile, setIsOpeningProfile] = useState(false); const { data: profile, isLoading } = useMarriageProfileQuery({ refetchInterval: 3000, }); useEffect(() => { if (!profile) { return; } const targetPath = getSubmitPath(profile); if (targetPath !== "/request-sent") { router.replace(localizePath(targetPath, locale)); } }, [profile, locale, router]); // Signal Flutter to lift its loading cover immediately with 0ms latency. useHabibWebReady(true); const isRedirecting = useMemo(() => { if (!profile) return false; return getSubmitPath(profile) !== "/request-sent"; }, [profile]); const handleOpenProfile = () => { if (profile) { openProfile(); } else { setIsOpeningProfile(true); } }; useEffect(() => { if (isOpeningProfile && profile) { setIsOpeningProfile(false); openProfile(); } }, [isOpeningProfile, profile, openProfile]); const copy = { advisorTitle: t["Get an advisor"], advisorDescription: t[ "Not sure what to do next? Our psychology section is here to guide you at every step." ], getAdvisor: t["Get Advisor"], }; const isFemaleProfile = profile?.gender === "female"; const requestSentCopy = { title: t["Request Sent"], description: isFemaleProfile ? t[ "Your request has been sent. Once the gentleman reviews your request, you will be notified." ] || "درخواست شما ارسال شد. پس از بررسی درخواست شما توسط آقا، به شما اطلاع‌رسانی خواهد شد." : t[ "Your request has been sent. Once the lady reviews your request, you will be notified." ], matchProfile: t["View More Details"], profileLocked: t["Profile is locked"], }; return ( <>
{/* Illustration */}
{/* soft glow */}
Request sent
{/* Title */}

{requestSentCopy.title}

{/* Description */}

{requestSentCopy.description}

{/* Button */}
lock

{requestSentCopy.profileLocked}

); }