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