@@ -11,9 +11,8 @@ import {
11
11
OnBehalfDonor ,
12
12
SentGift ,
13
13
} from "src/Common/Types" ;
14
- import getFormatedCurrency from "src/Utils/getFormattedCurrency" ;
15
- import { getFormattedNumber } from "src/Utils/getFormattedNumber" ;
16
14
import Avatar from "./Avatar" ;
15
+ import TransactionSummary from "./TransactionSummary" ;
17
16
18
17
interface Props {
19
18
isMobile : boolean ;
@@ -58,7 +57,9 @@ const LeftPanelInfo = ({
58
57
const { t, i18n } = useTranslation ( "common" ) ;
59
58
const router = useRouter ( ) ;
60
59
61
- const canShowAvatar = Boolean ( donationStep !== null && donationStep > 0 ) ;
60
+ const canShowAvatar = donationStep !== null && donationStep > 0 ;
61
+ const canShowTransactionSummary =
62
+ paymentSetup !== null && ( donationStep === 2 || donationStep === 3 ) ;
62
63
63
64
const handlePopoverOpen = ( event : MouseEvent < HTMLElement > ) => {
64
65
setAnchorElement ( event . currentTarget ) ;
@@ -71,68 +72,14 @@ const LeftPanelInfo = ({
71
72
return projectDetails ? (
72
73
< div className = "donations-info text-white" >
73
74
{ canShowAvatar && < Avatar projectDetails = { projectDetails } /> }
74
- { paymentSetup &&
75
- ( donationStep === 2 || donationStep === 3 ) &&
76
- ( projectDetails . purpose === "trees" ||
77
- projectDetails . purpose === "conservation" ) && (
78
- < div className = "contact-details-info" >
79
- < div className = { "w-100 mt-10 text-white" } >
80
- { t ( "donating" ) } { " " }
81
- < span className = "text-bold" style = { { marginRight : "4px" } } >
82
- { getFormatedCurrency (
83
- i18n . language ,
84
- currency ,
85
- paymentSetup . unitCost * quantity
86
- ) }
87
- </ span >
88
- { paymentSetup . purpose === "trees"
89
- ? t ( "fortreeCountTrees" , {
90
- count : Number ( quantity ) ,
91
- treeCount : getFormattedNumber (
92
- i18n . language ,
93
- Number ( quantity )
94
- ) ,
95
- } )
96
- : paymentSetup . purpose === "conservation"
97
- ? t ( "forQuantitym2" , {
98
- quantity : getFormattedNumber (
99
- i18n . language ,
100
- Number ( quantity )
101
- ) ,
102
- } )
103
- : [ ] } { " " }
104
- { frequency === "monthly"
105
- ? t ( "everyMonth" )
106
- : frequency === "yearly"
107
- ? t ( "everyYear" )
108
- : "" }
109
- </ div >
110
- </ div >
111
- ) }
112
-
113
- { paymentSetup &&
114
- ( donationStep === 2 || donationStep === 3 ) &&
115
- ( projectDetails . purpose === "bouquet" ||
116
- projectDetails . purpose === "funds" ) && (
117
- < div className = "contact-details-info" >
118
- < div className = { "w-100 mt-10 text-white" } >
119
- { t ( "donating" ) } { " " }
120
- < span className = "text-bold" style = { { marginRight : "4px" } } >
121
- { getFormatedCurrency (
122
- i18n . language ,
123
- currency ,
124
- paymentSetup . unitCost * quantity
125
- ) }
126
- </ span >
127
- { frequency === "monthly"
128
- ? t ( "everyMonth" )
129
- : frequency === "yearly"
130
- ? t ( "everyYear" )
131
- : "" }
132
- </ div >
133
- </ div >
134
- ) }
135
-
75
+ { canShowTransactionSummary && (
76
+ < TransactionSummary
77
+ currency = { currency }
78
+ quantity = { quantity }
79
+ frequency = { frequency }
80
+ paymentSetup = { paymentSetup }
81
+ />
82
+ ) }
136
83
{ donationStep && donationStep > 0 ? (
137
84
< >
138
85
{ projectDetails . purpose === "trees" ||
0 commit comments