Improve frontend panel de control

This commit is contained in:
Urtzi Alfaro
2025-11-20 22:10:16 +01:00
parent 80298b61b2
commit 2ee94fb4b1
9 changed files with 117 additions and 74 deletions

View File

@@ -94,14 +94,15 @@ function translateKey(
if (key.startsWith('reasoning.')) {
// Remove 'reasoning.' prefix and use reasoning namespace
const translationKey = key.substring('reasoning.'.length);
return tReasoning(translationKey, { ...processedParams, defaultValue: key });
// Use i18next-icu for interpolation with {variable} syntax
return String(tReasoning(translationKey, processedParams));
} else if (key.startsWith('action_queue.') || key.startsWith('dashboard.') || key.startsWith('health.')) {
// Use dashboard namespace
return tDashboard(key, { ...processedParams, defaultValue: key });
return String(tDashboard(key, processedParams));
}
// Default to dashboard
return tDashboard(key, { ...processedParams, defaultValue: key });
return String(tDashboard(key, processedParams));
}
function ActionItemCard({

View File

@@ -55,7 +55,10 @@ function TimelineItemCard({
translationKey = key.substring('production.'.length);
namespace = 'production';
}
return { reasoning: t(translationKey, { ...params, ns: namespace, defaultValue: item.reasoning || '' }) };
// Use i18next-icu for interpolation with {variable} syntax
const fullKey = `${namespace}:${translationKey}`;
const result = t(fullKey, params);
return { reasoning: String(result || item.reasoning || '') };
} else if (item.reasoning_data) {
return formatBatchAction(item.reasoning_data);
}
@@ -112,11 +115,15 @@ function TimelineItemCard({
<div className="flex items-center justify-between mb-1">
<span className="text-sm font-medium" style={{ color: 'var(--text-primary)' }}>
{item.status_i18n
? t(item.status_i18n.key, {
...item.status_i18n.params,
ns: item.status_i18n.key.startsWith('production.') ? 'production' : 'reasoning',
defaultValue: item.statusText || 'Status'
})
? (() => {
const statusKey = item.status_i18n.key;
const statusNamespace = statusKey.startsWith('production.') ? 'production' : 'reasoning';
const statusTranslationKey = statusKey.startsWith('production.')
? statusKey.substring('production.'.length)
: (statusKey.startsWith('reasoning.') ? statusKey.substring('reasoning.'.length) : statusKey);
const fullStatusKey = `${statusNamespace}:${statusTranslationKey}`;
return String(t(fullStatusKey, item.status_i18n.params) || item.statusText || 'Status');
})()
: item.statusText || 'Status'}
</span>
{item.status === 'IN_PROGRESS' && (