@ammarkhalidfarooq/dashboard-package 0.3.38 → 0.3.40

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
@@ -5518,6 +5518,11 @@ var OverallSection = function OverallSection(_ref) {
5518
5518
  icon: iconsMaterial.Adjust
5519
5519
  }
5520
5520
  };
5521
+ var activeCampaignsData = (apiData === null || apiData === void 0 ? void 0 : apiData.activeCampaigns) || [];
5522
+ var donorMix = (apiData === null || apiData === void 0 ? void 0 : apiData.donorMix) || {};
5523
+ var totalDonorsMix = (donorMix.newDonors || 0) + (donorMix.returningDonors || 0);
5524
+ var newDonorsPerc = totalDonorsMix > 0 ? Math.round(donorMix.newDonors / totalDonorsMix * 100) : 0;
5525
+ var returningDonorsPerc = totalDonorsMix > 0 ? Math.round(donorMix.returningDonors / totalDonorsMix * 100) : 0;
5521
5526
  var renderCard = function renderCard(title) {
5522
5527
  return /*#__PURE__*/jsxRuntime.jsx(DisplayCard, {
5523
5528
  title: title,
@@ -5856,64 +5861,19 @@ var OverallSection = function OverallSection(_ref) {
5856
5861
  columns: ["Campaign", "Raised", "Progress", "Donors", "Avg gift"
5857
5862
  // "Status",
5858
5863
  ],
5859
- rows: [{
5860
- id: "OS",
5861
- name: "Orphan sponsorship Yemen",
5862
- val1: "$78,400",
5863
- type: "progress",
5864
- progress: 78,
5865
- val3: "82",
5866
- val4: "$956"
5867
- // status: "Active",
5868
- // statusColor: "#22C55E",
5869
- // statusBg: "#DCFCE7",
5870
- }, {
5871
- id: "EF",
5872
- name: "Emergency food — Gaza",
5873
- val1: "$62,100",
5874
- type: "progress",
5875
- progress: 83,
5876
- val3: "61",
5877
- val4: "$1,018"
5878
- // status: "Active",
5879
- // statusColor: "#22C55E",
5880
- // statusBg: "#DCFCE7",
5881
- }, {
5882
- id: "MB",
5883
- name: "Masjid build — Somalia",
5884
- val1: "$38,200",
5885
- type: "progress",
5886
- progress: 48,
5887
- val3: "34",
5888
- val4: "$1,124"
5889
- // status: "Slow",
5890
- // statusColor: "#B45309",
5891
- // statusBg: "#FEF3C7",
5892
- // progressColor: "#F59E0B",
5893
- }, {
5894
- id: "WW",
5895
- name: "Water wells — Pakistan",
5896
- val1: "$29,800",
5897
- type: "progress",
5898
- progress: 99,
5899
- val3: "28",
5900
- val4: "$1,064"
5901
- // status: "Closing",
5902
- // statusColor: "#6366F1",
5903
- // statusBg: "#EEF2FF",
5904
- // progressColor: "#10B981",
5905
- }, {
5906
- id: "RP",
5907
- name: "Ramadan packs — Egypt",
5908
- val1: "$19,400",
5909
- type: "progress",
5910
- progress: 78,
5911
- val3: "10",
5912
- val4: "$1,940"
5913
- // status: "Active",
5914
- // statusColor: "#22C55E",
5915
- // statusBg: "#DCFCE7",
5916
- }]
5864
+ rows: activeCampaignsData.map(function (campaign) {
5865
+ return {
5866
+ id: campaign.campaignName ? campaign.campaignName.split(" ").filter(Boolean).map(function (word) {
5867
+ return word[0];
5868
+ }).join("").toUpperCase().slice(0, 2) : "??",
5869
+ name: campaign.campaignName || "Untitled Campaign",
5870
+ val1: "$".concat(formatNumber(campaign.raisedAmount || 0)),
5871
+ type: "progress",
5872
+ progress: Math.round((campaign.raisedAmount || 0) / (campaign.totalAmount || 1) * 100),
5873
+ val3: formatNumber(campaign.donors || 0),
5874
+ val4: "$".concat(formatNumber(campaign.avgGift || 0))
5875
+ };
5876
+ })
5917
5877
  })
5918
5878
  }), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
5919
5879
  item: true,
@@ -5925,22 +5885,22 @@ var OverallSection = function OverallSection(_ref) {
5925
5885
  children: /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, {
5926
5886
  title: "Donor mix",
5927
5887
  subtitle: "Acquisition vs retention",
5928
- series: [68, 32],
5888
+ series: [donorMix.newDonors || 0, donorMix.returningDonors || 0],
5929
5889
  labels: ["New donors", "Returning"],
5930
5890
  colors: ["rgb(99, 99, 230)", "#10B981"],
5931
5891
  centerLabel: "donors",
5932
- centerValue: "215",
5892
+ centerValue: totalDonorsMix.toString(),
5933
5893
  items: [{
5934
5894
  label: "New donors",
5935
- val: "146 · 68%",
5895
+ val: "".concat(donorMix.newDonors || 0, " \xB7 ").concat(newDonorsPerc, "%"),
5936
5896
  color: "rgb(99, 99, 230)"
5937
5897
  }, {
5938
5898
  label: "Returning",
5939
- val: "69 · 32%",
5899
+ val: "".concat(donorMix.returningDonors || 0, " \xB7 ").concat(returningDonorsPerc, "%"),
5940
5900
  color: "#10B981"
5941
5901
  }],
5942
- bottomSummaryValue: "$130.58",
5943
- bottomSummaryTrend: "8.4% vs last month",
5902
+ bottomSummaryValue: "$".concat(donorMix.avgGift || 0),
5903
+ bottomSummaryTrend: "".concat(donorMix.donorMixPrev || 0, "% vs ").concat(dateName || "last month"),
5944
5904
  sx: {
5945
5905
  width: "100%"
5946
5906
  }