ux(glossaries): simplify dialog, auto-save detail import, show templates and upload zone directly on main page
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m6s

This commit is contained in:
2026-06-20 12:27:07 +02:00
parent d505b479cd
commit 1fe714aa1a
3 changed files with 314 additions and 432 deletions

View File

@@ -237,6 +237,7 @@ export default function GlossaryDetailPage() {
const handleImportClick = () => fileInputRef.current?.click();
const handleFileChange = async (e: React.ChangeEvent<HTMLInputElement>) => {
if (!glossary) return;
const file = e.target.files?.[0];
if (!file) return;
e.target.value = '';
@@ -260,17 +261,24 @@ export default function GlossaryDetailPage() {
});
return;
}
// Auto-save immediately to DB
await updateGlossary(glossary.id, {
name: name.trim(),
source_language: sourceLanguage,
target_language: targetLanguage,
terms: parsed,
});
setTerms(parsed);
toast({
title: t('glossaries.detail.importedTitle') || 'Importé',
description: t('glossaries.detail.importedDesc', { count: String(parsed.length) }) ||
`${parsed.length} termes importés.`,
`${parsed.length} termes importés et enregistrés.`,
});
} catch {
toast({
variant: 'destructive',
title: t('glossaries.detail.importErrorTitle') || 'Erreur',
description: t('glossaries.detail.importErrorDesc') || 'Impossible de lire le fichier.',
title: t('glossaries.toast.error') || 'Erreur',
description: t('glossaries.toast.errorUpdate') || 'Impossible de mettre à jour le glossaire.',
});
}
};