@ammarkhalidfarooq/dashboard-package 0.3.27 → 0.3.29

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
@@ -282,7 +282,7 @@ var RevenueChart = function RevenueChart(_ref) {
282
282
  theme: 'light',
283
283
  y: {
284
284
  formatter: function formatter(value) {
285
- return metric === 'Revenue' ? "$".concat((value || 0).toLocaleString()) : value || 0;
285
+ return (metric === null || metric === void 0 ? void 0 : metric.toLowerCase()) === 'revenue' ? "$".concat((value || 0).toLocaleString()) : value || 0;
286
286
  }
287
287
  }
288
288
  }
@@ -346,8 +346,11 @@ var RevenueChart = function RevenueChart(_ref) {
346
346
  axisTicks: {
347
347
  show: false
348
348
  },
349
- tickAmount: 7,
349
+ tickAmount: 5,
350
350
  labels: {
351
+ rotate: 0,
352
+ rotateAlways: false,
353
+ hideOverlappingLabels: true,
351
354
  style: {
352
355
  colors: '#A1A1A8',
353
356
  fontSize: '12px'
@@ -371,7 +374,7 @@ var RevenueChart = function RevenueChart(_ref) {
371
374
  fontSize: '12px'
372
375
  },
373
376
  formatter: function formatter(value) {
374
- return metric === 'Revenue' ? "$".concat(value) : value || 0;
377
+ return (metric === null || metric === void 0 ? void 0 : metric.toLowerCase()) === 'revenue' ? "$".concat((value || 0).toLocaleString()) : value || 0;
375
378
  }
376
379
  }
377
380
  },
@@ -4993,6 +4996,53 @@ var OverallSection = function OverallSection(_ref) {
4993
4996
  });
4994
4997
  }
4995
4998
  }
4999
+ if (activeMetric === "Total Donors") {
5000
+ var donorsData = apiData === null || apiData === void 0 ? void 0 : apiData.totalDonors;
5001
+ var _hasStackedData2 = (donorsData === null || donorsData === void 0 ? void 0 : donorsData.paidAds) || (donorsData === null || donorsData === void 0 ? void 0 : donorsData.email) || (donorsData === null || donorsData === void 0 ? void 0 : donorsData.organic);
5002
+ if (_hasStackedData2) {
5003
+ var _categories2 = ((donorsData === null || donorsData === void 0 ? void 0 : donorsData.organic) || (donorsData === null || donorsData === void 0 ? void 0 : donorsData.paidAds) || (donorsData === null || donorsData === void 0 ? void 0 : donorsData.email) || []).map(function (item) {
5004
+ return item.date;
5005
+ });
5006
+ var _series2 = [{
5007
+ name: "Paid Ads",
5008
+ data: ((donorsData === null || donorsData === void 0 ? void 0 : donorsData.paidAds) || []).map(function (item) {
5009
+ return item.value;
5010
+ })
5011
+ }, {
5012
+ name: "Organic",
5013
+ data: ((donorsData === null || donorsData === void 0 ? void 0 : donorsData.organic) || []).map(function (item) {
5014
+ return item.value;
5015
+ })
5016
+ }, {
5017
+ name: "Email",
5018
+ data: ((donorsData === null || donorsData === void 0 ? void 0 : donorsData.email) || []).map(function (item) {
5019
+ return item.value;
5020
+ })
5021
+ }];
5022
+ mainChart = _objectSpread2(_objectSpread2({}, mainChart), {}, {
5023
+ label: "Donor trend",
5024
+ data: undefined,
5025
+ series: _series2,
5026
+ categories: _categories2,
5027
+ stacked: true,
5028
+ colors: ["#6366F1", "#10B981", "#06B6D4"],
5029
+ hideControls: true
5030
+ });
5031
+ } else if (Array.isArray(donorsData) && donorsData.length > 0) {
5032
+ mainChart = _objectSpread2(_objectSpread2({}, mainChart), {}, {
5033
+ label: "Donor trend",
5034
+ data: donorsData.map(function (item) {
5035
+ return item.value;
5036
+ }),
5037
+ categories: donorsData.map(function (item) {
5038
+ return item.date;
5039
+ }),
5040
+ series: undefined,
5041
+ stacked: false,
5042
+ hideControls: true
5043
+ });
5044
+ }
5045
+ }
4996
5046
  mainChart = _objectSpread2(_objectSpread2({}, mainChart), {}, {
4997
5047
  label: mainChart.label || activeMetric,
4998
5048
  value: selectedInfo.value,