From 61678091b3e9d100b0b0bcf22491e26338119d36 Mon Sep 17 00:00:00 2001 From: mortezaei Date: Tue, 22 Sep 2026 16:13:45 +0330 Subject: [PATCH] feat: add internationalization and RTL support across UI components and profile API requests --- src/app/new-match/new-match-client.tsx | 343 +++++++-------- src/app/new-match/profile/page.tsx | 37 +- .../[slug]/question-detail-client.tsx | 95 +++-- .../questions-list/questions-list-client.tsx | 153 +++++-- .../Componentes/call-result-sheet.tsx | 28 +- .../Componentes/dismiss-reason-sheet.tsx | 32 +- .../Componentes/female-consent-sheet.tsx | 11 +- .../Componentes/female-outcome-sheet.test.tsx | 45 ++ .../Componentes/female-outcome-sheet.tsx | 391 ++++++++++++++++-- .../Componentes/outcome-selection-sheet.tsx | 21 +- .../Componentes/slider-slide-four.tsx | 14 +- .../subscription-required-sheet.tsx | 17 +- src/components/Componentes/token-switcher.tsx | 209 +++++++++- src/hooks/marriage/use-profile-main.ts | 30 +- src/lib/marriage-field-formatter.test.ts | 65 +++ src/lib/marriage-field-formatter.ts | 160 ++++++- 16 files changed, 1259 insertions(+), 392 deletions(-) create mode 100644 src/lib/marriage-field-formatter.test.ts diff --git a/src/app/new-match/new-match-client.tsx b/src/app/new-match/new-match-client.tsx index f228e10..f3475e8 100644 --- a/src/app/new-match/new-match-client.tsx +++ b/src/app/new-match/new-match-client.tsx @@ -4,35 +4,35 @@ 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 { Ic } from "@/icons"; import AdvisorActionsCard from "@/components/Componentes/advisor-actions-card"; +import { DiscountWidget } from "@/components/Componentes/discount-widget"; +import ErrorToast from "@/components/Componentes/error-toast"; +import InformationSheet from "@/components/Componentes/information-sheet"; +import { LoadingSkeleton } from "@/components/Componentes/loading-skeleton"; +import { LoadingThreeDot } from "@/components/Componentes/loading-three-dot"; 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"; -import PageHeader from "@/components/Componentes/page-header"; import { PageBackground } from "@/components/Componentes/page-background"; -import InformationSheet from "@/components/Componentes/information-sheet"; +import PageHeader from "@/components/Componentes/page-header"; import SwipeButton from "@/components/Componentes/swipe-button"; -import { LoadingSkeleton } from "@/components/Componentes/loading-skeleton"; -import { LoadingThreeDot } from "@/components/Componentes/loading-three-dot"; -import { DiscountWidget } from "@/components/Componentes/discount-widget"; -import type { CheckDiscountResult } from "@/hooks/marriage/use-validate-discount"; -import { useHabcoinPaymentMutation } from "@/hooks/marriage/use-habcoin-payment"; -import { useHabcoinInventoryQuery } from "@/hooks/marriage/use-habcoin-inventory"; -import { useRespondToMarriageCaseMutation } from "@/hooks/marriage/use-case-respond"; import type { MarriageField, MarriageFieldValue, MarriageMatchSummary, MarriagePhoneFieldValue, } from "@/hooks/marriage/types"; +import { useRespondToMarriageCaseMutation } from "@/hooks/marriage/use-case-respond"; +import { useHabcoinInventoryQuery } from "@/hooks/marriage/use-habcoin-inventory"; +import { useHabcoinPaymentMutation } from "@/hooks/marriage/use-habcoin-payment"; import { useMarriageProfileQuery } from "@/hooks/marriage/use-profile-main"; +import type { CheckDiscountResult } from "@/hooks/marriage/use-validate-discount"; +import { useHabibWebReady } from "@/hooks/use-habib-web-ready"; import { useViewPaddings } from "@/hooks/use-view-paddings"; +import { Ic } from "@/icons"; import { getSubmitPath } from "@/lib/get-submit-path"; import { buyHabibCoinPackages, @@ -93,11 +93,7 @@ const fieldCandidateMatchers = { "education_level", "education", ], - fieldOfStudy: [ - "field_of_study", - "study_field", - "study", - ], + fieldOfStudy: ["field_of_study", "study_field", "study"], jobTitle: [ "job_title", "job_title_and_description", @@ -178,8 +174,8 @@ import { formatOptionValue, getOrderedSummaryFields, isMarriagePhoneFieldValue, - titleFromKey, type SummaryFieldItem, + titleFromKey, } from "@/lib/marriage-field-formatter"; function toDisplayField( @@ -594,121 +590,126 @@ export default function NewMatchClient() { }} className="min-h-0 flex-1 flex flex-col gap-4 pt-4 py-2 text-center" > - {/* 1. Header Section */} -
- -

- {matchHeadingTitle} -

-

- {matchHeadingDescription} -

-
- - {/* 2. Match Summary Card Section */} -
- {(isLoading || (!matchSummary && isFetching)) ? ( -
-
- -
- -
+ {/* 1. Header Section */} +
+ +

+ {matchHeadingTitle} +

+

+ {matchHeadingDescription} +

+
+ + {/* 2. Match Summary Card Section */} +
+ {isLoading || (!matchSummary && isFetching) ? ( +
+
+ +
+ +
-
- - -
+
+ + +
-
- {[1, 2, 3, 4, 5, 6, 7].map((i) => ( -
- -
- - -
-
- ))} - -
-
- ) : ( -
- {isError ? ( -

- Unable to load match summary. -

- ) : matchSummary ? ( - <> - {/* Top Curved Banner */} -
- {/* Bottom Curve */} - - - +
+ {[1, 2, 3, 4, 5, 6, 7].map((i) => ( +
+ +
+ +
+
+ ))} + +
+
+ ) : ( +
+ {isError ? ( +

+ Unable to load match summary. +

+ ) : matchSummary ? ( + <> + {/* Top Curved Banner */} +
+ {/* Bottom Curve */} + + + +
- {/* Circular Overlapping Avatar */} -
-
- candidate avatar -
+ {/* Circular Overlapping Avatar */} +
+
+ candidate avatar
+
+ + {/* Candidate Name & Heart Divider */} +
+

+ {matchDisplay.name} +

- {/* Candidate Name & Heart Divider */} -
-

- {matchDisplay.name} -

- -
- - - -
+
+ + +
+
- {/* Info Items List */} -
- {matchDisplay.items.map((item) => ( - } - /> - ))} - - {/* Button */} - -
- - ) : ( -

- No match summary is available yet. -

- )} -
- )} -
+ > + {isOpeningProfile ? ( + + ) : ( + <> + + {t["View more details"]} + + )} + +
+ + ) : ( +

+ No match summary is available yet. +

+ )} +
+ )} +
- {/* 3. Advisor Section */} -
- -
- + {/* 3. Advisor Section */} +
+ +
+ {profile?.can_edit_profile === false && (
-