Browse Source

fix page

master
mortezaei 9 hours ago
parent
commit
70d3fe6394
  1. 2
      src/app/candidate-contact/candidate-contact-client.tsx
  2. 6
      src/app/new-match/new-match-client.tsx
  3. 13
      src/app/new-match/profile/page.tsx
  4. 5
      src/app/request-accepted/request-accepted-client.tsx
  5. 1
      src/app/request-sent/request-sent-client.tsx
  6. 5
      src/components/Componentes/match-profile-overlay.tsx
  7. 2
      src/hooks/marriage/use-profile-main.ts

2
src/app/candidate-contact/candidate-contact-client.tsx

@ -313,6 +313,7 @@ export default function CandidateContactClient() {
<MatchProfileOverlay <MatchProfileOverlay
open={isProfileOpen} open={isProfileOpen}
profile={profile}
onClose={closeProfile} onClose={closeProfile}
/> />
</> </>
@ -405,6 +406,7 @@ export default function CandidateContactClient() {
<MatchProfileOverlay <MatchProfileOverlay
open={isProfileOpen} open={isProfileOpen}
profile={profile}
onClose={closeProfile} onClose={closeProfile}
/> />
</> </>

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

@ -1144,7 +1144,11 @@ export default function NewMatchClient() {
<MarriageAdvisorsOverlay open={isAdvisorOpen} onClose={closeAdvisors} /> <MarriageAdvisorsOverlay open={isAdvisorOpen} onClose={closeAdvisors} />
<MatchProfileOverlay open={isProfileOpen} onClose={closeProfile} />
<MatchProfileOverlay
open={isProfileOpen}
profile={profile}
onClose={closeProfile}
/>
{showPaymentSuccessToast && ( {showPaymentSuccessToast && (
<ErrorToast <ErrorToast

13
src/app/new-match/profile/page.tsx

@ -266,10 +266,12 @@ function formatBoldText(text: string) {
type NewMatchProfilePageProps = { type NewMatchProfilePageProps = {
onClose?: () => void; onClose?: () => void;
profile?: MarriageProfile;
}; };
export default function NewMatchProfilePage({ export default function NewMatchProfilePage({
onClose, onClose,
profile: profileProp,
}: NewMatchProfilePageProps = {}) { }: NewMatchProfilePageProps = {}) {
const { dictionary: t, locale } = useI18n(); const { dictionary: t, locale } = useI18n();
const router = useRouter(); const router = useRouter();
@ -280,10 +282,15 @@ export default function NewMatchProfilePage({
const [isDismissReasonSheetOpen, setIsDismissReasonSheetOpen] = const [isDismissReasonSheetOpen, setIsDismissReasonSheetOpen] =
useState(false); useState(false);
const { const {
data: profile,
isLoading,
data: queriedProfile,
isLoading: isQueryLoading,
refetch: refetchProfile, refetch: refetchProfile,
} = useMarriageProfileQuery();
} = useMarriageProfileQuery({
enabled: !profileProp,
});
const profile = profileProp ?? queriedProfile;
const isLoading = !profileProp && isQueryLoading;
useEffect(() => { useEffect(() => {
if (!profile) { if (!profile) {

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

@ -245,9 +245,7 @@ export default function RequestAcceptedClient() {
useState(false); useState(false);
const [showPaymentSuccessToast, setShowPaymentSuccessToast] = useState(false); const [showPaymentSuccessToast, setShowPaymentSuccessToast] = useState(false);
const profileHref = localizePath("/new-match/profile", locale); const profileHref = localizePath("/new-match/profile", locale);
const { data: profile, isLoading } = useMarriageProfileQuery({
refetchInterval: 3000,
});
const { data: profile, isLoading } = useMarriageProfileQuery();
const isFemaleProfile = profile?.gender === "female"; const isFemaleProfile = profile?.gender === "female";
const contactSharedAtStr = profile?.active_case?.contact_shared_at; const contactSharedAtStr = profile?.active_case?.contact_shared_at;
@ -839,6 +837,7 @@ export default function RequestAcceptedClient() {
<MatchProfileOverlay <MatchProfileOverlay
open={isProfileOpen} open={isProfileOpen}
profile={profile}
onClose={closeProfile} onClose={closeProfile}
/> />

1
src/app/request-sent/request-sent-client.tsx

@ -171,6 +171,7 @@ export default function RequestSentClient() {
<MatchProfileOverlay <MatchProfileOverlay
open={isProfileOpen} open={isProfileOpen}
profile={profile}
onClose={closeProfile} onClose={closeProfile}
/> />
</> </>

5
src/components/Componentes/match-profile-overlay.tsx

@ -4,10 +4,12 @@ import { useCallback, useEffect, useState } from "react";
import NewMatchProfilePage from "@/app/new-match/profile/page"; import NewMatchProfilePage from "@/app/new-match/profile/page";
import SectionOverlayHost from "@/components/Componentes/section-overlay-host"; import SectionOverlayHost from "@/components/Componentes/section-overlay-host";
import { useHardwareBackHandler } from "@/hooks/use-hardware-back-handler"; import { useHardwareBackHandler } from "@/hooks/use-hardware-back-handler";
import type { MarriageProfile } from "@/hooks/marriage/types";
export type MatchProfileOverlayProps = { export type MatchProfileOverlayProps = {
open: boolean; open: boolean;
onClose: () => void; onClose: () => void;
profile?: MarriageProfile;
}; };
/** /**
@ -66,10 +68,11 @@ export function useMatchProfileOverlay() {
export function MatchProfileOverlay({ export function MatchProfileOverlay({
open, open,
onClose, onClose,
profile,
}: MatchProfileOverlayProps) { }: MatchProfileOverlayProps) {
return ( return (
<SectionOverlayHost open={open} onClose={onClose}> <SectionOverlayHost open={open} onClose={onClose}>
<NewMatchProfilePage onClose={onClose} />
<NewMatchProfilePage onClose={onClose} profile={profile} />
</SectionOverlayHost> </SectionOverlayHost>
); );
} }

2
src/hooks/marriage/use-profile-main.ts

@ -45,7 +45,7 @@ export function useMarriageProfileQuery<TData = MarriageProfileResponse>(
options?: QueryOptions<MarriageProfileResponse, TData>, options?: QueryOptions<MarriageProfileResponse, TData>,
) { ) {
const query = useQuery({ const query = useQuery({
staleTime: 10 * 1000,
staleTime: 5 * 60 * 1000,
refetchOnWindowFocus: false, refetchOnWindowFocus: false,
...options, ...options,
queryFn: getMarriageProfile, queryFn: getMarriageProfile,

Loading…
Cancel
Save