@ammarkhalidfarooq/dashboard-package 0.3.22 → 0.3.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +78 -36
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +78 -36
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -254,7 +254,9 @@ var RevenueChart = function RevenueChart(_ref) {
|
|
|
254
254
|
type = _ref$type === void 0 ? "area" : _ref$type,
|
|
255
255
|
_ref$id = _ref.id,
|
|
256
256
|
id = _ref$id === void 0 ? "revenue-chart" : _ref$id,
|
|
257
|
-
colors = _ref.colors
|
|
257
|
+
colors = _ref.colors,
|
|
258
|
+
_ref$showLegend = _ref.showLegend,
|
|
259
|
+
showLegend = _ref$showLegend === void 0 ? true : _ref$showLegend;
|
|
258
260
|
var theme = useTheme();
|
|
259
261
|
var isRadial = type === 'donut' || type === 'pie';
|
|
260
262
|
|
|
@@ -292,7 +294,7 @@ var RevenueChart = function RevenueChart(_ref) {
|
|
|
292
294
|
enabled: true
|
|
293
295
|
},
|
|
294
296
|
legend: {
|
|
295
|
-
show:
|
|
297
|
+
show: showLegend,
|
|
296
298
|
position: 'bottom',
|
|
297
299
|
horizontalAlign: 'center'
|
|
298
300
|
},
|
|
@@ -371,7 +373,7 @@ var RevenueChart = function RevenueChart(_ref) {
|
|
|
371
373
|
enabled: false
|
|
372
374
|
},
|
|
373
375
|
legend: {
|
|
374
|
-
show: stacked || series && series.length > 1,
|
|
376
|
+
show: showLegend && (stacked || series && series.length > 1),
|
|
375
377
|
position: 'top',
|
|
376
378
|
horizontalAlign: 'left'
|
|
377
379
|
},
|
|
@@ -537,33 +539,75 @@ var RenderChartCard = function RenderChartCard(_ref) {
|
|
|
537
539
|
},
|
|
538
540
|
children: _typeof(item.subValue) === 'object' && item.subValue !== null ? JSON.stringify(item.subValue) : item.subValue
|
|
539
541
|
})]
|
|
540
|
-
}), /*#__PURE__*/
|
|
542
|
+
}), /*#__PURE__*/jsx(Box, {
|
|
541
543
|
sx: {
|
|
542
544
|
display: "flex",
|
|
543
|
-
gap: 1
|
|
545
|
+
gap: 1,
|
|
546
|
+
alignItems: "center"
|
|
544
547
|
},
|
|
545
|
-
children:
|
|
546
|
-
metric: metric,
|
|
547
|
-
onMetricChange: setMetric,
|
|
548
|
-
options: ["Revenue", "Donations"]
|
|
549
|
-
}), /*#__PURE__*/jsx(IconButton, {
|
|
548
|
+
children: item.hideControls ? /*#__PURE__*/jsx(Box, {
|
|
550
549
|
sx: {
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
height: "40px",
|
|
555
|
-
width: "40px",
|
|
556
|
-
"&:hover": {
|
|
557
|
-
borderColor: "primary.main",
|
|
558
|
-
bgcolor: "rgba(99, 99, 230, 0.04)"
|
|
559
|
-
}
|
|
550
|
+
display: "flex",
|
|
551
|
+
gap: 2,
|
|
552
|
+
alignItems: "center"
|
|
560
553
|
},
|
|
561
|
-
children:
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
554
|
+
children: [{
|
|
555
|
+
label: "Paid Ads",
|
|
556
|
+
color: "#6366F1"
|
|
557
|
+
}, {
|
|
558
|
+
label: "Organic",
|
|
559
|
+
color: "#10B981"
|
|
560
|
+
}, {
|
|
561
|
+
label: "Email",
|
|
562
|
+
color: "#06B6D4"
|
|
563
|
+
}].map(function (leg) {
|
|
564
|
+
return /*#__PURE__*/jsxs(Box, {
|
|
565
|
+
sx: {
|
|
566
|
+
display: "flex",
|
|
567
|
+
alignItems: "center",
|
|
568
|
+
gap: 0.5
|
|
569
|
+
},
|
|
570
|
+
children: [/*#__PURE__*/jsx(Box, {
|
|
571
|
+
sx: {
|
|
572
|
+
width: 8,
|
|
573
|
+
height: 8,
|
|
574
|
+
borderRadius: "50%",
|
|
575
|
+
bgcolor: leg.color
|
|
576
|
+
}
|
|
577
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
578
|
+
sx: {
|
|
579
|
+
fontSize: "12px",
|
|
580
|
+
color: "rgba(0,0,0,0.6)",
|
|
581
|
+
fontWeight: 500
|
|
582
|
+
},
|
|
583
|
+
children: leg.label
|
|
584
|
+
})]
|
|
585
|
+
}, leg.label);
|
|
565
586
|
})
|
|
566
|
-
})
|
|
587
|
+
}) : /*#__PURE__*/jsxs(Fragment, {
|
|
588
|
+
children: [item.showSelector && /*#__PURE__*/jsx(MetricSelector, {
|
|
589
|
+
metric: metric,
|
|
590
|
+
onMetricChange: setMetric,
|
|
591
|
+
options: ["Revenue", "Donations"]
|
|
592
|
+
}), /*#__PURE__*/jsx(IconButton, {
|
|
593
|
+
sx: {
|
|
594
|
+
border: "1px solid #E9E9EB",
|
|
595
|
+
borderRadius: "8px",
|
|
596
|
+
color: "#000",
|
|
597
|
+
height: "40px",
|
|
598
|
+
width: "40px",
|
|
599
|
+
"&:hover": {
|
|
600
|
+
borderColor: "primary.main",
|
|
601
|
+
bgcolor: "rgba(99, 99, 230, 0.04)"
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
children: /*#__PURE__*/jsx(MoreHoriz, {
|
|
605
|
+
sx: {
|
|
606
|
+
fontSize: "1.2rem"
|
|
607
|
+
}
|
|
608
|
+
})
|
|
609
|
+
})]
|
|
610
|
+
})
|
|
567
611
|
})]
|
|
568
612
|
}), /*#__PURE__*/jsx(Box, {
|
|
569
613
|
sx: {
|
|
@@ -579,7 +623,8 @@ var RenderChartCard = function RenderChartCard(_ref) {
|
|
|
579
623
|
height: isPrimary ? 250 : 200,
|
|
580
624
|
stacked: item.stacked,
|
|
581
625
|
type: type || item.type || "area",
|
|
582
|
-
colors: item.colors
|
|
626
|
+
colors: item.colors,
|
|
627
|
+
showLegend: !item.hideControls
|
|
583
628
|
})
|
|
584
629
|
}), item.footer && /*#__PURE__*/jsxs(Box, {
|
|
585
630
|
sx: {
|
|
@@ -4854,32 +4899,29 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
4854
4899
|
var mainChart = extendedCharts.find(function (c) {
|
|
4855
4900
|
return c.label === selectedInfo.label;
|
|
4856
4901
|
}) || primaryCharts[0];
|
|
4857
|
-
console.log("OverallSection - activeMetric:", activeMetric);
|
|
4858
|
-
console.log("OverallSection - apiData keys:", Object.keys(apiData || {}));
|
|
4859
4902
|
if (activeMetric === "Total Raised") {
|
|
4860
|
-
var
|
|
4861
|
-
|
|
4903
|
+
var stackedData = apiData === null || apiData === void 0 ? void 0 : apiData.totalRaised;
|
|
4904
|
+
var hasStackedData = (stackedData === null || stackedData === void 0 ? void 0 : stackedData.paidAds) || (stackedData === null || stackedData === void 0 ? void 0 : stackedData.email) || (stackedData === null || stackedData === void 0 ? void 0 : stackedData.organic);
|
|
4862
4905
|
if (hasStackedData) {
|
|
4863
|
-
var categories = ((
|
|
4906
|
+
var categories = ((stackedData === null || stackedData === void 0 ? void 0 : stackedData.organic) || (stackedData === null || stackedData === void 0 ? void 0 : stackedData.paidAds) || (stackedData === null || stackedData === void 0 ? void 0 : stackedData.email) || []).map(function (item) {
|
|
4864
4907
|
return item.date;
|
|
4865
4908
|
});
|
|
4866
4909
|
var series = [{
|
|
4867
4910
|
name: "Paid Ads",
|
|
4868
|
-
data: ((
|
|
4911
|
+
data: ((stackedData === null || stackedData === void 0 ? void 0 : stackedData.paidAds) || []).map(function (item) {
|
|
4869
4912
|
return item.value;
|
|
4870
4913
|
})
|
|
4871
4914
|
}, {
|
|
4872
4915
|
name: "Organic",
|
|
4873
|
-
data: ((
|
|
4916
|
+
data: ((stackedData === null || stackedData === void 0 ? void 0 : stackedData.organic) || []).map(function (item) {
|
|
4874
4917
|
return item.value;
|
|
4875
4918
|
})
|
|
4876
4919
|
}, {
|
|
4877
4920
|
name: "Email",
|
|
4878
|
-
data: ((
|
|
4921
|
+
data: ((stackedData === null || stackedData === void 0 ? void 0 : stackedData.email) || []).map(function (item) {
|
|
4879
4922
|
return item.value;
|
|
4880
4923
|
})
|
|
4881
4924
|
}];
|
|
4882
|
-
console.log("OverallSection - transformed series:", series);
|
|
4883
4925
|
mainChart = _objectSpread2(_objectSpread2({}, mainChart), {}, {
|
|
4884
4926
|
label: "Total revenue trend",
|
|
4885
4927
|
data: undefined,
|
|
@@ -4887,7 +4929,8 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
4887
4929
|
series: series,
|
|
4888
4930
|
categories: categories,
|
|
4889
4931
|
stacked: true,
|
|
4890
|
-
colors: ["#6366F1", "#10B981", "#06B6D4"]
|
|
4932
|
+
colors: ["#6366F1", "#10B981", "#06B6D4"],
|
|
4933
|
+
hideControls: true
|
|
4891
4934
|
});
|
|
4892
4935
|
}
|
|
4893
4936
|
}
|
|
@@ -4896,7 +4939,6 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
4896
4939
|
value: selectedInfo.value,
|
|
4897
4940
|
trend: selectedInfo.subValue
|
|
4898
4941
|
});
|
|
4899
|
-
console.log("OverallSection - Final mainChart:", mainChart);
|
|
4900
4942
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
4901
4943
|
children: [/*#__PURE__*/jsx(Box, {
|
|
4902
4944
|
sx: {
|