From 8d849dfb636e11eac520fbd5698f41786d8d0776 Mon Sep 17 00:00:00 2001 From: Christian Vidal Wolf Date: Wed, 4 Mar 2026 08:40:46 +0100 Subject: [PATCH] feat: show category names next to BSR chart headers when single ASIN selected --- components/VendorDataView.tsx | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/components/VendorDataView.tsx b/components/VendorDataView.tsx index 11b58a4..81af64b 100644 --- a/components/VendorDataView.tsx +++ b/components/VendorDataView.tsx @@ -36,13 +36,24 @@ const VendorDataView: React.FC = ({ bsrData = [], asinMetad const asin = uniqueAsins[0]; const metadata = asinMetadata?.get(asin); if (!metadata) return null; + + let topCategory = ''; + let detailCategory = ''; + for (const r of bsrData) { + if (!topCategory && r.topLevelName) topCategory = r.topLevelName; + if (!detailCategory && r.detailLevelName) detailCategory = r.detailLevelName; + if (topCategory && detailCategory) break; + } + return { asin, sku: metadata.sku, title: metadata.title, line: metadata.line, + topCategory, + detailCategory }; - }, [uniqueAsins, asinMetadata]); + }, [uniqueAsins, asinMetadata, bsrData]); const { topBsrChartData, detailBsrChartData, ratingChartData } = useMemo(() => { const byBucket = new Map(); @@ -162,7 +173,14 @@ const VendorDataView: React.FC = ({ bsrData = [], asinMetad {/* Top Level BSR Trend Chart */}
-

Top Level BSR Trend

+
+

Top Level BSR Trend

+ {productInfo?.topCategory && ( + + {productInfo.topCategory} + + )} +

Weekly Average Rank • Lower is better

@@ -229,7 +247,14 @@ const VendorDataView: React.FC = ({ bsrData = [], asinMetad {/* Detail Level BSR Trend Chart */}
-

Detail Level BSR Trend

+
+

Detail Level BSR Trend

+ {productInfo?.detailCategory && ( + + {productInfo.detailCategory} + + )} +

Sub-category Performance • Filtered ASINs