feat(glossary): restructure page with tabs, direct translate redirects and dynamic mapping
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m39s
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m39s
This commit is contained in:
@@ -83,9 +83,30 @@ export function useTranslationConfig(hasFile: boolean): UseTranslationConfigRetu
|
||||
// Reset glossary selection when source language changes
|
||||
// (multilingual glossaries are compatible with any target language)
|
||||
useEffect(() => {
|
||||
// If there is a query param, do not reset it on first load
|
||||
const params = new URLSearchParams(typeof window !== 'undefined' ? window.location.search : '');
|
||||
if (params.get('glossaryId') === glossaryId) return;
|
||||
setGlossaryId(null);
|
||||
}, [sourceLang]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
// Pre-select glossary and LLM provider from query parameter
|
||||
useEffect(() => {
|
||||
if (typeof window === 'undefined' || isLoadingProviders || availableProviders.length === 0) return;
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const qGlossaryId = params.get('glossaryId');
|
||||
if (qGlossaryId) {
|
||||
setGlossaryId(qGlossaryId);
|
||||
|
||||
const p = availableProviders.find((ap) => ap.id === provider);
|
||||
if (!p || p.mode !== 'llm') {
|
||||
const firstLlm = availableProviders.find((ap) => ap.mode === 'llm');
|
||||
if (firstLlm) {
|
||||
setProvider(firstLlm.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, [isLoadingProviders, availableProviders, provider]);
|
||||
|
||||
// Fetch available (admin-configured) providers
|
||||
useEffect(() => {
|
||||
const controller = new AbortController();
|
||||
|
||||
Reference in New Issue
Block a user