From ae1c8305172ce49aa10999878d02a6d5e7cd6eea Mon Sep 17 00:00:00 2001 From: ghorbani Date: Mon, 3 Aug 2026 17:04:27 +0330 Subject: [PATCH] feat: implement multi-language infrastructure and dynamic question components for marriage matching system --- src/app/api/dev-reset-profile/route.ts | 8 +- src/app/api/proxy/route.ts | 10 +- src/app/finding-match/page.tsx | 4 +- src/app/globals.css | 107 ++-- src/app/intro/page.tsx | 55 +- src/app/page.tsx | 4 +- src/app/questions-list/page.tsx | 4 +- src/components/Componentes/notice-box.tsx | 22 +- .../Componentes/question-dropdown.tsx | 11 +- src/components/Componentes/question-radio.tsx | 40 +- .../Componentes/question-section-flow.tsx | 8 +- .../Componentes/question-snap-list.tsx | 1 - .../Componentes/required-steps-card.tsx | 5 +- src/components/Componentes/slider-header.tsx | 26 + src/components/Componentes/slider-page.tsx | 94 ++- .../Componentes/slider-slide-five.tsx | 6 +- .../Componentes/slider-slide-four.tsx | 20 +- .../Componentes/slider-slide-one.tsx | 390 ++++++++++-- .../Componentes/slider-slide-three.tsx | 19 +- .../Componentes/slider-slide-two.tsx | 37 +- src/components/Componentes/token-switcher.tsx | 17 +- src/components/Componentes/video-player.tsx | 90 +++ src/data/questions/en.json | 588 ++++-------------- src/data/questions/fa.json | 588 ++++-------------- src/hooks/marriage/use-marriage-config.ts | 1 + src/hooks/marriage/use-section-data.ts | 40 +- src/lib/auth-bridge.ts | 16 +- src/lib/http.ts | 22 +- src/translations/locales/ar.json | 2 +- src/translations/locales/az.json | 2 +- src/translations/locales/bn.json | 2 +- src/translations/locales/da.json | 2 +- src/translations/locales/de.json | 2 +- src/translations/locales/en.json | 2 +- src/translations/locales/es.json | 2 +- src/translations/locales/fa.json | 2 +- src/translations/locales/fr.json | 2 +- src/translations/locales/gu.json | 2 +- src/translations/locales/ha.json | 2 +- src/translations/locales/he.json | 2 +- src/translations/locales/hi.json | 2 +- src/translations/locales/id.json | 2 +- src/translations/locales/ks.json | 2 +- src/translations/locales/pt.json | 2 +- src/translations/locales/ru.json | 2 +- src/translations/locales/sw.json | 2 +- src/translations/locales/tg.json | 2 +- src/translations/locales/tr.json | 2 +- src/translations/locales/ul.json | 2 +- src/translations/locales/ur.json | 2 +- src/translations/locales/uz.json | 2 +- src/translations/locales/zh.json | 2 +- 52 files changed, 1026 insertions(+), 1255 deletions(-) create mode 100644 src/components/Componentes/slider-header.tsx create mode 100644 src/components/Componentes/video-player.tsx diff --git a/src/app/api/dev-reset-profile/route.ts b/src/app/api/dev-reset-profile/route.ts index b61154b..799273d 100644 --- a/src/app/api/dev-reset-profile/route.ts +++ b/src/app/api/dev-reset-profile/route.ts @@ -18,7 +18,8 @@ export async function POST(request: NextRequest) { return Response.json({ error: "userId is required" }, { status: 400 }); } - const scriptPath = "C:\\Users\\User\\.gemini\\antigravity-ide\\brain\\5015ea2d-f1fc-4e3d-9372-4bb0670449cc\\scratch\\reset_user.py"; + const scriptPath = + "C:\\Users\\User\\.gemini\\antigravity-ide\\brain\\5015ea2d-f1fc-4e3d-9372-4bb0670449cc\\scratch\\reset_user.py"; // Construct the command safely with numeric userId const command = `python "${scriptPath}" ${Number(userId)}`; const { stdout, stderr } = await execAsync(command); @@ -36,6 +37,9 @@ export async function POST(request: NextRequest) { } } catch (error: any) { console.error("Failed to reset profile:", error); - return Response.json({ error: error.message || "Internal Server Error" }, { status: 500 }); + return Response.json( + { error: error.message || "Internal Server Error" }, + { status: 500 }, + ); } } diff --git a/src/app/api/proxy/route.ts b/src/app/api/proxy/route.ts index 464d650..28cd2bf 100644 --- a/src/app/api/proxy/route.ts +++ b/src/app/api/proxy/route.ts @@ -131,7 +131,7 @@ function getRequestHeaders(request: NextRequest, targetUrl: URL) { getCookieValue(cookieHeader, "token") ?? getCookieValue(cookieHeader, "auth_token"); - if (cookieToken) { + if (cookieToken && cookieToken !== "NO_TOKEN") { headers.set("authorization", `Token ${cookieToken}`); } } @@ -141,6 +141,14 @@ function getRequestHeaders(request: NextRequest, targetUrl: URL) { headers.set("authorization", `Token ${authKey}`); } + // Fall back to the development default token when nothing else provided auth. + if (!headers.has("authorization")) { + const defaultToken = process.env.NEXT_PUBLIC_DEFAULT_TOKEN; + if (defaultToken && defaultToken !== "NO_TOKEN") { + headers.set("authorization", `Token ${defaultToken}`); + } + } + // Dynamically set language headers let lang = getCookieValue(cookieHeader, "HABIB_LANGUAGE") ?? diff --git a/src/app/finding-match/page.tsx b/src/app/finding-match/page.tsx index 7ee7247..1c9cd1c 100644 --- a/src/app/finding-match/page.tsx +++ b/src/app/finding-match/page.tsx @@ -89,7 +89,9 @@ export default function FindingMatchPage() { role="status" >