-
Notifications
You must be signed in to change notification settings - Fork 16
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
Block confirming dangerous actions #271
Conversation
9e511eb
to
886c5d4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't understand what I read, but it looks pretty unthreatening of an implementation.
other than the implementation, we discussed in some brief meetings that the team wants to move the extension in this direction. so it is on behalf of our whole team that I formally enter this change as approved.
currentClassName = cx("click-cursor",{ | ||
"common-button": true, | ||
[propsClass]: true, | ||
currentClassName = cx("common-button", propsClass, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this part do? I don't know react.
getting rid of click-cursor? two-arg cx to three-arg cx? what is cx?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://www.npmjs.com/package/classnames
classNames('foo', { bar: true, duck: false }, 'baz', { quux: true }); // => 'foo bar baz quux'
classNames(null, false, 'bar', undefined, 0, 1, { baz: null }, ''); // => 'bar 1'
In case of our disabled button:
-
original
cx("click-cursor", { "common-button": true, ["account-common-btn account-common-btn-danger"]: true, "click-cursor": false, "click-cursor-disable": true, }) // => "click-cursor common-button account-common-btn account-common-btn-danger click-cursor-disable"
-
removed needless unconditional
click-cursor
. CSS context.click-cursor { cursor: pointer; } .click-cursor-disable { cursor: not-allowed; }
cx({ "common-button": true, ["account-common-btn account-common-btn-danger"]: true, "click-cursor": false, "click-cursor-disable": true, }) // => "common-button account-common-btn account-common-btn-danger click-cursor-disable"
-
used unconditional classes like a normal person (and typescript didn't like newly-typed
propsClass: string | undefined
as an object key)cx("common-button", "account-common-btn account-common-btn-danger", { "click-cursor": false, "click-cursor-disable": true, }) // => "common-button account-common-btn account-common-btn-danger click-cursor-disable"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok yeah that old one was really weird. probably written without an understanding of cx
.
"confirmWantToContinue": "Are you sure you want to continue?", | ||
"confirmTransferringToValidator": "This is a validator wallet address. Transfers to this address do not stake your funds with the validator.", | ||
"confirmDepositingToParatimeToForeignAccount": "Destination account is not in your wallet! We recommend you always deposit into your own ParaTime account, then transfer from there.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did we get rid of it? this PR adds no new references to this. were there broken references before this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#239 (comment)
had broken reference after we removed this warning from emerald. I didn't notice it was still used for cipher
"confirmTransferringToValidator": "This is a validator wallet address. Transfers to this address do not stake your funds with the validator.", | ||
"confirmWantToContinue": "Are you sure you want to continue?", | ||
"confirmTransferringToValidator": "This is a validator wallet address. Transfers to this address do not stake your funds with the validator.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ moved unchanged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All four warnings are now neatly together in the translation :D
users who must still do these non-recommended transactions using this software: for the time being, un-disable the button in the dev tools. in the longer term, migrate to using the CLI for these "I know what I'm doing" actions |
@@ -869,6 +869,7 @@ class SendPage extends React.Component { | |||
/> | |||
<Button | |||
content={getLanguage('confirm')} | |||
disabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, removing this in devtools doesn't fix click
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does disabled
work in the Button component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh it goes into <button disabled={disabled}>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Button
just forwards it to button
, then react does a lot of magic that I don't know.
Either react doesn't attach the listener when it creates a disabled button, or it ignores events based on internal props without looking at changed html.
But this is probably involved https://github.com/facebook/react/blob/9abe745/packages/react-dom/src/events/getListener.js#L40
367a9d9
to
840988a
Compare
Related to #243
Disables Confirm button in #236 for the following warnings:
Related to oasisprotocol/wallet@699336f