perf: load dashboard metrics from analytics API
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 50s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 50s
This commit is contained in:
@@ -7,7 +7,7 @@ import { buildClientDetailsMetrics } from '../analytics/clients';
|
||||
const ClientDetails = () => {
|
||||
const { name } = useParams<{ name: string }>();
|
||||
const decodedName = name ? decodeURIComponent(name) : '';
|
||||
const { ordersData } = useOutletContext<{ ordersData: OrderData[] }>();
|
||||
const { ordersData, isDataLoading } = useOutletContext<{ ordersData: OrderData[], isDataLoading: boolean }>();
|
||||
|
||||
const { groupedOrders, totalSpent, totalItems, clientPhone } = useMemo(() => {
|
||||
return buildClientDetailsMetrics(ordersData, decodedName);
|
||||
@@ -17,7 +17,7 @@ const ClientDetails = () => {
|
||||
return new Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(value);
|
||||
};
|
||||
|
||||
if (!groupedOrders.length && ordersData.length === 0) {
|
||||
if (!groupedOrders.length && isDataLoading) {
|
||||
return (
|
||||
<div className="text-center py-12">
|
||||
<p className="text-zinc-500 dark:text-dark-muted font-medium">Carregando cliente...</p>
|
||||
|
||||
Reference in New Issue
Block a user