mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 12:35:24 +02:00
feat: separate Pan-EU and UK Top 50 results in Weekly Sales
- App.tsx: Always calculate both EU and UK Top 50 maps. - WeeklyGrid.tsx: Added top50Mode state and EU/UK toggle. - WeeklyGrid.tsx: Updated filtering and sorting to respect the selected Top 50 mode. - WeeklyGrid.tsx: Enhanced product badges to show selected group rank.
This commit is contained in:
@@ -340,25 +340,14 @@ const App: React.FC = () => {
|
||||
return rankMap;
|
||||
};
|
||||
|
||||
if (filters.customer.length > 0) {
|
||||
// Filtered mode: Rank products based on currently selected countries
|
||||
const filtered2025 = data2025.filter(r => filters.customer.includes(r.customer));
|
||||
return {
|
||||
type: 'filtered' as const,
|
||||
overall: calculateTop50(filtered2025)
|
||||
};
|
||||
} else {
|
||||
// Dual mode: Separate Pan-EU and UK rankings when no countries are selected
|
||||
const euData = data2025.filter(r => !r.customer.toLowerCase().includes('uk'));
|
||||
const ukData = data2025.filter(r => r.customer.toLowerCase().includes('uk'));
|
||||
const euData = data2025.filter(r => !r.customer.toLowerCase().includes('uk'));
|
||||
const ukData = data2025.filter(r => r.customer.toLowerCase().includes('uk'));
|
||||
|
||||
return {
|
||||
type: 'dual' as const,
|
||||
eu: calculateTop50(euData),
|
||||
uk: calculateTop50(ukData)
|
||||
};
|
||||
}
|
||||
}, [rawData, filters.customer]);
|
||||
return {
|
||||
eu: calculateTop50(euData),
|
||||
uk: calculateTop50(ukData)
|
||||
};
|
||||
}, [rawData]);
|
||||
|
||||
// Combine Sales & Ads Data dynamically based on current filters
|
||||
const combinedAdsData = useMemo(() => {
|
||||
|
||||
Reference in New Issue
Block a user