Skip to content

Commit 238f907

Browse files
committed
feat: updates Thank you screen for m2 donations
- updates planet-sdk to get latest `Donation` type - adapts thank you message and image text for donations with unitType = m2 and purpose = trees
1 parent 3569045 commit 238f907

File tree

5 files changed

+42
-32
lines changed

5 files changed

+42
-32
lines changed

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"@mui/material": "^5.11.8",
2727
"@next/bundle-analyzer": "^10.1.3",
2828
"@paypal/react-paypal-js": "^7.8.2",
29-
"@planet-sdk/common": "^0.1.27",
29+
"@planet-sdk/common": "^0.1.29",
3030
"@sentry/browser": "^6.2.5",
3131
"@sentry/integrations": "^6.2.5",
3232
"@sentry/node": "^6.2.5",

public/locales/en/common.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,10 @@
7878
"contributionMessage": "Maybe you'll visit them some day? In the mean time, maybe hook up your friends with some trees of their own by telling them about yours?",
7979
"fundingDonationSuccess": "Thank you for your contribution! You’ll receive a confirmation for your contribution on your email.",
8080
"fundingContributionMessage": "We will keep you posted about our actions, in the mean time maybe share with your friends about your contribution.",
81-
"yourTreesPlantedByOnLocation": "Your {{treeCount}} trees will be planted by {{projectName}} in {{location}}.",
81+
"restorationDonationUsage": "Your donation will be used to restore {{units}} {{unitType}} by {{projectName}} in {{location}}.",
8282
"m2conservedByOnLocation": "{{quantity}} m² forest will be conserved by {{projectName}} in {{location}}.",
8383
"myTreesPlantedByOnLocation": "My {{treeCount}} trees are being planted in {{location}}.",
84+
"restorationDonationShareDetails": "I donated {{amount}} for forest restoration in {{location}}.",
8485
"iDonatedForestOnLocation": "I donated {{amount}} for forest conservation in {{location}}.",
8586
"weDonatedForestOnLocation": "We donated {{amount}} for forest conservation in {{location}}.",
8687
"plantTreesAtURL": "Restore & protect trees at {{url}}",
@@ -172,7 +173,7 @@
172173
"lowBalance": "Balance is low",
173174
"oneTimePay": "Donation with PlanetCash is a one time payment",
174175
"currency": "Currency",
175-
"treesPurpose": "tree donation",
176+
"treesPurpose": "restoration donation",
176177
"fundsPurpose": "donation",
177178
"bouquetPurpose": "donation",
178179
"conservationPurpose": "conservation donation",
@@ -216,4 +217,4 @@
216217
"top_project_standards_fulfilled": "The project inspection revealed that this project fulfilled at least 12 of the 19 Top Project <2>standards.</2>",
217218
"standardsLink": "https://www.plant-for-the-planet.org/standards/",
218219
"enterValidEmail": "Please enter a valid email"
219-
}
220+
}

src/Donations/Micros/PaymentStatus/ImageComponent.tsx

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,26 @@ const ImageComponent = ({
6060
return (
6161
<div className={"donation-count p-20"}>
6262
{projectDetails?.purpose === "trees" &&
63-
t("common:myTreesPlantedByOnLocation", {
64-
treeCount: getFormattedNumber(
65-
i18n.language,
66-
Number(donation.treeCount)
67-
),
68-
location: t(
69-
"country:" + donation.destination.country.toLowerCase()
70-
),
71-
})}
63+
(donation.unitType === "tree"
64+
? t("common:myTreesPlantedByOnLocation", {
65+
treeCount: getFormattedNumber(
66+
i18n.language,
67+
Number(donation.treeCount)
68+
),
69+
location: t(
70+
"country:" + donation.destination.country.toLowerCase()
71+
),
72+
})
73+
: t("common:restorationDonationShareDetails", {
74+
amount: getFormattedCurrency(
75+
i18n.language,
76+
donation.currency,
77+
Number(donation.amount)
78+
),
79+
location: t(
80+
"country:" + donation.destination.country.toLowerCase()
81+
),
82+
}))}
7283
{projectDetails?.purpose === "conservation" &&
7384
t(
7485
`common:${

src/Donations/Micros/PaymentStatus/ThankyouMessage.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, { ReactElement } from "react";
22
import { useTranslation } from "next-i18next";
33
import getFormatedCurrency from "src/Utils/getFormattedCurrency";
4-
import { getFormattedNumber } from "src/Utils/getFormattedNumber";
54
import { QueryParamContext } from "src/Layout/QueryParamContext";
65
import { FetchedProjectDetails } from "src/Common/Types";
76
import { Donation } from "@planet-sdk/common/build/types/donation";
@@ -49,17 +48,16 @@ function ThankyouMessage({
4948
: null;
5049

5150
// EXAMPLE: Your 50 trees will be planted by AMU EcoVillage Project, Ethiopia in Ethiopia.
52-
const donationProjectMessage = donation.destination
53-
? " " +
54-
t("common:yourTreesPlantedByOnLocation", {
55-
treeCount: getFormattedNumber(
56-
i18n.language,
57-
Number(donation.treeCount)
58-
),
59-
projectName: donation.destination.name,
60-
location: t("country:" + donation.destination.country.toLowerCase()),
61-
})
62-
: null;
51+
const donationProjectMessage =
52+
donation.destination && donation.units
53+
? " " +
54+
t("common:restorationDonationUsage", {
55+
units: donation.units,
56+
unitType: t(`common:${donation.unitType}`, { count: donation.units }),
57+
projectName: donation.destination.name,
58+
location: t("country:" + donation.destination.country.toLowerCase()),
59+
})
60+
: null;
6361

6462
const Message = () => {
6563
return (

0 commit comments

Comments
 (0)