From f33da82c29f43d80e26bdd1f05759a5878359135 Mon Sep 17 00:00:00 2001 From: sepehr Date: Sun, 31 May 2026 11:24:52 +0200 Subject: [PATCH] fix(frontend): improve glossary selector responsiveness and add contextual warning logic --- .../dashboard/translate/GlossarySelector.tsx | 89 ++++++++++++------- 1 file changed, 58 insertions(+), 31 deletions(-) diff --git a/frontend/src/app/dashboard/translate/GlossarySelector.tsx b/frontend/src/app/dashboard/translate/GlossarySelector.tsx index 03731ff..c1e5877 100644 --- a/frontend/src/app/dashboard/translate/GlossarySelector.tsx +++ b/frontend/src/app/dashboard/translate/GlossarySelector.tsx @@ -309,6 +309,31 @@ export function GlossarySelector({ sourceLang, targetLang, isPro, mode, glossary ) : isGlossaryEnabled ? (
+ {/* Help Info text */} +

+ Le glossaire force la traduction de termes précis. Choisissez un glossaire dont la langue source correspond à la langue d'origine de votre document. +

+ + {/* Mismatch Warning */} + {selected && sourceLang !== 'auto' && selected.source_language !== sourceLang && ( +
+ ⚠️ + + Attention : Ce glossaire utilise la langue source {getFlag(selected.source_language)} {selected.source_language.toUpperCase()}, mais votre document est configuré en {getFlag(sourceLang)} {sourceLang.toUpperCase()}. + +
+ )} + + {/* Incompatibility Warning */} + {selected && selected.source_language === targetLang && ( +
+ ⚠️ + + Incompatibilité : La langue source du glossaire est identique à la langue cible de traduction ({getFlag(targetLang)}). Les termes ne seront pas appliqués correctement. + +
+ )} + {/* Select Glossary Trigger button */}
)} @@ -524,7 +549,7 @@ export function GlossarySelector({ sourceLang, targetLang, isPro, mode, glossary {/* Ultra-neat Quick Term Adder */} {selected && ( -
+ setNewSource(e.target.value)} disabled={isAddingTerm || disabled} - className="flex-1 bg-white dark:bg-[#1a1a1a] border border-black/5 dark:border-white/5 rounded-lg px-2.5 py-1.5 text-xs font-semibold text-brand-dark dark:text-white placeholder:text-brand-dark/30 outline-none focus:border-brand-accent" + className="w-full bg-white dark:bg-[#1a1a1a] border border-black/5 dark:border-white/5 rounded-lg px-2.5 py-1.5 text-xs font-semibold text-brand-dark dark:text-white placeholder:text-brand-dark/30 outline-none focus:border-brand-accent min-w-0" /> - setNewTarget(e.target.value)} - disabled={isAddingTerm || disabled} - className="flex-1 bg-white dark:bg-[#1a1a1a] border border-black/5 dark:border-white/5 rounded-lg px-2.5 py-1.5 text-xs font-semibold text-brand-dark dark:text-white placeholder:text-brand-dark/30 outline-none focus:border-brand-accent" - /> - +
+ setNewTarget(e.target.value)} + disabled={isAddingTerm || disabled} + className="flex-1 bg-white dark:bg-[#1a1a1a] border border-black/5 dark:border-white/5 rounded-lg px-2.5 py-1.5 text-xs font-semibold text-brand-dark dark:text-white placeholder:text-brand-dark/30 outline-none focus:border-brand-accent min-w-0" + /> + +
)}