mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 12:15:23 +02:00
Fix: restore Top50 ranking badges (white/gradient) next to inventory badges across all views
This commit is contained in:
@@ -4,6 +4,7 @@ import { BSRRecord, CombinedKPIs } from '../types';
|
||||
import { BuyBoxWarningBadge } from './BuyBoxWarningBadge';
|
||||
import { StockBadge } from './StockBadge';
|
||||
import { VendorStockBadge } from './VendorStockBadge';
|
||||
import { Top50Badge } from './Top50Badge';
|
||||
import { BSRUnitsCorrelationChart } from './BSRUnitsCorrelationChart';
|
||||
|
||||
interface VendorDataViewProps {
|
||||
@@ -15,6 +16,7 @@ interface VendorDataViewProps {
|
||||
vendorStockMap?: Map<string, { eu: number; uk: number }>;
|
||||
top50Mode?: 'eu' | 'uk';
|
||||
velocityMap?: Map<string, number>;
|
||||
top50Ranking?: { eu: Map<string, number>; uk: Map<string, number> };
|
||||
}
|
||||
|
||||
interface ChartPoint {
|
||||
@@ -320,7 +322,8 @@ const VendorDataView: React.FC<VendorDataViewProps> = ({
|
||||
stockMap,
|
||||
vendorStockMap,
|
||||
top50Mode = 'eu',
|
||||
velocityMap
|
||||
velocityMap,
|
||||
top50Ranking
|
||||
}) => {
|
||||
const activeMarkets = useMemo(() => {
|
||||
const m = new Set(bsrData.map(r => r.market));
|
||||
@@ -481,6 +484,19 @@ const VendorDataView: React.FC<VendorDataViewProps> = ({
|
||||
{stockMap && (
|
||||
<StockBadge stock={stockMap.get(productInfo.sku?.replace(/(DE|EN)$/i, ''))} />
|
||||
)}
|
||||
{(() => {
|
||||
const asin = productInfo.asin.trim().toUpperCase();
|
||||
if (asin && top50Ranking) {
|
||||
if (top50Mode === 'eu') {
|
||||
const rank = top50Ranking.eu.get(asin);
|
||||
if (rank) return <Top50Badge rank={rank} label="EU" theme="indigo" />;
|
||||
} else {
|
||||
const rank = top50Ranking.uk.get(asin);
|
||||
if (rank) return <Top50Badge rank={rank} label="UK" theme="blue" />;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
})()}
|
||||
<VendorStockBadge
|
||||
asin={productInfo.asin}
|
||||
vendorStockMap={vendorStockMap}
|
||||
|
||||
Reference in New Issue
Block a user