Rollback analytics to ed1f129b07
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m5s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m5s
This commit is contained in:
@@ -7,7 +7,7 @@ import DateRangePicker from '../components/DateRangePicker';
|
||||
import type { ClientSortOption, ClientSummary } from '../analytics/clients';
|
||||
|
||||
const clientTypeStyles: Record<string, string> = {
|
||||
'Sem análise': 'border-zinc-500/30 bg-zinc-500/15 text-zinc-300',
|
||||
'Sem análise': 'border-zinc-600/30 bg-zinc-600/15 text-zinc-300',
|
||||
'Campeão': 'border-emerald-500/30 bg-emerald-500/15 text-emerald-300',
|
||||
'Potencial Leal': 'border-sky-500/30 bg-sky-500/15 text-sky-300',
|
||||
'Novo Cliente': 'border-cyan-500/30 bg-cyan-500/15 text-cyan-300',
|
||||
@@ -83,13 +83,12 @@ const Clients = () => {
|
||||
let isMounted = true;
|
||||
|
||||
const loadClients = async () => {
|
||||
const clientsData = await fetchClientAnalytics(dateRange);
|
||||
const [clientsData, rfmData] = await Promise.all([
|
||||
fetchClientAnalytics(dateRange),
|
||||
fetchRfmAnalytics(dateRange)
|
||||
]);
|
||||
if (isMounted) {
|
||||
setClientAnalytics(clientsData);
|
||||
}
|
||||
|
||||
const rfmData = await fetchRfmAnalytics(dateRange);
|
||||
if (isMounted) {
|
||||
setRfmAnalytics(rfmData);
|
||||
}
|
||||
};
|
||||
@@ -103,9 +102,9 @@ const Clients = () => {
|
||||
|
||||
const allClientsData = useMemo(() => {
|
||||
const normalizedSearch = searchTerm.trim().toLowerCase();
|
||||
const rfmByCustomerKey = new Map((rfmAnalytics?.clients || []).map(client => [client.customerKey, client]));
|
||||
const rfmByPhone = new Map((rfmAnalytics?.clients || []).map(client => [client.phone, client]));
|
||||
const clients = clientAnalytics.map((client): ClientSummary => {
|
||||
const rfmClient = rfmByCustomerKey.get(client.customerKey);
|
||||
const rfmClient = client.phone ? rfmByPhone.get(client.phone) : undefined;
|
||||
return {
|
||||
name: client.name,
|
||||
phone: client.phone,
|
||||
|
||||
@@ -292,7 +292,7 @@ const Rfm = () => {
|
||||
<div className="bg-dark-card p-6 rounded-2xl border border-dark-border shadow-sm">
|
||||
<p className="text-dark-muted text-sm font-medium mb-1">Clientes no Período</p>
|
||||
<h3 className="text-3xl font-bold text-dark-text">{clients.length}</h3>
|
||||
<p className="mt-1 text-xs font-semibold text-dark-muted">Segmento RFV calculado até o fim do período</p>
|
||||
<p className="mt-1 text-xs font-semibold text-dark-muted">Agrupados pela tag RFV anterior</p>
|
||||
</div>
|
||||
<div className="bg-dark-card p-6 rounded-2xl border border-dark-border shadow-sm">
|
||||
<p className="text-dark-muted text-sm font-medium mb-1">Receita no Período</p>
|
||||
@@ -312,7 +312,7 @@ const Rfm = () => {
|
||||
<div className="mb-4 flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between">
|
||||
<div>
|
||||
<h2 className="text-lg font-bold text-dark-text">Matriz RFV</h2>
|
||||
<p className="text-sm font-medium text-dark-muted">Compradores do período agrupados pelo RFV histórico até a data final.</p>
|
||||
<p className="text-sm font-medium text-dark-muted">Compradores do período agrupados pela tag RFV anterior ao período.</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 text-xs font-semibold text-dark-muted">
|
||||
<span>Menor prioridade</span>
|
||||
|
||||
Reference in New Issue
Block a user