/** * Automation2 Flow Editor - Utility functions */ import type React from 'react'; import { CATEGORY_ICONS, DEFAULT_CATEGORY_ICON } from './categoryIcons'; /** Resolve localized label from string or { de, en, fr } object */ export function getLabel( text: string | Record | undefined, lang = 'de' ): string { if (!text) return ''; if (typeof text === 'string') return text; const rec = text as Record; return rec[lang] ?? rec.en ?? ''; } /** Get icon for a category */ export function getCategoryIcon(categoryId: string): React.ReactNode { return CATEGORY_ICONS[categoryId] ?? DEFAULT_CATEGORY_ICON; } /** Function type for resolving localized labels */ export type GetLabelFn = (text: string | Record | undefined, lang?: string) => string;