- {locations.byState?.map((location) => (
-
-
-
{location.state}
-
- {location.country}
-
+
+ {/* Country summary cards */}
+
+ {locations.byCountry?.slice(0, 3).map((country) => (
+
+
+
+
{country.country}
+
+ {country.states.length} states/regions
+
+
+
+
{country.count.toLocaleString()}
+
+ {country.percentage.toFixed(1)}%
+
+
-
-
- {location.count.toLocaleString()}
-
-
- ({location.percentage.toFixed(1)}%)
-
+
-
+
))}
+
+ {/* States grid */}
+
+
+ {/* Left column */}
+
+
+ Top States
+ Orders
+
+ {locations.byState?.slice(0, Math.ceil(locations.byState.length / 2)).map((location) => (
+
+
+ {location.state}
+
+ {location.country}
+
+
+
+
+ {location.count.toLocaleString()}
+
+
+ {location.percentage.toFixed(1)}%
+
+
+
+ ))}
+
+
+ {/* Right column */}
+
+
+ Additional States
+ Orders
+
+ {locations.byState?.slice(Math.ceil(locations.byState.length / 2)).map((location) => (
+
+
+ {location.state}
+
+ {location.country}
+
+
+
+
+ {location.count.toLocaleString()}
+
+
+ {location.percentage.toFixed(1)}%
+
+
+
+ ))}
+
+
+
+
+ {/* Summary footer */}
+
+
+ Showing all {locations.byState?.length || 0} states across {locations.byCountry?.length || 0} countries
+
+
+ Total Orders: {shippedCount.toLocaleString()}
+
+
@@ -1299,7 +1376,7 @@ const StatCards = ({
} finally {
setDetailDataLoading(prev => ({ ...prev, [metric]: false }));
}
- }, [timeRange, startDate, endDate, shouldUseLast30Days, setCacheData, getCacheData]);
+ }, [timeRange, startDate, endDate]);
// Corrected preloadDetailData function
const preloadDetailData = useCallback(() => {
const metrics = [