@ammarkhalidfarooq/dashboard-package 0.1.4 → 0.1.6
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 +45 -18
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +45 -18
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -91,6 +91,15 @@ function _toPropertyKey(t) {
|
|
|
91
91
|
var i = _toPrimitive(t, "string");
|
|
92
92
|
return "symbol" == typeof i ? i : i + "";
|
|
93
93
|
}
|
|
94
|
+
function _typeof(o) {
|
|
95
|
+
"@babel/helpers - typeof";
|
|
96
|
+
|
|
97
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
98
|
+
return typeof o;
|
|
99
|
+
} : function (o) {
|
|
100
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
101
|
+
}, _typeof(o);
|
|
102
|
+
}
|
|
94
103
|
function _unsupportedIterableToArray(r, a) {
|
|
95
104
|
if (r) {
|
|
96
105
|
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
@@ -369,12 +378,18 @@ var RevenueChart = function RevenueChart(_ref) {
|
|
|
369
378
|
if (isRadial) {
|
|
370
379
|
var _series$;
|
|
371
380
|
// For donut/pie, series must be a simple array of numbers
|
|
372
|
-
|
|
381
|
+
var processedData = Array.isArray(data) ? data.map(function (v) {
|
|
382
|
+
return _typeof(v) === 'object' && v !== null ? v.value : v;
|
|
383
|
+
}) : [];
|
|
384
|
+
chartSeries = processedData.length > 0 ? processedData : (series === null || series === void 0 || (_series$ = series[0]) === null || _series$ === void 0 ? void 0 : _series$.data) || [];
|
|
373
385
|
} else {
|
|
374
386
|
// For bar/line/area, series must be an array of objects [{ name: '', data: [] }]
|
|
387
|
+
var _processedData = Array.isArray(data) ? data.map(function (v) {
|
|
388
|
+
return _typeof(v) === 'object' && v !== null ? v.value : v;
|
|
389
|
+
}) : [];
|
|
375
390
|
chartSeries = Array.isArray(series) ? series : [{
|
|
376
391
|
name: metric || "Value",
|
|
377
|
-
data:
|
|
392
|
+
data: _processedData
|
|
378
393
|
}];
|
|
379
394
|
}
|
|
380
395
|
return /*#__PURE__*/jsxRuntime.jsx(ReactApexChart, {
|
|
@@ -448,14 +463,14 @@ var RenderChartCard = function RenderChartCard(_ref) {
|
|
|
448
463
|
color: "#000000",
|
|
449
464
|
mb: 0.5
|
|
450
465
|
},
|
|
451
|
-
children: item.value
|
|
466
|
+
children: _typeof(item.value) === 'object' && item.value !== null ? item.value.value !== undefined ? item.value.value : JSON.stringify(item.value) : item.value
|
|
452
467
|
}), item.subValue && /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
|
|
453
468
|
variant: "subtitle2",
|
|
454
469
|
sx: {
|
|
455
470
|
color: "#000000",
|
|
456
471
|
fontWeight: 600
|
|
457
472
|
},
|
|
458
|
-
children: item.subValue
|
|
473
|
+
children: _typeof(item.subValue) === 'object' && item.subValue !== null ? JSON.stringify(item.subValue) : item.subValue
|
|
459
474
|
})]
|
|
460
475
|
}), /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
|
|
461
476
|
sx: {
|
|
@@ -723,7 +738,7 @@ var DisplayCard = function DisplayCard(_ref) {
|
|
|
723
738
|
fontSize: '22px',
|
|
724
739
|
fontWeight: '500'
|
|
725
740
|
},
|
|
726
|
-
children: value
|
|
741
|
+
children: _typeof(value) === 'object' && value !== null ? value.value !== undefined ? value.value : JSON.stringify(value) : value
|
|
727
742
|
})]
|
|
728
743
|
})
|
|
729
744
|
});
|
|
@@ -860,6 +875,16 @@ var NewOverview = function NewOverview(_ref) {
|
|
|
860
875
|
var oneTimeTotal = oneTimeData.length > 0 ? oneTimeValues.reduce(function (sum, val) {
|
|
861
876
|
return sum + val;
|
|
862
877
|
}, 0) : 7100;
|
|
878
|
+
var firstInstData = (apiData === null || apiData === void 0 ? void 0 : apiData.firstInstallmentRevenue) || [];
|
|
879
|
+
var firstInstValues = firstInstData.length > 0 ? firstInstData.map(function (item) {
|
|
880
|
+
return item.value;
|
|
881
|
+
}) : currentData.slice(-7);
|
|
882
|
+
var firstInstCategories = firstInstData.length > 0 ? firstInstData.map(function (item) {
|
|
883
|
+
return item.date;
|
|
884
|
+
}) : categories.slice(-7);
|
|
885
|
+
var firstInstTotal = firstInstData.length > 0 ? firstInstValues.reduce(function (sum, val) {
|
|
886
|
+
return sum + val;
|
|
887
|
+
}, 0) : 510;
|
|
863
888
|
var primaryCharts = [{
|
|
864
889
|
label: "Total Revenue",
|
|
865
890
|
value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalRevenue) || "$9,200.00",
|
|
@@ -869,9 +894,9 @@ var NewOverview = function NewOverview(_ref) {
|
|
|
869
894
|
showSelector: true
|
|
870
895
|
}, {
|
|
871
896
|
label: "First installments",
|
|
872
|
-
value: "$510.00",
|
|
873
|
-
data:
|
|
874
|
-
categories:
|
|
897
|
+
value: apiData !== null && apiData !== void 0 && apiData.firstInstallmentRevenue ? "$".concat(firstInstTotal.toLocaleString()) : "$510.00",
|
|
898
|
+
data: firstInstValues,
|
|
899
|
+
categories: firstInstCategories
|
|
875
900
|
}, {
|
|
876
901
|
label: "One-time donations",
|
|
877
902
|
value: apiData !== null && apiData !== void 0 && apiData.oneTimeDonations ? "$".concat(oneTimeTotal.toLocaleString()) : "$7,100.00",
|
|
@@ -5180,7 +5205,9 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
5180
5205
|
});
|
|
5181
5206
|
|
|
5182
5207
|
var OverallSection = function OverallSection(_ref) {
|
|
5183
|
-
var
|
|
5208
|
+
var _ref$apiData = _ref.apiData,
|
|
5209
|
+
apiData = _ref$apiData === void 0 ? {} : _ref$apiData,
|
|
5210
|
+
primaryCharts = _ref.primaryCharts,
|
|
5184
5211
|
secondaryCharts = _ref.secondaryCharts,
|
|
5185
5212
|
tertiaryCharts = _ref.tertiaryCharts,
|
|
5186
5213
|
quaternaryCharts = _ref.quaternaryCharts;
|
|
@@ -5193,31 +5220,31 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5193
5220
|
},
|
|
5194
5221
|
children: [/*#__PURE__*/jsxRuntime.jsx(DisplayCard, {
|
|
5195
5222
|
title: "Total Raised",
|
|
5196
|
-
value: "$9,200",
|
|
5223
|
+
value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalRaised) || "$9,200",
|
|
5197
5224
|
sx: {
|
|
5198
5225
|
flex: 1
|
|
5199
5226
|
}
|
|
5200
5227
|
}), /*#__PURE__*/jsxRuntime.jsx(DisplayCard, {
|
|
5201
5228
|
title: "Net Raised",
|
|
5202
|
-
value: "$9,200",
|
|
5229
|
+
value: (apiData === null || apiData === void 0 ? void 0 : apiData.netRaised) || "$9,200",
|
|
5203
5230
|
sx: {
|
|
5204
5231
|
flex: 1
|
|
5205
5232
|
}
|
|
5206
5233
|
}), /*#__PURE__*/jsxRuntime.jsx(DisplayCard, {
|
|
5207
5234
|
title: "Total Spent",
|
|
5208
|
-
value: "$9,200",
|
|
5235
|
+
value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalSpent) || "$9,200",
|
|
5209
5236
|
sx: {
|
|
5210
5237
|
flex: 1
|
|
5211
5238
|
}
|
|
5212
5239
|
}), /*#__PURE__*/jsxRuntime.jsx(DisplayCard, {
|
|
5213
5240
|
title: "Total ROAS",
|
|
5214
|
-
value: "3.0",
|
|
5241
|
+
value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalRoas) || "3.0",
|
|
5215
5242
|
sx: {
|
|
5216
5243
|
flex: 1
|
|
5217
5244
|
}
|
|
5218
5245
|
}), /*#__PURE__*/jsxRuntime.jsx(DisplayCard, {
|
|
5219
5246
|
title: "Total Donors",
|
|
5220
|
-
value: "215",
|
|
5247
|
+
value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalDonors) || "215",
|
|
5221
5248
|
sx: {
|
|
5222
5249
|
flex: 1
|
|
5223
5250
|
}
|
|
@@ -5232,7 +5259,7 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5232
5259
|
return /*#__PURE__*/jsxRuntime.jsx(RenderChartCard, {
|
|
5233
5260
|
item: item,
|
|
5234
5261
|
index: index
|
|
5235
|
-
});
|
|
5262
|
+
}, "primary-".concat(index));
|
|
5236
5263
|
})
|
|
5237
5264
|
}), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
|
|
5238
5265
|
container: true,
|
|
@@ -5244,7 +5271,7 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5244
5271
|
return /*#__PURE__*/jsxRuntime.jsx(RenderChartCard, {
|
|
5245
5272
|
item: item,
|
|
5246
5273
|
index: index
|
|
5247
|
-
});
|
|
5274
|
+
}, "secondary-".concat(index));
|
|
5248
5275
|
})
|
|
5249
5276
|
}), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
|
|
5250
5277
|
container: true,
|
|
@@ -5256,7 +5283,7 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5256
5283
|
return /*#__PURE__*/jsxRuntime.jsx(RenderChartCard, {
|
|
5257
5284
|
item: item,
|
|
5258
5285
|
index: index
|
|
5259
|
-
});
|
|
5286
|
+
}, "tertiary-".concat(index));
|
|
5260
5287
|
})
|
|
5261
5288
|
}), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
|
|
5262
5289
|
container: true,
|
|
@@ -5268,7 +5295,7 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5268
5295
|
return /*#__PURE__*/jsxRuntime.jsx(RenderChartCard, {
|
|
5269
5296
|
item: item,
|
|
5270
5297
|
index: index
|
|
5271
|
-
});
|
|
5298
|
+
}, "quaternary-".concat(index));
|
|
5272
5299
|
})
|
|
5273
5300
|
})]
|
|
5274
5301
|
});
|