feat: enhance category handling with new category chip logic and user-specific product categorization
Test Suite / test (24.15.0) (push) Has been cancelled

This commit is contained in:
Nils-Johan Gynther
2026-05-11 22:03:09 +02:00
parent f19c157e8f
commit cd84e25890
5 changed files with 110 additions and 27 deletions
+21 -1
View File
@@ -4,6 +4,26 @@ String? normalizedOptionalText(String? value) {
return normalized;
}
String l1CategoryChipLabel(String prefix, String l1Category) => '$prefix$l1Category';
({String label, String tooltip}) categoryChipText({
required String? categoryPath,
required String fallbackL1,
}) {
final path = categoryPath?.trim();
if (path == null || path.isEmpty) {
return (label: fallbackL1, tooltip: fallbackL1);
}
final parts = path
.split('>')
.map((part) => part.trim())
.where((part) => part.isNotEmpty)
.toList();
if (parts.isEmpty) {
return (label: fallbackL1, tooltip: fallbackL1);
}
return (label: parts.last, tooltip: parts.join(' > '));
}
String locationLabel(String prefix, String location) => '$prefix$location';