From 55c9dc5473aedccf8918c37555d0221566f0ed7c Mon Sep 17 00:00:00 2001 From: ghorbani Date: Sat, 15 Aug 2026 12:44:45 +0330 Subject: [PATCH] feat: implement profile section listing and synchronization logic with match start trigger --- src/app/questions-list/page.tsx | 2 +- src/components/Componentes/question-date.tsx | 38 ++++++++++++-------- src/hooks/marriage/use-match-start.ts | 2 +- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/app/questions-list/page.tsx b/src/app/questions-list/page.tsx index cf4c0d1..78dca41 100644 --- a/src/app/questions-list/page.tsx +++ b/src/app/questions-list/page.tsx @@ -225,7 +225,7 @@ export default function QuestionsListPage() { } } - await queryClient.invalidateQueries(); + queryClient.invalidateQueries(); startMatchMutation.mutate(); } catch (err) { console.error("Failed to sync pending sections:", err); diff --git a/src/components/Componentes/question-date.tsx b/src/components/Componentes/question-date.tsx index 57ab4d9..caa559b 100644 --- a/src/components/Componentes/question-date.tsx +++ b/src/components/Componentes/question-date.tsx @@ -12,19 +12,19 @@ type QuestionDateProps = { disabled?: boolean; }; -const MONTHS = [ - { value: "01", label: "01 - January" }, - { value: "02", label: "02 - February" }, - { value: "03", label: "03 - March" }, - { value: "04", label: "04 - April" }, - { value: "05", label: "05 - May" }, - { value: "06", label: "06 - June" }, - { value: "07", label: "07 - July" }, - { value: "08", label: "08 - August" }, - { value: "09", label: "09 - September" }, - { value: "10", label: "10 - October" }, - { value: "11", label: "11 - November" }, - { value: "12", label: "12 - December" }, +const MONTH_VALUES = [ + "01", + "02", + "03", + "04", + "05", + "06", + "07", + "08", + "09", + "10", + "11", + "12", ]; const DAYS = Array.from({ length: 31 }, (_, i) => { @@ -50,6 +50,16 @@ export function QuestionDate({ const value = getAnswerValue(question, questionIndex); const dateValue = typeof value === "string" ? value : ""; + const months = useMemo(() => { + return MONTH_VALUES.map((val, idx) => { + const date = new Date(2000, idx, 15); + const label = new Intl.DateTimeFormat(`${locale}-u-ca-gregory`, { + month: "long", + }).format(date); + return { value: val, label }; + }); + }, [locale]); + const [selectedYear, setSelectedYear] = useState(() => { const parts = dateValue ? dateValue.split("-") : []; return parts[0] || ""; @@ -170,7 +180,7 @@ export function QuestionDate({ className="h-[54px] w-full cursor-pointer rounded-[16px] border border-[#D0D5DD] bg-white px-3 text-[15px] font-medium text-[#181818] outline-none transition-all hover:border-[#98A2B3] focus:border-[#6F6F6F] focus:ring-1 focus:ring-[#6F6F6F]" > - {MONTHS.map((m) => ( + {months.map((m) => ( diff --git a/src/hooks/marriage/use-match-start.ts b/src/hooks/marriage/use-match-start.ts index e5da39d..263dbd6 100644 --- a/src/hooks/marriage/use-match-start.ts +++ b/src/hooks/marriage/use-match-start.ts @@ -23,7 +23,7 @@ export function useStartMarriageMatchMutation( ...options, mutationFn: startMarriageMatch, onSuccess: async (data, variables, onMutateResult, context) => { - await Promise.all([ + Promise.all([ queryClient.invalidateQueries({ queryKey: marriageQueryKeys.profile(), }),