@ammarkhalidfarooq/dashboard-package 0.3.8 → 0.3.10

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
@@ -617,7 +617,9 @@ var Dashboard = function Dashboard(_ref) {
617
617
  var _ref$apiData = _ref.apiData,
618
618
  apiData = _ref$apiData === void 0 ? {} : _ref$apiData,
619
619
  _ref$overviewType = _ref.overviewType,
620
- overviewType = _ref$overviewType === void 0 ? "overall" : _ref$overviewType;
620
+ overviewType = _ref$overviewType === void 0 ? "overall" : _ref$overviewType,
621
+ _ref$dateName = _ref.dateName,
622
+ dateName = _ref$dateName === void 0 ? "Last Period" : _ref$dateName;
621
623
  return /*#__PURE__*/jsxRuntime.jsx(material.ThemeProvider, {
622
624
  theme: theme,
623
625
  children: /*#__PURE__*/jsxRuntime.jsx(React.Suspense, {
@@ -630,7 +632,8 @@ var Dashboard = function Dashboard(_ref) {
630
632
  }),
631
633
  children: /*#__PURE__*/jsxRuntime.jsx(NewOverview$1, {
632
634
  apiData: apiData,
633
- activeSection: overviewType
635
+ activeSection: overviewType,
636
+ dateName: dateName
634
637
  })
635
638
  })
636
639
  });
@@ -2197,7 +2200,9 @@ var PaidSection$2 = /*#__PURE__*/React.lazy(function () {
2197
2200
  var NewOverview = function NewOverview(_ref) {
2198
2201
  var _ref$apiData = _ref.apiData,
2199
2202
  apiData = _ref$apiData === void 0 ? {} : _ref$apiData,
2200
- activeSectionProp = _ref.activeSection;
2203
+ activeSectionProp = _ref.activeSection,
2204
+ _ref$dateName = _ref.dateName,
2205
+ dateName = _ref$dateName === void 0 ? "Last Period" : _ref$dateName;
2201
2206
  var initialMetric = "Revenue";
2202
2207
  var revenueData = (apiData === null || apiData === void 0 ? void 0 : apiData.revenueData) || [3000, 4500, 4200, 5800, 5200, 7100, 8500, 9200, 5000];
2203
2208
  var donationsData = (apiData === null || apiData === void 0 ? void 0 : apiData.donationsData) || [15, 22, 18, 30, 25, 35, 42, 45, 28];
@@ -2399,7 +2404,8 @@ var NewOverview = function NewOverview(_ref) {
2399
2404
  primaryCharts: primaryCharts,
2400
2405
  secondaryCharts: secondaryCharts,
2401
2406
  tertiaryCharts: tertiaryCharts,
2402
- quaternaryCharts: quaternaryCharts
2407
+ quaternaryCharts: quaternaryCharts,
2408
+ dateName: dateName
2403
2409
  }), activeSection === "Paid" && /*#__PURE__*/jsxRuntime.jsx(PaidSection$2, {
2404
2410
  apiData: apiData
2405
2411
  }), activeSection === "Organic" && /*#__PURE__*/jsxRuntime.jsx(material.Box, {
@@ -4721,13 +4727,27 @@ var RefundsChargebacksCard = function RefundsChargebacksCard() {
4721
4727
  });
4722
4728
  };
4723
4729
 
4730
+ function formatNumber(num) {
4731
+ if (num >= 1000000000) {
4732
+ return (num / 1000000000).toFixed(1).replace(/\.0$/, "") + "B";
4733
+ }
4734
+ if (num >= 1000000) {
4735
+ return (num / 1000000).toFixed(1).replace(/\.0$/, "") + "M";
4736
+ }
4737
+ if (num >= 1000) {
4738
+ return (num / 1000).toFixed(1).replace(/\.0$/, "") + "K";
4739
+ }
4740
+ return num.toString();
4741
+ }
4742
+
4724
4743
  var OverallSection = function OverallSection(_ref) {
4725
4744
  var _ref$apiData = _ref.apiData,
4726
4745
  apiData = _ref$apiData === void 0 ? {} : _ref$apiData,
4727
4746
  primaryCharts = _ref.primaryCharts,
4728
4747
  secondaryCharts = _ref.secondaryCharts,
4729
4748
  tertiaryCharts = _ref.tertiaryCharts,
4730
- quaternaryCharts = _ref.quaternaryCharts;
4749
+ quaternaryCharts = _ref.quaternaryCharts,
4750
+ dateName = _ref.dateName;
4731
4751
  var _useState = React.useState("Total Raised"),
4732
4752
  _useState2 = _slicedToArray(_useState, 2),
4733
4753
  activeMetric = _useState2[0],
@@ -4772,8 +4792,8 @@ var OverallSection = function OverallSection(_ref) {
4772
4792
  };
4773
4793
  var metricInfo = {
4774
4794
  "Total Raised": {
4775
- value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalRaised) || "$240.9K",
4776
- subValue: (apiData === null || apiData === void 0 ? void 0 : apiData.totalRaisedTrend) || "18% vs last month",
4795
+ value: "$".concat(formatNumber(apiData === null || apiData === void 0 ? void 0 : apiData.totalRaisedCard)) || "$240.9K",
4796
+ subValue: "".concat(apiData === null || apiData === void 0 ? void 0 : apiData.totalRaisedPrev.toFixed(2), "% vs ").concat(dateName) || "18% vs last month",
4777
4797
  label: "Total Revenue",
4778
4798
  icon: iconsMaterial.PaidOutlined
4779
4799
  },