Improve profit analytics chart and modal data handling

Enhanced ProfitAnalyticsChart to display more robust skeleton loaders and improved summary card logic with fallbacks for missing data. Updated the chart to distinguish between tracked and total revenue, and improved cost data coverage display. In the profit analysis modal, profit margin tiers are now sorted by minimum quantity. Updated the ProfitOverview interface to include revenueFromTrackedProducts.
This commit is contained in:
NotII
2025-08-26 21:36:08 +01:00
parent 6a2cd9aa79
commit 50d0100056
4 changed files with 104 additions and 16 deletions

View File

@@ -205,7 +205,9 @@ export const ProfitAnalysisModal: React.FC<ProfitAnalysisModalProps> = ({
</CardHeader>
<CardContent>
<div className="space-y-4">
{profitData.profitMargins.map((tier, index) => {
{profitData.profitMargins
.sort((a, b) => a.minQuantity - b.minQuantity)
.map((tier, index) => {
const ProfitIcon = getProfitIcon(tier.profit);
const totalProfitForMinQty = tier.profit !== null ? tier.profit * tier.minQuantity : null;