From c4092766988a83fdb195c6cef9f064ff0267109e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Wed, 6 May 2026 15:45:24 -0300 Subject: [PATCH] feat: unify chart legend styles and fix dynamic tooltip colors --- src/pages/Dashboard.tsx | 26 +++++++++++++++++--------- src/pages/ProductDetails.tsx | 2 +- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/pages/Dashboard.tsx b/src/pages/Dashboard.tsx index a076ca6..32ad739 100644 --- a/src/pages/Dashboard.tsx +++ b/src/pages/Dashboard.tsx @@ -54,7 +54,10 @@ const Dashboard = () => { const productsData = Object.keys(productSalesMap).map(key => ({ name: key, value: productSalesMap[key] - })).sort((a, b) => b.value - a.value).slice(0, 10); + })).sort((a, b) => b.value - a.value).slice(0, 10).map((item, index) => ({ + ...item, + fill: COLORS[index % COLORS.length] + })); return { totalRevenue: revenue, totalOrders: totalItems, averageOrderValue: revenue / (filteredData.length || 1), salesByProduct: productsData }; }, [filteredData]); @@ -112,18 +115,15 @@ const Dashboard = () => {
-
+

Produtos Mais Vendidos

-
+
- + } cursor={{ fill: '#222222' }} /> @@ -135,9 +135,17 @@ const Dashboard = () => {
+
+ {salesByProduct.map((entry, index) => ( +
+ + {entry.name} +
+ ))} +
-
+

Distribuição de Produtos

diff --git a/src/pages/ProductDetails.tsx b/src/pages/ProductDetails.tsx index 41ad920..29b482b 100644 --- a/src/pages/ProductDetails.tsx +++ b/src/pages/ProductDetails.tsx @@ -118,7 +118,7 @@ const ProductDetails = () => {

Volume de Vendas por Data

-
+