@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.cjs.js
CHANGED
|
@@ -256,7 +256,9 @@ var RevenueChart = function RevenueChart(_ref) {
|
|
|
256
256
|
type = _ref$type === void 0 ? "area" : _ref$type,
|
|
257
257
|
_ref$id = _ref.id,
|
|
258
258
|
id = _ref$id === void 0 ? "revenue-chart" : _ref$id,
|
|
259
|
-
colors = _ref.colors
|
|
259
|
+
colors = _ref.colors,
|
|
260
|
+
_ref$showLegend = _ref.showLegend,
|
|
261
|
+
showLegend = _ref$showLegend === void 0 ? true : _ref$showLegend;
|
|
260
262
|
var theme = styles.useTheme();
|
|
261
263
|
var isRadial = type === 'donut' || type === 'pie';
|
|
262
264
|
|
|
@@ -294,7 +296,7 @@ var RevenueChart = function RevenueChart(_ref) {
|
|
|
294
296
|
enabled: true
|
|
295
297
|
},
|
|
296
298
|
legend: {
|
|
297
|
-
show:
|
|
299
|
+
show: showLegend,
|
|
298
300
|
position: 'bottom',
|
|
299
301
|
horizontalAlign: 'center'
|
|
300
302
|
},
|
|
@@ -373,7 +375,7 @@ var RevenueChart = function RevenueChart(_ref) {
|
|
|
373
375
|
enabled: false
|
|
374
376
|
},
|
|
375
377
|
legend: {
|
|
376
|
-
show: stacked || series && series.length > 1,
|
|
378
|
+
show: showLegend && (stacked || series && series.length > 1),
|
|
377
379
|
position: 'top',
|
|
378
380
|
horizontalAlign: 'left'
|
|
379
381
|
},
|
|
@@ -539,33 +541,75 @@ var RenderChartCard = function RenderChartCard(_ref) {
|
|
|
539
541
|
},
|
|
540
542
|
children: _typeof(item.subValue) === 'object' && item.subValue !== null ? JSON.stringify(item.subValue) : item.subValue
|
|
541
543
|
})]
|
|
542
|
-
}), /*#__PURE__*/jsxRuntime.
|
|
544
|
+
}), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
543
545
|
sx: {
|
|
544
546
|
display: "flex",
|
|
545
|
-
gap: 1
|
|
547
|
+
gap: 1,
|
|
548
|
+
alignItems: "center"
|
|
546
549
|
},
|
|
547
|
-
children:
|
|
548
|
-
metric: metric,
|
|
549
|
-
onMetricChange: setMetric,
|
|
550
|
-
options: ["Revenue", "Donations"]
|
|
551
|
-
}), /*#__PURE__*/jsxRuntime.jsx(material.IconButton, {
|
|
550
|
+
children: item.hideControls ? /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
552
551
|
sx: {
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
height: "40px",
|
|
557
|
-
width: "40px",
|
|
558
|
-
"&:hover": {
|
|
559
|
-
borderColor: "primary.main",
|
|
560
|
-
bgcolor: "rgba(99, 99, 230, 0.04)"
|
|
561
|
-
}
|
|
552
|
+
display: "flex",
|
|
553
|
+
gap: 2,
|
|
554
|
+
alignItems: "center"
|
|
562
555
|
},
|
|
563
|
-
children:
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
556
|
+
children: [{
|
|
557
|
+
label: "Paid Ads",
|
|
558
|
+
color: "#6366F1"
|
|
559
|
+
}, {
|
|
560
|
+
label: "Organic",
|
|
561
|
+
color: "#10B981"
|
|
562
|
+
}, {
|
|
563
|
+
label: "Email",
|
|
564
|
+
color: "#06B6D4"
|
|
565
|
+
}].map(function (leg) {
|
|
566
|
+
return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
567
|
+
sx: {
|
|
568
|
+
display: "flex",
|
|
569
|
+
alignItems: "center",
|
|
570
|
+
gap: 0.5
|
|
571
|
+
},
|
|
572
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
573
|
+
sx: {
|
|
574
|
+
width: 8,
|
|
575
|
+
height: 8,
|
|
576
|
+
borderRadius: "50%",
|
|
577
|
+
bgcolor: leg.color
|
|
578
|
+
}
|
|
579
|
+
}), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
580
|
+
sx: {
|
|
581
|
+
fontSize: "12px",
|
|
582
|
+
color: "rgba(0,0,0,0.6)",
|
|
583
|
+
fontWeight: 500
|
|
584
|
+
},
|
|
585
|
+
children: leg.label
|
|
586
|
+
})]
|
|
587
|
+
}, leg.label);
|
|
567
588
|
})
|
|
568
|
-
})
|
|
589
|
+
}) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
590
|
+
children: [item.showSelector && /*#__PURE__*/jsxRuntime.jsx(MetricSelector, {
|
|
591
|
+
metric: metric,
|
|
592
|
+
onMetricChange: setMetric,
|
|
593
|
+
options: ["Revenue", "Donations"]
|
|
594
|
+
}), /*#__PURE__*/jsxRuntime.jsx(material.IconButton, {
|
|
595
|
+
sx: {
|
|
596
|
+
border: "1px solid #E9E9EB",
|
|
597
|
+
borderRadius: "8px",
|
|
598
|
+
color: "#000",
|
|
599
|
+
height: "40px",
|
|
600
|
+
width: "40px",
|
|
601
|
+
"&:hover": {
|
|
602
|
+
borderColor: "primary.main",
|
|
603
|
+
bgcolor: "rgba(99, 99, 230, 0.04)"
|
|
604
|
+
}
|
|
605
|
+
},
|
|
606
|
+
children: /*#__PURE__*/jsxRuntime.jsx(iconsMaterial.MoreHoriz, {
|
|
607
|
+
sx: {
|
|
608
|
+
fontSize: "1.2rem"
|
|
609
|
+
}
|
|
610
|
+
})
|
|
611
|
+
})]
|
|
612
|
+
})
|
|
569
613
|
})]
|
|
570
614
|
}), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
571
615
|
sx: {
|
|
@@ -581,7 +625,8 @@ var RenderChartCard = function RenderChartCard(_ref) {
|
|
|
581
625
|
height: isPrimary ? 250 : 200,
|
|
582
626
|
stacked: item.stacked,
|
|
583
627
|
type: type || item.type || "area",
|
|
584
|
-
colors: item.colors
|
|
628
|
+
colors: item.colors,
|
|
629
|
+
showLegend: !item.hideControls
|
|
585
630
|
})
|
|
586
631
|
}), item.footer && /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
587
632
|
sx: {
|
|
@@ -4856,32 +4901,29 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
4856
4901
|
var mainChart = extendedCharts.find(function (c) {
|
|
4857
4902
|
return c.label === selectedInfo.label;
|
|
4858
4903
|
}) || primaryCharts[0];
|
|
4859
|
-
console.log("OverallSection - activeMetric:", activeMetric);
|
|
4860
|
-
console.log("OverallSection - apiData keys:", Object.keys(apiData || {}));
|
|
4861
4904
|
if (activeMetric === "Total Raised") {
|
|
4862
|
-
var
|
|
4863
|
-
|
|
4905
|
+
var stackedData = apiData === null || apiData === void 0 ? void 0 : apiData.totalRaised;
|
|
4906
|
+
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);
|
|
4864
4907
|
if (hasStackedData) {
|
|
4865
|
-
var categories = ((
|
|
4908
|
+
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) {
|
|
4866
4909
|
return item.date;
|
|
4867
4910
|
});
|
|
4868
4911
|
var series = [{
|
|
4869
4912
|
name: "Paid Ads",
|
|
4870
|
-
data: ((
|
|
4913
|
+
data: ((stackedData === null || stackedData === void 0 ? void 0 : stackedData.paidAds) || []).map(function (item) {
|
|
4871
4914
|
return item.value;
|
|
4872
4915
|
})
|
|
4873
4916
|
}, {
|
|
4874
4917
|
name: "Organic",
|
|
4875
|
-
data: ((
|
|
4918
|
+
data: ((stackedData === null || stackedData === void 0 ? void 0 : stackedData.organic) || []).map(function (item) {
|
|
4876
4919
|
return item.value;
|
|
4877
4920
|
})
|
|
4878
4921
|
}, {
|
|
4879
4922
|
name: "Email",
|
|
4880
|
-
data: ((
|
|
4923
|
+
data: ((stackedData === null || stackedData === void 0 ? void 0 : stackedData.email) || []).map(function (item) {
|
|
4881
4924
|
return item.value;
|
|
4882
4925
|
})
|
|
4883
4926
|
}];
|
|
4884
|
-
console.log("OverallSection - transformed series:", series);
|
|
4885
4927
|
mainChart = _objectSpread2(_objectSpread2({}, mainChart), {}, {
|
|
4886
4928
|
label: "Total revenue trend",
|
|
4887
4929
|
data: undefined,
|
|
@@ -4889,7 +4931,8 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
4889
4931
|
series: series,
|
|
4890
4932
|
categories: categories,
|
|
4891
4933
|
stacked: true,
|
|
4892
|
-
colors: ["#6366F1", "#10B981", "#06B6D4"]
|
|
4934
|
+
colors: ["#6366F1", "#10B981", "#06B6D4"],
|
|
4935
|
+
hideControls: true
|
|
4893
4936
|
});
|
|
4894
4937
|
}
|
|
4895
4938
|
}
|
|
@@ -4898,7 +4941,6 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
4898
4941
|
value: selectedInfo.value,
|
|
4899
4942
|
trend: selectedInfo.subValue
|
|
4900
4943
|
});
|
|
4901
|
-
console.log("OverallSection - Final mainChart:", mainChart);
|
|
4902
4944
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
4903
4945
|
children: [/*#__PURE__*/jsxRuntime.jsx(material.Box, {
|
|
4904
4946
|
sx: {
|