Clean seller metadata display names
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 40s

This commit is contained in:
Cauê Faleiros
2026-06-24 13:03:55 -03:00
parent b129307bae
commit ca9615a1fd
5 changed files with 57 additions and 13 deletions

View File

@@ -5,6 +5,7 @@ import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContaine
import DateRangePicker from '../components/DateRangePicker';
import type { ClientDetailsAnalytics, DateRange, OrderData } from '../types';
import { fetchClientDetailsAnalytics } from '../dataService';
import { formatDisplayName, removeTrailingSellerId } from '../displayFormatters';
type CustomTooltipProps = {
active?: boolean;
@@ -27,14 +28,11 @@ const CustomTooltip = ({ active, payload, label }: CustomTooltipProps) => {
};
const getOrderMetadata = (order: OrderData) => {
const seller = [
order.nome_vendedor,
order.id_vendedor ? `#${order.id_vendedor}` : ''
].filter(Boolean).join(' ');
const sellerName = formatDisplayName(removeTrailingSellerId(order.nome_vendedor || ''));
return [
order.cliente_nome_fantasia ? `Fantasia: ${order.cliente_nome_fantasia}` : '',
seller ? `Vendedor: ${seller}` : '',
order.cliente_nome_fantasia ? `Fantasia: ${formatDisplayName(order.cliente_nome_fantasia)}` : '',
sellerName ? `Vendedor: ${sellerName}` : '',
order.marketplace ? `Marketplace: ${order.marketplace}` : '',
order.canal_venda ? `Canal: ${order.canal_venda}` : '',
order.numero_ecommerce ? `E-commerce: ${order.numero_ecommerce}` : ''

View File

@@ -5,6 +5,7 @@ import type { ClientAnalyticsItem, ClientFilterOptions, ClientMetadataFilters, D
import { fetchClientAnalytics, fetchClientFilterOptions, fetchRfmAnalytics, getCachedClientAnalytics, getCachedClientFilterOptions, getCachedRfmAnalytics } from '../dataService';
import { endOfLocalDay, formatDateParam, parseLocalDateInput, rangeForDay, rangeForLastDays, rangeForPreviousDay, startOfLocalDay } from '../dateRanges';
import type { ClientSortOption, ClientSummary } from '../analytics/clients';
import { formatDisplayName, removeTrailingSellerId } from '../displayFormatters';
const clientTypeStyles: Record<string, string> = {
'Sem análise': 'border-zinc-600/30 bg-zinc-600/15 text-zinc-300',
@@ -318,8 +319,7 @@ const Clients = () => {
};
const getSellerOptionLabel = (seller: ClientFilterOptions['sellers'][number]) => {
if (seller.id && seller.name && seller.id !== seller.name) return `${seller.name} (${seller.id})`;
return seller.name || seller.id;
return formatDisplayName(removeTrailingSellerId(seller.name || seller.id));
};
const marketplaceOptions = useMemo(() => {