Files
fin-tracker/app/lib/features/rebalance/labels.dart
T
Dmitry 322c60a359 style(app): остальные экраны под новый визуальный язык и форматирование
Доходы, ребалансировка, налоги, импорт, цели, здоровье данных, правила, транзакции, категории, cashflow, pending: новые виджеты и токены темы, dart format. Тесты подстроены под новые модели.
2026-09-19 22:14:27 +03:00

17 lines
753 B
Dart

import '../portfolio/labels.dart' show assetClassLabels;
/// Bucket labels keyed by the **wire** dimension string.
///
/// `features/portfolio/labels.dart` already has `bucketLabel`, but it takes the generated
/// `AllocationDimension` enum, and the rebalance routes are not in the spec yet — this
/// layer only has the plain string. Once `just gen-client` produces the enum, this helper
/// should give way to the existing one.
String bucketLabelForKey(String dimension, String bucket) {
if (bucket == 'cash') return 'Денежные средства';
if (bucket == 'unknown') return 'Не указано';
if (bucket.isEmpty) return '—';
return dimension == 'asset_class'
? (assetClassLabels[bucket] ?? bucket)
: bucket;
}