diff --git a/messages/ar.json b/messages/ar.json index c13cfa5..bacdb47 100644 --- a/messages/ar.json +++ b/messages/ar.json @@ -515,13 +515,11 @@ "lookup": { "open": "تعبئة علاماتي باستخدام رقم الاكتتاب", "title": "استيراد علامات الامتحان", - "description": "للشهادات السورية العلمية والأدبية لعام 2026. اختر محافظة الامتحان والشهادة والمنهاج كما تظهر في تطبيق الوزارة.", + "description": "للشهادة الثانوية السورية لعام 2026، الفرعين العلمي والأدبي.", "directorate": "محافظة الامتحان", "certificate": "الشهادة والمنهاج", "number": "رقم الاكتتاب", "choose": "اختر من القائمة", - "privacy": "استخدم رقمك أو رقماً لديك إذن بالاستعلام عنه. يتصل متصفحك بخدمة نتائج الوزارة، وتعالج سوريا المفتوحة الرد المشفّر لتعبئة علاماتك دون الاحتفاظ برقمك أو بيانات هويتك. تتحقق Cloudflare من الطلب لمنع إساءة الاستخدام.", - "hint": "يمكنك دائماً إدخال العلامات يدوياً. محافظة الامتحان مستقلة عن مكان الدراسة الذي تفضّله.", "submit": "جلب العلامات وتعبئتها", "cancel": "العودة إلى النموذج", "retry": "إعادة المحاولة", diff --git a/messages/en.json b/messages/en.json index ff110b5..f4b76b9 100644 --- a/messages/en.json +++ b/messages/en.json @@ -515,13 +515,11 @@ "lookup": { "open": "Fill marks using my student number", "title": "Import your exam marks", - "description": "Syrian 2026 scientific and literary certificates. Choose the exam governorate and the exact certificate and curriculum shown in the Ministry app.", + "description": "For Syrian 2026 scientific and literary certificates.", "directorate": "Exam governorate", "certificate": "Certificate and curriculum", "number": "Student number", "choose": "Choose an option", - "privacy": "Use your own number or one you have permission to check. Your browser contacts the Ministry results service. OpenSyria processes the encrypted response to fill your marks; it does not retain your number or identity details. Cloudflare checks this request for abuse.", - "hint": "Manual entry is always available. Your exam governorate is separate from your preferred study location.", "submit": "Fetch and fill marks", "cancel": "Return to the form", "retry": "Try again", diff --git a/src/app/[locale]/admissions/_components/results-lookup.tsx b/src/app/[locale]/admissions/_components/results-lookup.tsx index 6084803..e98d58d 100644 --- a/src/app/[locale]/admissions/_components/results-lookup.tsx +++ b/src/app/[locale]/admissions/_components/results-lookup.tsx @@ -16,12 +16,7 @@ import { DialogTitle, DialogTrigger, } from "@/components/ui/dialog" -import { - Field, - FieldDescription, - FieldGroup, - FieldLabel, -} from "@/components/ui/field" +import { Field, FieldGroup, FieldLabel } from "@/components/ui/field" import { Input } from "@/components/ui/input" import { type CertificateOption, @@ -46,7 +41,8 @@ type Turnstile = { sitekey: string action: string cData: string - size: "compact" + size: "compact" | "flexible" + appearance: "interaction-only" language: string callback: (token: string) => void "expired-callback": () => void @@ -183,21 +179,37 @@ export function ResultsLookup({ !window.turnstile ) return - widget.current = window.turnstile.render(challengeRef.current, { - sitekey: session.siteKey, - action: "admissions_lookup", - cData: session.challenge, - size: "compact", - language: locale, - callback: setToken, - "expired-callback": () => setToken(""), - "error-callback": () => { - setToken("") - setError("challenge") - }, - }) + const container = challengeRef.current + const turnstile = window.turnstile + const { siteKey, challenge } = session + let size: "compact" | "flexible" | undefined + function render() { + const nextSize = container.clientWidth < 300 ? "compact" : "flexible" + if (size === nextSize) return + size = nextSize + if (widget.current) turnstile.remove(widget.current) + setToken("") + widget.current = turnstile.render(container, { + sitekey: siteKey, + action: "admissions_lookup", + cData: challenge, + size, + appearance: "interaction-only", + language: locale, + callback: setToken, + "expired-callback": () => setToken(""), + "error-callback": () => { + setToken("") + setError("challenge") + }, + }) + } + render() + const observer = new ResizeObserver(render) + observer.observe(container) return () => { - if (widget.current) window.turnstile?.remove(widget.current) + observer.disconnect() + if (widget.current) turnstile.remove(widget.current) widget.current = undefined } }, [open, session, ready, locale]) @@ -373,12 +385,8 @@ export function ResultsLookup({ autoComplete="off" maxLength={12} aria-invalid={error === "invalid"} - aria-describedby="exam-privacy" /> - - {t("privacy")} - {session ? ( <>