Page MenuHomePhabricator

[Cashtab] notification success & notification error added to Notifications.js
ClosedPublic

Authored by kieran709 on Oct 15 2021, 17:04.

Details

Summary

Related to task: T1768 Breaking notifications into a separate component file.

Test Plan

cd web/cashtab
npm start
send XEC, ensure notification works
create token, ensure notification works,
send token, ensure notification works
receive XEC, ensure notification works
receive token, ensure notification works,

set error notification to fire on load to view.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kieran709 retitled this revision from notification.success added to Notifications.js to [Cashtab] notification.success added to Notifications.js.Oct 15 2021, 17:20
bytesofman added inline comments.
web/cashtab/src/components/Send/Send.js
15 ↗(On Diff #30582)

Correct import syntax but the Notifications file should be src/components/Common

194 ↗(On Diff #30582)

Pass link param

web/cashtab/src/components/Send/SendToken.js
116 ↗(On Diff #30582)

need to pass the link param i.e. sendTokenNotification(link)

web/cashtab/src/components/Tokens/CreateTokenForm.js
19 ↗(On Diff #30582)

Put Notifications.js in src/components/Common , avoid using ../.. in imports; see pattern above

import {createTokenNotification} from `@components/Common/Notifications
138 ↗(On Diff #30582)

Need to pass the link param

web/cashtab/src/hooks/Notifications.js
1 ↗(On Diff #30582)

Move this file to the src/components/Common folder

web/cashtab/src/hooks/useWallet.js
20 ↗(On Diff #30582)

Can remove these imports now that they are handled in a separate Notifications file

904 ↗(On Diff #30582)

Need to pass in the balances, previousBalances params here

This revision now requires changes to proceed.Oct 15 2021, 21:28

Respond to review feedback and add error notifications.

kieran709 retitled this revision from [Cashtab] notification.success added to Notifications.js to [Cashtab] notification success & notification error added to Notifications.js.Oct 18 2021, 20:38
kieran709 edited the summary of this revision. (Show Details)
kieran709 edited the test plan for this revision. (Show Details)
bytesofman added inline comments.
web/cashtab/src/components/Common/Notifications.js
102 ↗(On Diff #30597)

Remove this console.log statement

116 ↗(On Diff #30597)

Remove. Use eTokenReceivedNotification for all token received cases.

138 ↗(On Diff #30597)

Add a console.log statement here, as this can occasionally be useful when troubleshooting user reports.

Make sure the console.log statement includes which function called it to better assist in debugging.

For example:

console.log(Error passed to sendXecErrorNotification`, message)`

147 ↗(On Diff #30597)

Improve this console.log statement like the one above.

Also -- why does this function accept an e parameter but sendXecErrorNotification does not?

155 ↗(On Diff #30597)

Add in the function-referencing console.log statement as above.

In fact, we should have only one error notification function that also accepts an event as a parameter, then logs that to the console. Please investigate and implement this approach unless there is some reason it's impractical.

web/cashtab/src/components/Send/SendToken.js
136 ↗(On Diff #30597)

ok i see what was going on here. Please make the generalized error notification accept three parameters: error, message, event

then when you call it here, call it like errorNotification(error=e, message=message, event='Sending eToken')

Then you can console.log the event param in the function to assist in app debugging.

web/cashtab/src/components/Tokens/CreateTokenForm.js
166 ↗(On Diff #30597)

Uncomment this + make sure it's the generic error notification as discussed in above comments

This revision now requires changes to proceed.Oct 18 2021, 20:48
kieran709 edited the summary of this revision. (Show Details)

responding to review feedback

bytesofman added inline comments.
web/cashtab/src/components/Common/Notifications.js
58 ↗(On Diff #30606)

Change name to xecReceivedNotification

117 ↗(On Diff #30606)

be more specific with variable name than ev; use something like stringDescribingCallEvent

web/cashtab/src/components/Send/Send.js
223 ↗(On Diff #30606)

no need to spell this out, use errorNotification(e, message, 'Sending XEC')

web/cashtab/src/components/Send/SendToken.js
135 ↗(On Diff #30606)

same as earlier feedback, don't label parameters here

web/cashtab/src/components/Tokens/CreateTokenForm.js
55 ↗(On Diff #30606)

do a rebase to fix these prettier issues, we finally got the diff in that upgrades prettier for the whole web folder

165 ↗(On Diff #30606)

same as earlier feedback, don't label parameters here

This revision now requires changes to proceed.Oct 21 2021, 21:10

responding to review feedback

Works great. Please rebase and remove unused imports.

web/cashtab/src/components/Send/Send.js
4 ↗(On Diff #30636)

Remove unused imports, in this case notification

web/cashtab/src/components/Send/SendToken.js
6 ↗(On Diff #30636)

Remove unused imports, in this case notification

web/cashtab/src/components/Tokens/CreateTokenForm.js
16 ↗(On Diff #30636)

Remove unused imports, in this case notification

This revision now requires changes to proceed.Oct 28 2021, 21:28

responding to review feedback

This revision is now accepted and ready to land.Oct 28 2021, 21:49