@@ -3,20 +3,19 @@ import { useTranslation } from 'react-i18next';
33import { useFeature } from '@growthbook/growthbook-react' ;
44import { Col , Row , Modal , Spacer } from '@freecodecamp/ui' ;
55import { closeDonationModal } from '../../redux/actions' ;
6- import { PaymentContext } from '../../../../shared/config/donation-settings' ; //
6+ import { PaymentContext } from '../../../../shared/config/donation-settings' ;
77import donationAnimation from '../../assets/images/donation-bear-animation.svg' ;
88import donationAnimationB from '../../assets/images/new-bear-animation.svg' ;
99import supporterBear from '../../assets/images/supporter-bear.svg' ;
1010import callGA from '../../analytics/call-ga' ;
1111import MultiTierDonationForm from './multi-tier-donation-form' ;
1212import { ModalBenefitList } from './donation-text-components' ;
13-
14- type RecentlyClaimedBlock = null | { block : string ; superBlock : string } ;
13+ import { DonatableSectionRecentlyCompleted } from './types' ;
1514
1615type DonationModalBodyProps = {
1716 activeDonors ?: number ;
1817 closeDonationModal : typeof closeDonationModal ;
19- recentlyClaimedBlock : RecentlyClaimedBlock ;
18+ donatableSectionRecentlyCompleted : DonatableSectionRecentlyCompleted ;
2019 setCanClose : ( canClose : boolean ) => void ;
2120} ;
2221
@@ -32,37 +31,39 @@ const Illustration = () => {
3231} ;
3332
3433function ModalHeader ( {
35- recentlyClaimedBlock,
3634 showHeaderAndFooter,
3735 donationAttempted,
38- showForm
36+ showForm,
37+ donatableSectionRecentlyCompleted
3938} : {
40- recentlyClaimedBlock : RecentlyClaimedBlock ;
39+ donatableSectionRecentlyCompleted : DonatableSectionRecentlyCompleted ;
4140 showHeaderAndFooter : boolean ;
4241 donationAttempted : boolean ;
4342 showForm : boolean ;
4443} ) {
4544 const { t } = useTranslation ( ) ;
45+ const { section, superBlock, title } =
46+ donatableSectionRecentlyCompleted || { } ;
4647
4748 if ( ! showHeaderAndFooter || donationAttempted ) {
4849 return null ;
4950 } else if ( ! showForm ) {
5051 return (
5152 < Row className = 'text-center' >
5253 < Col sm = { 10 } smOffset = { 1 } xs = { 12 } >
53- { recentlyClaimedBlock !== null && (
54+ { donatableSectionRecentlyCompleted && (
5455 < >
5556 < b >
5657 { t ( 'donate.nicely-done' , {
57- block : t (
58- `intro:${ recentlyClaimedBlock . superBlock } .blocks.${ recentlyClaimedBlock . block } .title`
59- )
58+ block :
59+ section === 'module'
60+ ? t ( `intro:${ superBlock } .${ section } s.${ title } ` )
61+ : t ( `intro:${ superBlock } .${ section } s.${ title } .title` )
6062 } ) }
6163 </ b >
6264 < Spacer size = 'xs' />
6365 </ >
6466 ) }
65-
6667 < Modal . Header showCloseButton = { false } borderless >
6768 { t ( 'donate.modal-benefits-title' ) }
6869 </ Modal . Header >
@@ -188,16 +189,16 @@ const AnimationContainer = ({
188189} ;
189190
190191const BecomeASupporterConfirmation = ( {
191- recentlyClaimedBlock,
192192 showHeaderAndFooter,
193193 closeDonationModal,
194194 donationAttempted,
195195 showForm,
196196 setShowHeaderAndFooter,
197197 handleProcessing,
198- setShowForm
198+ setShowForm,
199+ donatableSectionRecentlyCompleted
199200} : {
200- recentlyClaimedBlock : RecentlyClaimedBlock ;
201+ donatableSectionRecentlyCompleted : DonatableSectionRecentlyCompleted ;
201202 showHeaderAndFooter : boolean ;
202203 closeDonationModal : ( ) => void ;
203204 donationAttempted : boolean ;
@@ -212,7 +213,7 @@ const BecomeASupporterConfirmation = ({
212213 < Illustration />
213214 </ div >
214215 < ModalHeader
215- recentlyClaimedBlock = { recentlyClaimedBlock }
216+ donatableSectionRecentlyCompleted = { donatableSectionRecentlyCompleted }
216217 showHeaderAndFooter = { showHeaderAndFooter }
217218 donationAttempted = { donationAttempted }
218219 showForm = { showForm }
@@ -240,7 +241,7 @@ const BecomeASupporterConfirmation = ({
240241
241242function DonationModalBody ( {
242243 closeDonationModal,
243- recentlyClaimedBlock ,
244+ donatableSectionRecentlyCompleted ,
244245 setCanClose
245246} : DonationModalBodyProps ) : JSX . Element {
246247 const [ donationAttempted , setDonationAttempted ] = useState ( false ) ;
@@ -273,7 +274,9 @@ function DonationModalBody({
273274 < AnimationContainer secondsRemaining = { secondsRemaining } />
274275 ) : (
275276 < BecomeASupporterConfirmation
276- recentlyClaimedBlock = { recentlyClaimedBlock }
277+ donatableSectionRecentlyCompleted = {
278+ donatableSectionRecentlyCompleted
279+ }
277280 showHeaderAndFooter = { showHeaderAndFooter }
278281 closeDonationModal = { closeDonationModal }
279282 donationAttempted = { donationAttempted }
0 commit comments