-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
frontend: improvements of Send
component
#2966
base: master
Are you sure you want to change the base?
frontend: improvements of Send
component
#2966
Commits on Oct 14, 2024
-
frontend: utilize send-wrapper for some logic
Utilize the `SendWrapper` to get the mobile channel error, and (bb01) paired status in case a bb01 is connected. This simplifies the `Send` component and better distinguishes code for bb01/bb02 stuff.
Configuration menu - View commit details
-
Copy full SHA for 5900704 - Browse repository at this point
Copy the full SHA 5900704View commit details -
frontend: type coinUnit in IAccount
Type `coinUnit` in `IAccount` to use `CoinUnit`.
Configuration menu - View commit details
-
Copy full SHA for a03270f - Browse repository at this point
Copy the full SHA a03270fView commit details -
frontend: remove unused state in send component
Remove the unused `account` state from the `State` type declaration because it is never used. Remove the `paired?` state from the `Send` `State` declaration and also remove its usage in the return statement. It is always `undefined` which means `hidden={paired !== false}` is always `true`. This means we can remove it completely.
Configuration menu - View commit details
-
Copy full SHA for 43b274b - Browse repository at this point
Copy the full SHA 43b274bView commit details -
frontend: improve send error handling
The `txProposalErrorHandling` function should **only** return errors and not set any state. Although this isn't causing an issue right now, the function should not return an object that is unrelated to errors in principle. Additionally, this will be necessary for an upcoming refactor of the `Send` component. Return only `TProposalError` from the function but make all fields optional. To keep the logic the same we set `proposedFee` to `undefined` according to the same logic (ie. `{}` or `{ amountError: ... }` is returned) but in the `Send` component not in the error handling function.
Configuration menu - View commit details
-
Copy full SHA for f06e0ae - Browse repository at this point
Copy the full SHA f06e0aeView commit details -
frontend: improve proposal response state
Instead of individual variables `proposedFee`, `proposedTotal`, and `proposedAmount` we can put the result itself into the component state. Because of this, it is not possible anymore to reset individual fields to `undefined` but this is correct since there should be no "old" proposal values available in case the current proposal was invalid resulting in an `undefined` `proposalResult`. Before this commit the amount fields could show false values because they would show the last converted `fiatAmount` and the last valid `proposedAmount` since it was not reset on error. Now that we reset it it would've shown `''` but this is not a good solution which is why this commit also falls back to the last typed amount and its fiat equivalent in case `sendAll` is `true` but the proposal was invalid. We also disable the `sendAll` checkbox in case there is an `addressError` or `feeError` because it can not work if the proposal is not valid. We don't disable it if there's only `amountError` because the `amount` is not relevant if `sendAll` is `true`.
Configuration menu - View commit details
-
Copy full SHA for 834e36e - Browse repository at this point
Copy the full SHA 834e36eView commit details -
frontend: improve setting
isUpdatingProposal
Set the `isUpdatingProposal` to `false` in the `finally` block of `validateAndDisplayFee` instead of twice in the `txProposal` funciton. This makes the component a bit easier to understand and smaller.
Configuration menu - View commit details
-
Copy full SHA for 095b5f5 - Browse repository at this point
Copy the full SHA 095b5f5View commit details -
frontend: improve note onChange handler
Improve the onChange handler of the `NoteInput` component to take a function that takes a string instead of the `ChangeEvent`. This will enable us to just pass the `setNote` setter to it when we refactor the `Send` component to be functional.
Configuration menu - View commit details
-
Copy full SHA for 377272a - Browse repository at this point
Copy the full SHA 377272aView commit details -
frontend: don't reset the custom fee
Don't reset the custom fee when the fee target changes/is set. The backend only uses the custom fee if fee target = custom which means it does not need to be set to be empty (''). Like this the user can select custom, type something, change to some other target, but as soon as he chooses custom again, what he typed earlier is still there. This will also enable us to only pass a `setFeeTarget` to the sub-component instead of having to define a handler, later when we refactor the `Send` component to functional.
Configuration menu - View commit details
-
Copy full SHA for d437c29 - Browse repository at this point
Copy the full SHA d437c29View commit details