Skip to content
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

Fix: show an error if risk isn't acknowledged #2216

Merged
merged 5 commits into from
Jul 4, 2023
Merged

Conversation

katspaugh
Copy link
Member

What it solves

When submitting a tx with risk, it will now ask to acknowledge the risk.

Screenshot 2023-07-03 at 12 54 06

@katspaugh katspaugh requested a review from iamacook July 3, 2023 10:54
@github-actions
Copy link

github-actions bot commented Jul 3, 2023

Branch preview

✅ Deploy successful!

https://risk_submit--walletweb.review-wallet-web.5afe.dev

@github-actions
Copy link

github-actions bot commented Jul 3, 2023

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@usame-algan
Copy link
Member

Alternatively, we could also give the checkbox area a red outline and scroll to it if necessary if we want so save vertical space.

@katspaugh
Copy link
Member Author

@usame-algan done. I suggest we keep the warning message too though, for accessibility. I think highlighting the checkbox is a nice effect but it can be unclear without a call to action.

useEffect(() => {
if (isRiskIgnored && checkboxRef.current) {
checkboxRef.current.scrollIntoView({ behavior: 'smooth', block: 'center' })
const timeout = setTimeout(() => setIsRiskIgnored(false), 3000)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to set the state to false after 3 seconds? When pressing submit, the checkbox changes to red but changes back to black after 3 seconds. Shouldn't it stay red until the user checks it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that when you click Submit again, it flashes red again

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imo it should stay red until there is some user action. Right now the warning message also disappears automatically.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would require bidirectional dataflow between the submit button and the checkbox.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remove line 48 and 49 in this file it seems to work as expected? Pressing submit multiple times won't animate anything again but the checkbox stays red until the user checks it.

Copy link
Member Author

@katspaugh katspaugh Jul 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pressing submit multiple times won't animate anything

Yeah, that's the part I don't like. But let's do it as you say. Resetting the error with a timeout isn't great either.

@katspaugh katspaugh merged commit 7575033 into epic-tx-flow Jul 4, 2023
6 of 7 checks passed
@katspaugh katspaugh deleted the risk-submit branch July 4, 2023 08:50
@github-actions github-actions bot locked and limited conversation to collaborators Jul 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants