@ammarkhalidfarooq/dashboard-package 0.3.18 → 0.3.19

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.es.js CHANGED
@@ -253,7 +253,8 @@ var RevenueChart = function RevenueChart(_ref) {
253
253
  _ref$type = _ref.type,
254
254
  type = _ref$type === void 0 ? "area" : _ref$type,
255
255
  _ref$id = _ref.id,
256
- id = _ref$id === void 0 ? "revenue-chart" : _ref$id;
256
+ id = _ref$id === void 0 ? "revenue-chart" : _ref$id,
257
+ colors = _ref.colors;
257
258
  var theme = useTheme();
258
259
  var isRadial = type === 'donut' || type === 'pie';
259
260
 
@@ -272,7 +273,7 @@ var RevenueChart = function RevenueChart(_ref) {
272
273
  enabled: false
273
274
  }
274
275
  },
275
- colors: [theme.palette.primary.main, '#4B4BC2', '#7E7EE6', '#A3A3F0', '#C8C8FA'],
276
+ colors: colors || [theme.palette.primary.main, '#4B4BC2', '#7E7EE6', '#A3A3F0', '#C8C8FA'],
276
277
  tooltip: {
277
278
  theme: 'light',
278
279
  y: {
@@ -577,7 +578,8 @@ var RenderChartCard = function RenderChartCard(_ref) {
577
578
  categories: item.categories,
578
579
  height: isPrimary ? 250 : 200,
579
580
  stacked: item.stacked,
580
- type: type || item.type || "area"
581
+ type: type || item.type || "area",
582
+ colors: item.colors
581
583
  })
582
584
  }), item.footer && /*#__PURE__*/jsxs(Box, {
583
585
  sx: {
@@ -4735,7 +4737,7 @@ function formatNumber(num) {
4735
4737
  if (num >= 1000) {
4736
4738
  return (num / 1000).toFixed(1).replace(/\.0$/, "") + "K";
4737
4739
  }
4738
- return num.toString();
4740
+ return (num !== null && num !== void 0 ? num : 0).toString();
4739
4741
  }
4740
4742
 
4741
4743
  var OverallSection = function OverallSection(_ref) {
@@ -4852,8 +4854,36 @@ var OverallSection = function OverallSection(_ref) {
4852
4854
  var mainChart = extendedCharts.find(function (c) {
4853
4855
  return c.label === selectedInfo.label;
4854
4856
  }) || primaryCharts[0];
4857
+ if (activeMetric === "Total Raised" && (apiData !== null && apiData !== void 0 && apiData.paidAds || apiData !== null && apiData !== void 0 && apiData.email || apiData !== null && apiData !== void 0 && apiData.organic)) {
4858
+ var categories = ((apiData === null || apiData === void 0 ? void 0 : apiData.organic) || (apiData === null || apiData === void 0 ? void 0 : apiData.paidAds) || (apiData === null || apiData === void 0 ? void 0 : apiData.email) || []).map(function (item) {
4859
+ return item.date;
4860
+ });
4861
+ var series = [{
4862
+ name: "Paid Ads",
4863
+ data: ((apiData === null || apiData === void 0 ? void 0 : apiData.paidAds) || []).map(function (item) {
4864
+ return item.value;
4865
+ })
4866
+ }, {
4867
+ name: "Organic",
4868
+ data: ((apiData === null || apiData === void 0 ? void 0 : apiData.organic) || []).map(function (item) {
4869
+ return item.value;
4870
+ })
4871
+ }, {
4872
+ name: "Email",
4873
+ data: ((apiData === null || apiData === void 0 ? void 0 : apiData.email) || []).map(function (item) {
4874
+ return item.value;
4875
+ })
4876
+ }];
4877
+ mainChart = _objectSpread2(_objectSpread2({}, mainChart), {}, {
4878
+ label: "Total revenue trend",
4879
+ series: series,
4880
+ categories: categories,
4881
+ stacked: true,
4882
+ colors: ["#6366F1", "#10B981", "#06B6D4"]
4883
+ });
4884
+ }
4855
4885
  mainChart = _objectSpread2(_objectSpread2({}, mainChart), {}, {
4856
- label: activeMetric,
4886
+ label: mainChart.label || activeMetric,
4857
4887
  value: selectedInfo.value,
4858
4888
  trend: selectedInfo.subValue
4859
4889
  });