Skip to content

Commit e41e349

Browse files
committed
Fixes some compatibiliy issues introduced for wallet summary
Resolves brave/brave-browser#1297
1 parent 50de818 commit e41e349

File tree

2 files changed

+6
-38
lines changed

2 files changed

+6
-38
lines changed

components/brave_rewards/extension/brave_rewards/components/panel.tsx

+3-19
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,11 @@ export class Panel extends React.Component<Props, State> {
106106
const { rates } = walletProperties
107107
const contributionMonthly = 10 // TODO NZ fix with new reports refactor https://github.com/brave/brave-core/pull/409
108108
const convertedMonthly = utils.convertBalance(contributionMonthly, rates)
109-
let total = contributionMonthly * -1
110109

111110
let props = {
112111
contribute: {
113112
tokens: contributionMonthly,
114113
converted: convertedMonthly
115-
},
116-
total: {
117-
tokens: contributionMonthly,
118-
converted: convertedMonthly
119114
}
120115
}
121116

@@ -125,44 +120,33 @@ export class Panel extends React.Component<Props, State> {
125120
tokens: report.ads,
126121
converted: utils.convertBalance(report.ads, rates)
127122
}
128-
129-
total += report.ads
130123
}
131124

132125
if (report.donations) {
133126
props['donation'] = {
134127
tokens: report.donations,
135128
converted: utils.convertBalance(report.donations, rates)
136129
}
137-
138-
total -= report.donations
139130
}
140131

141132
if (report.grants) {
142133
props['grant'] = {
143134
tokens: report.grants,
144135
converted: utils.convertBalance(report.grants, rates)
145136
}
146-
147-
total += report.grants
148137
}
149138

150139
if (report.oneTime) {
151140
props['tips'] = {
152141
tokens: report.oneTime,
153142
converted: utils.convertBalance(report.oneTime, rates)
154143
}
155-
156-
total -= report.oneTime
157-
}
158-
159-
props['total'] = {
160-
tokens: total,
161-
converted: utils.convertBalance(total, rates)
162144
}
163145
}
164146

165-
return props
147+
return {
148+
report: props
149+
}
166150
}
167151

168152
openRewardsPage () {

components/brave_rewards/ui/components/pageWallet.tsx

+3-19
Original file line numberDiff line numberDiff line change
@@ -180,16 +180,11 @@ class PageWallet extends React.Component<Props, State> {
180180
const { contributionMonthly, walletInfo, reports } = this.props.rewardsData
181181
const { rates } = walletInfo
182182
const convertedMonthly = utils.convertBalance(contributionMonthly, rates)
183-
let total = contributionMonthly * -1
184183

185184
let props = {
186185
contribute: {
187186
tokens: contributionMonthly,
188187
converted: convertedMonthly
189-
},
190-
total: {
191-
tokens: contributionMonthly,
192-
converted: convertedMonthly
193188
}
194189
}
195190

@@ -202,44 +197,33 @@ class PageWallet extends React.Component<Props, State> {
202197
tokens: report.ads,
203198
converted: utils.convertBalance(report.ads, rates)
204199
}
205-
206-
total += report.ads
207200
}
208201

209202
if (report.donations) {
210203
props['donation'] = {
211204
tokens: report.donations,
212205
converted: utils.convertBalance(report.donations, rates)
213206
}
214-
215-
total -= report.donations
216207
}
217208

218209
if (report.grants) {
219210
props['grant'] = {
220211
tokens: report.grants,
221212
converted: utils.convertBalance(report.grants, rates)
222213
}
223-
224-
total += report.grants
225214
}
226215

227216
if (report.oneTime) {
228217
props['tips'] = {
229218
tokens: report.oneTime,
230219
converted: utils.convertBalance(report.oneTime, rates)
231220
}
232-
233-
total -= report.oneTime
234-
}
235-
236-
props['total'] = {
237-
tokens: total,
238-
converted: utils.convertBalance(total, rates)
239221
}
240222
}
241223

242-
return props
224+
return {
225+
report: props
226+
}
243227
}
244228

245229
render () {

0 commit comments

Comments
 (0)