File tree 2 files changed +34
-5
lines changed
components/brave_rewards/extension/brave_rewards
2 files changed +34
-5
lines changed Original file line number Diff line number Diff line change 184
184
"grantNotification" : {
185
185
"message" : " You have a grant waiting for you." ,
186
186
"description" : " "
187
+ },
188
+ "braveRewardsCreatingText" : {
189
+ "message" : " Creating wallet" ,
190
+ "description" : " "
187
191
}
188
192
}
Original file line number Diff line number Diff line change @@ -18,13 +18,15 @@ interface Props extends RewardsExtension.ComponentProps {
18
18
19
19
interface State {
20
20
windowId : number
21
+ creating : boolean
21
22
}
22
23
23
24
export class RewardsPanel extends React . Component < Props , State > {
24
25
constructor ( props : Props ) {
25
26
super ( props )
26
27
this . state = {
27
- windowId : - 1
28
+ windowId : - 1 ,
29
+ creating : false
28
30
}
29
31
}
30
32
@@ -39,6 +41,16 @@ export class RewardsPanel extends React.Component<Props, State> {
39
41
) {
40
42
this . getTabData ( )
41
43
}
44
+
45
+ if (
46
+ this . state . creating &&
47
+ ! prevProps . rewardsPanelData . walletCreateFailed &&
48
+ this . props . rewardsPanelData . walletCreateFailed
49
+ ) {
50
+ this . setState ( {
51
+ creating : false
52
+ } )
53
+ }
42
54
}
43
55
44
56
getTabData ( ) {
@@ -69,17 +81,30 @@ export class RewardsPanel extends React.Component<Props, State> {
69
81
} )
70
82
}
71
83
84
+ get actions ( ) {
85
+ return this . props . actions
86
+ }
87
+
88
+ onCreate = ( ) => {
89
+ this . setState ( {
90
+ creating : true
91
+ } )
92
+ this . actions . createWallet ( )
93
+ }
94
+
72
95
render ( ) {
73
- const { rewardsPanelData , actions } = this . props
96
+ const { walletCreateFailed , walletCreated } = this . props . rewardsPanelData
74
97
75
98
return (
76
99
< >
77
100
{
78
- ! rewardsPanelData . walletCreated
101
+ ! walletCreated
79
102
? < PanelWelcome
103
+ error = { walletCreateFailed }
104
+ creating = { this . state . creating }
80
105
variant = { 'two' }
81
- optInAction = { actions . createWallet }
82
- optInErrorAction = { actions . createWallet }
106
+ optInAction = { this . onCreate }
107
+ optInErrorAction = { this . onCreate }
83
108
moreLink = { this . openRewards }
84
109
/>
85
110
: < Panel windowId = { this . state . windowId } />
You can’t perform that action at this time.
0 commit comments