Format product color labels
This commit is contained in:
@@ -4,11 +4,13 @@ import { DollarSign, Package, Palette, Ruler, TrendingDown, TrendingUp, Warehous
|
||||
import BackButton from '../components/BackButton';
|
||||
import DateRangePicker from '../components/DateRangePicker';
|
||||
import PaginationControls from '../components/PaginationControls';
|
||||
import ProductColorBadge, { ProductColorSwatch, getProductColor } from '../components/ProductColorBadge';
|
||||
import ProductColorBadge, { ProductColorSwatch } from '../components/ProductColorBadge';
|
||||
import RefreshStatus from '../components/RefreshStatus';
|
||||
import { buildOpenProductionByProductId } from '../analytics/cutting';
|
||||
import { fetchProductAnalytics, fetchProductionOrders } from '../dataService';
|
||||
import { decodeProductGroupKey, normalizeProductText, parseProductName } from '../productParsing';
|
||||
import { formatColorLabel } from '../displayFormatters';
|
||||
import { getProductColor } from '../productColors';
|
||||
import type { DateRange, ProductAnalyticsItem, ProductionOrderItem } from '../types';
|
||||
|
||||
type VariantRow = ProductAnalyticsItem & {
|
||||
@@ -121,13 +123,14 @@ const BreakdownPanel = ({
|
||||
{visibleRows.map(row => {
|
||||
const width = maxSold ? Math.max(4, (row.quantitySold / maxSold) * 100) : 0;
|
||||
const barColor = type === 'color' ? getBarColor(row.label) : '#25c2ff';
|
||||
const displayLabel = type === 'color' ? formatColorLabel(row.label) : row.label;
|
||||
|
||||
return (
|
||||
<div key={row.label} className="grid grid-cols-[minmax(7.5rem,9rem)_1fr_6rem] items-center gap-3">
|
||||
<div className="flex min-w-0 items-center gap-2">
|
||||
{type === 'color' ? <ProductColorSwatch label={row.label} /> : <span className="h-2.5 w-2.5 shrink-0 rounded-sm bg-sky-400" />}
|
||||
<span className="truncate text-xs font-bold text-dark-text" title={row.label}>
|
||||
{type === 'size' && row.label !== 'Sem tamanho' ? `Tam. ${row.label}` : row.label}
|
||||
<span className="truncate text-xs font-bold text-dark-text" title={displayLabel}>
|
||||
{type === 'size' && row.label !== 'Sem tamanho' ? `Tam. ${row.label}` : displayLabel}
|
||||
</span>
|
||||
</div>
|
||||
<div className="h-3 overflow-hidden rounded-full border border-dark-border bg-dark-input">
|
||||
|
||||
Reference in New Issue
Block a user