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