Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | 131x 131x 131x 131x 131x 205x 205x 205x 205x 204x 204x 204x 205x 194x 194x 197x 205x 194x 194x 205x 197x 154x 68x 68x 68x 68x 154x 96x 96x 96x 20x 20x 20x 20x 96x 131x 131x 131x 131x | import { Category } from '../store/flow-definition';
import { NODE_CONFIG } from './config';
import { SYSTEM_CATEGORIES_ALLOWED_FOR_TRANSLATION } from './categoryUtils';
export function getTranslatableCategoriesForNode(
nodeType: string | undefined,
categories: Category[] | undefined
): Category[] {
if (!nodeType || !categories?.length) {
return [];
}
const config = NODE_CONFIG[nodeType];
const blocked = config?.nonTranslatableCategories;
if (!blocked) {
return [...categories];
}
if (blocked === 'all') {
return categories.filter((category) =>
SYSTEM_CATEGORIES_ALLOWED_FOR_TRANSLATION.has(category.name)
);
}
const blockedSet = new Set(blocked);
return categories.filter(
(category) =>
!blockedSet.has(category.name) ||
SYSTEM_CATEGORIES_ALLOWED_FOR_TRANSLATION.has(category.name)
);
}
export function hasTranslatableCategoriesForNode(
nodeType: string | undefined,
categories: Category[] | undefined
): boolean {
return getTranslatableCategoriesForNode(nodeType, categories).length > 0;
}
|