@ammarkhalidfarooq/dashboard-package 0.4.42 → 0.4.43
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 +116 -17
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +117 -18
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { Suspense, lazy, useState, useEffect } from 'react';
|
|
2
|
-
import { Box, Button, Menu, MenuItem, Grid, Card, CardContent, Typography, IconButton, ThemeProvider, CircularProgress, LinearProgress, TableContainer, Table, TableHead, TableRow, TableCell, TableBody, Avatar } from '@mui/material';
|
|
2
|
+
import { Box, Button, Menu, MenuItem, Grid, Card, CardContent, Typography, IconButton, ThemeProvider, CircularProgress, LinearProgress, TableContainer, Table, TableHead, TableRow, TableCell, TableBody, Avatar, Stack } from '@mui/material';
|
|
3
3
|
import { MoreHoriz, MoreVert, Check, InfoOutlined, Settings, TrendingUp, Adjust, PaidOutlined, PeopleAltOutlined, FavoriteOutlined, PersonOutlined, IndeterminateCheckBoxOutlined, SearchOutlined, HighlightOff, NearMe, Email, NotInterested } from '@mui/icons-material';
|
|
4
4
|
import { createTheme, useTheme } from '@mui/material/styles';
|
|
5
5
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
@@ -5145,6 +5145,70 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
|
|
|
5145
5145
|
});
|
|
5146
5146
|
};
|
|
5147
5147
|
|
|
5148
|
+
var MetricCard = function MetricCard(_ref) {
|
|
5149
|
+
var title = _ref.title,
|
|
5150
|
+
value = _ref.value,
|
|
5151
|
+
caption = _ref.caption,
|
|
5152
|
+
icon = _ref.icon,
|
|
5153
|
+
active = _ref.active,
|
|
5154
|
+
warning = _ref.warning,
|
|
5155
|
+
error = _ref.error,
|
|
5156
|
+
onClick = _ref.onClick;
|
|
5157
|
+
return /*#__PURE__*/jsxs(Box, {
|
|
5158
|
+
sx: {
|
|
5159
|
+
bgcolor: "#fff",
|
|
5160
|
+
border: "1.5px solid ".concat(active ? "#4F46E5" : warning ? "#F3B33D" : error ? "#ef4444" : "#F1F1F5"),
|
|
5161
|
+
borderRadius: "16px",
|
|
5162
|
+
p: {
|
|
5163
|
+
xs: 1.75,
|
|
5164
|
+
md: 2
|
|
5165
|
+
},
|
|
5166
|
+
minHeight: 108,
|
|
5167
|
+
boxShadow: "0 14px 30px rgba(21, 26, 45, 0.06)"
|
|
5168
|
+
},
|
|
5169
|
+
onClick: onClick,
|
|
5170
|
+
children: [/*#__PURE__*/jsxs(Stack, {
|
|
5171
|
+
direction: "row",
|
|
5172
|
+
justifyContent: "space-between",
|
|
5173
|
+
alignItems: "center",
|
|
5174
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
5175
|
+
sx: {
|
|
5176
|
+
color: active ? "#818CF8" : "#999EAA",
|
|
5177
|
+
fontSize: 13,
|
|
5178
|
+
fontWeight: 500,
|
|
5179
|
+
letterSpacing: 0
|
|
5180
|
+
},
|
|
5181
|
+
children: title
|
|
5182
|
+
}), /*#__PURE__*/jsx(Avatar, {
|
|
5183
|
+
sx: {
|
|
5184
|
+
width: 42,
|
|
5185
|
+
height: 42,
|
|
5186
|
+
bgcolor: warning ? "#FFF3CF" : error ? "#fee2e2" : "#EEF2FF",
|
|
5187
|
+
color: warning ? "#B45309" : error ? "#ef4444" : "#4F46E5"
|
|
5188
|
+
},
|
|
5189
|
+
children: icon
|
|
5190
|
+
})]
|
|
5191
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
5192
|
+
sx: {
|
|
5193
|
+
mt: 0.3,
|
|
5194
|
+
fontSize: 22,
|
|
5195
|
+
fontWeight: 700,
|
|
5196
|
+
color: active ? "#4F46E5" : "#050509",
|
|
5197
|
+
lineHeight: 1.15
|
|
5198
|
+
},
|
|
5199
|
+
children: value
|
|
5200
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
5201
|
+
sx: {
|
|
5202
|
+
mt: 1.05,
|
|
5203
|
+
fontSize: 12,
|
|
5204
|
+
fontWeight: 500,
|
|
5205
|
+
color: caption.includes("failed") ? "#4F46E5" : error ? "#ef4444" : "#0B8F61"
|
|
5206
|
+
},
|
|
5207
|
+
children: caption
|
|
5208
|
+
})]
|
|
5209
|
+
});
|
|
5210
|
+
};
|
|
5211
|
+
|
|
5148
5212
|
var OverallSection = function OverallSection(_ref) {
|
|
5149
5213
|
var _apiData$totalRaisedP, _apiData$netRaisedCar, _apiData$netRaisedPre, _apiData$averageDonat, _apiData$averageDonat2, _apiData$roasCard, _apiData$roasCardPrev, _orderBumpData$prevTr;
|
|
5150
5214
|
var _ref$apiData = _ref.apiData,
|
|
@@ -5207,37 +5271,55 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5207
5271
|
value: "$".concat(formatNumber(apiData === null || apiData === void 0 ? void 0 : apiData.totalRaisedCard)) || "$240.9K",
|
|
5208
5272
|
subValue: "".concat(Number((_apiData$totalRaisedP = apiData === null || apiData === void 0 ? void 0 : apiData.totalRaisedPrev) !== null && _apiData$totalRaisedP !== void 0 ? _apiData$totalRaisedP : 0).toFixed(2), "% vs ").concat(dateName || "last month"),
|
|
5209
5273
|
label: "Total Raised",
|
|
5210
|
-
icon: PaidOutlined
|
|
5274
|
+
icon: /*#__PURE__*/jsx(PaidOutlined, {}),
|
|
5275
|
+
money: true,
|
|
5276
|
+
error: false,
|
|
5277
|
+
warning: false
|
|
5211
5278
|
},
|
|
5212
5279
|
"Net Raised": {
|
|
5213
5280
|
value: "$".concat(formatNumber((_apiData$netRaisedCar = apiData === null || apiData === void 0 ? void 0 : apiData.netRaisedCard) !== null && _apiData$netRaisedCar !== void 0 ? _apiData$netRaisedCar : 0)),
|
|
5214
5281
|
subValue: "".concat(Number((_apiData$netRaisedPre = apiData === null || apiData === void 0 ? void 0 : apiData.netRaisedPrev) !== null && _apiData$netRaisedPre !== void 0 ? _apiData$netRaisedPre : 0).toFixed(2), "% vs ").concat(dateName !== null && dateName !== void 0 ? dateName : "previous period"),
|
|
5215
5282
|
label: "Net Raised",
|
|
5216
|
-
icon: FavoriteOutlined
|
|
5283
|
+
icon: /*#__PURE__*/jsx(FavoriteOutlined, {}),
|
|
5284
|
+
money: true,
|
|
5285
|
+
error: false,
|
|
5286
|
+
warning: false
|
|
5217
5287
|
},
|
|
5218
5288
|
"Total Donors": {
|
|
5219
5289
|
value: (apiData === null || apiData === void 0 ? void 0 : apiData.totalDonorsCard) || "215",
|
|
5220
5290
|
subValue: "".concat(apiData === null || apiData === void 0 ? void 0 : apiData.totalDonorsPrev, " new") || "31 new",
|
|
5221
5291
|
label: "Total Donors",
|
|
5222
|
-
icon: PeopleAltOutlined
|
|
5292
|
+
icon: /*#__PURE__*/jsx(PeopleAltOutlined, {}),
|
|
5293
|
+
money: false,
|
|
5294
|
+
error: false,
|
|
5295
|
+
warning: false
|
|
5223
5296
|
},
|
|
5224
5297
|
"Avg donation": {
|
|
5225
5298
|
value: "$".concat(formatNumber((_apiData$averageDonat = apiData === null || apiData === void 0 ? void 0 : apiData.averageDonationsCard) !== null && _apiData$averageDonat !== void 0 ? _apiData$averageDonat : 0)),
|
|
5226
5299
|
subValue: "".concat(Number((_apiData$averageDonat2 = apiData === null || apiData === void 0 ? void 0 : apiData.averageDonationsCardPrev) !== null && _apiData$averageDonat2 !== void 0 ? _apiData$averageDonat2 : 0).toFixed(2), "% vs ").concat(dateName !== null && dateName !== void 0 ? dateName : "last month"),
|
|
5227
5300
|
label: "Average Donation Amount",
|
|
5228
|
-
icon: PaidOutlined
|
|
5301
|
+
icon: /*#__PURE__*/jsx(PaidOutlined, {}),
|
|
5302
|
+
money: true,
|
|
5303
|
+
error: false,
|
|
5304
|
+
warning: false
|
|
5229
5305
|
},
|
|
5230
5306
|
"ROAS": {
|
|
5231
5307
|
value: "".concat(formatNumber((_apiData$roasCard = apiData === null || apiData === void 0 ? void 0 : apiData.roasCard) !== null && _apiData$roasCard !== void 0 ? _apiData$roasCard : 0), "x"),
|
|
5232
5308
|
subValue: "".concat(Number((_apiData$roasCardPrev = apiData === null || apiData === void 0 ? void 0 : apiData.roasCardPrev) !== null && _apiData$roasCardPrev !== void 0 ? _apiData$roasCardPrev : 0).toFixed(2), "x vs ").concat(dateName !== null && dateName !== void 0 ? dateName : "last month"),
|
|
5233
5309
|
label: "ROAS",
|
|
5234
|
-
icon: TrendingUp
|
|
5310
|
+
icon: /*#__PURE__*/jsx(TrendingUp, {}),
|
|
5311
|
+
money: false,
|
|
5312
|
+
error: false,
|
|
5313
|
+
warning: false
|
|
5235
5314
|
},
|
|
5236
5315
|
"Conversion": {
|
|
5237
5316
|
value: (apiData === null || apiData === void 0 ? void 0 : apiData.conversionCard) || "1.7%",
|
|
5238
5317
|
subValue: (apiData === null || apiData === void 0 ? void 0 : apiData.conversionSub) || "215 / 12.4K",
|
|
5239
5318
|
label: "Conversion Rate",
|
|
5240
|
-
icon: Adjust
|
|
5319
|
+
icon: /*#__PURE__*/jsx(Adjust, {}),
|
|
5320
|
+
money: false,
|
|
5321
|
+
error: false,
|
|
5322
|
+
warning: false
|
|
5241
5323
|
}
|
|
5242
5324
|
};
|
|
5243
5325
|
var activeCampaignsData = (apiData === null || apiData === void 0 ? void 0 : apiData.activeCampaigns) || [];
|
|
@@ -5246,22 +5328,39 @@ var OverallSection = function OverallSection(_ref) {
|
|
|
5246
5328
|
var newDonorsPerc = totalDonorsMix > 0 ? Math.round(donorMix.newDonors / totalDonorsMix * 100) : 0;
|
|
5247
5329
|
var returningDonorsPerc = totalDonorsMix > 0 ? Math.round(donorMix.returningDonors / totalDonorsMix * 100) : 0;
|
|
5248
5330
|
var renderCard = function renderCard(title) {
|
|
5249
|
-
return /*#__PURE__*/jsx(
|
|
5331
|
+
return /*#__PURE__*/jsx(MetricCard
|
|
5332
|
+
// key={title}
|
|
5333
|
+
, {
|
|
5250
5334
|
title: title,
|
|
5251
|
-
value: metricInfo[title].value,
|
|
5252
|
-
|
|
5335
|
+
value: metricInfo[title].money ? metricInfo[title].value : metricInfo[title].value,
|
|
5336
|
+
caption: metricInfo[title].subValue,
|
|
5253
5337
|
icon: metricInfo[title].icon,
|
|
5338
|
+
error: metricInfo[title].error,
|
|
5339
|
+
active: activeMetric === title,
|
|
5254
5340
|
onClick: function onClick() {
|
|
5255
5341
|
return setActiveMetric(title);
|
|
5256
5342
|
},
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
}
|
|
5343
|
+
sx: metricInfo[title].error ? {
|
|
5344
|
+
border: "2px solid #ef4444",
|
|
5345
|
+
bgcolor: "#fffafa"
|
|
5346
|
+
} : {}
|
|
5347
|
+
})
|
|
5348
|
+
// <DisplayCard
|
|
5349
|
+
// key={title}
|
|
5350
|
+
// title={title}
|
|
5351
|
+
// value={metricInfo[title].value}
|
|
5352
|
+
// subValue={metricInfo[title].subValue}
|
|
5353
|
+
// icon={metricInfo[title].icon}
|
|
5354
|
+
// onClick={() => setActiveMetric(title)}
|
|
5355
|
+
// isActive={activeMetric === title}
|
|
5356
|
+
// sx={{
|
|
5357
|
+
// // border:
|
|
5358
|
+
// // activeMetric === title
|
|
5359
|
+
// // ? "1px solid rgb(99, 99, 230)"
|
|
5360
|
+
// // : "2px solid #f0f0f0",
|
|
5361
|
+
// }}
|
|
5362
|
+
// />
|
|
5363
|
+
;
|
|
5265
5364
|
};
|
|
5266
5365
|
var extendedCharts = getExtendedCharts();
|
|
5267
5366
|
var selectedInfo = metricInfo[activeMetric];
|